Revision 33586
tags/tmp_build/examples/exaExample1/.project | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>exaExample1</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
<buildCommand> |
|
9 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
10 |
<arguments> |
|
11 |
</arguments> |
|
12 |
</buildCommand> |
|
13 |
<buildCommand> |
|
14 |
<name>de.loskutov.FileSync.FSBuilder</name> |
|
15 |
<arguments> |
|
16 |
</arguments> |
|
17 |
</buildCommand> |
|
18 |
</buildSpec> |
|
19 |
<natures> |
|
20 |
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> |
|
21 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
22 |
<nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature> |
|
23 |
</natures> |
|
24 |
</projectDescription> |
|
0 | 25 |
tags/tmp_build/examples/exaExample1/config/about.htm | ||
---|---|---|
1 |
<html> |
|
2 |
|
|
3 |
<body> |
|
4 |
<p> </p> |
|
5 |
<table width="60%" border="0"> |
|
6 |
<tr> |
|
7 |
<td width="36%"><div align="right"><img src="images/logoIver.png" width="87" height="50"></div></td> |
|
8 |
</tr> |
|
9 |
<tr> |
|
10 |
<td colspan="2">EXAMPLE ABOUT </td> |
|
11 |
</tr> |
|
12 |
<tr> |
|
13 |
<td colspan="2"><font face="Arial, Helvetica, sans-serif"> This program is |
|
14 |
free software; you can redistribute it and/or<br> |
|
15 |
modify it under the terms of the GNU General Public License<br> |
|
16 |
as published by the Free Software Foundation; either version 2<br> |
|
17 |
of the License, or (at your option) any later version.<br> |
|
18 |
<br> |
|
19 |
This program is distributed in the hope that it will be useful,<br> |
|
20 |
but WITHOUT ANY WARRANTY; without even the implied warranty of<br> |
|
21 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br> |
|
22 |
GNU General Public License for more details.<br> |
|
23 |
<br> |
|
24 |
You should have received a copy of the GNU General Public License<br> |
|
25 |
along with this program; if not, write to the Free Software<br> |
|
26 |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.<br> |
|
27 |
<br> |
|
28 |
</tr> |
|
29 |
|
|
30 |
</table> |
|
31 |
<p> </p> |
|
32 |
<p><font face="Arial, Helvetica, sans-serif"><br> |
|
33 |
</font></p> |
|
34 |
<p> </p> |
|
35 |
</body> |
|
36 |
</html> |
|
0 | 37 |
tags/tmp_build/examples/exaExample1/config/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<plugin-config> |
|
3 |
<depends plugin-name="com.iver.cit.gvsig" /> |
|
4 |
<libraries library-dir="."/> |
|
5 |
<extensions> |
|
6 |
<extension class-name="com.iver.example.MySocket" |
|
7 |
description="Starts a ServerSocket in port 5757" |
|
8 |
active="true" |
|
9 |
priority="50"> |
|
10 |
</extension> |
|
11 |
<extension class-name="com.iver.example.ExampleExtension" |
|
12 |
description="Add a new about to the about panel." |
|
13 |
active="true" priority="50"> |
|
14 |
</extension> |
|
15 |
<extension class-name="com.iver.example.MyPrivateInfo" |
|
16 |
description="Shows info with a customized form" |
|
17 |
active="true" |
|
18 |
priority="50"> |
|
19 |
<tool-bar name="com.iver.cit.gvsig.Herramientas"> |
|
20 |
<selectable-tool icon="images/ejemplo.png" |
|
21 |
action-command="MYINFO" tooltip="informacion con formulario" /> |
|
22 |
</tool-bar> |
|
23 |
</extension> |
|
24 |
</extensions> |
|
25 |
</plugin-config> |
|
0 | 26 |
tags/tmp_build/examples/exaExample1/src/com/iver/example/ExampleExtension.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package com.iver.example; |
|
42 |
|
|
43 |
import com.iver.andami.PluginServices; |
|
44 |
import com.iver.andami.plugins.Extension; |
|
45 |
import com.iver.cit.gvsig.About; |
|
46 |
|
|
47 |
|
|
48 |
/** |
|
49 |
* Clase de ejemplo sencillo para crear una extensi?n que muestra la ventana |
|
50 |
* con la informaci?n "Acerca de..." |
|
51 |
* |
|
52 |
* @author Vicente Caballero Navarro |
|
53 |
*/ |
|
54 |
public class ExampleExtension extends Extension { |
|
55 |
/** |
|
56 |
* @see com.iver.andami.plugins.Extension#inicializar() |
|
57 |
*/ |
|
58 |
public void initialize() { |
|
59 |
About classAbout = (About) PluginServices.getExtension(com.iver.cit.gvsig.About.class); |
|
60 |
java.net.URL aboutURL2 = ExampleExtension.class.getResource( |
|
61 |
"/about.htm"); |
|
62 |
|
|
63 |
classAbout.getAboutPanel().addAboutUrl("AboutNewExtension", aboutURL2); |
|
64 |
|
|
65 |
} |
|
66 |
|
|
67 |
/** |
|
68 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
|
69 |
*/ |
|
70 |
public void execute(String actionCommand) { |
|
71 |
} |
|
72 |
|
|
73 |
/** |
|
74 |
* @see com.iver.andami.plugins.Extension#isEnabled() |
|
75 |
*/ |
|
76 |
public boolean isEnabled() { |
|
77 |
return true; |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* @see com.iver.andami.plugins.Extension#isVisible() |
|
82 |
*/ |
|
83 |
public boolean isVisible() { |
|
84 |
return true; |
|
85 |
} |
|
86 |
} |
|
0 | 87 |
tags/tmp_build/examples/exaExample1/src/com/iver/example/socket/InputThread.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 13-jun-2005 |
|
3 |
* |
|
4 |
*/ |
|
5 |
package com.iver.example.socket; |
|
6 |
|
|
7 |
import java.io.BufferedReader; |
|
8 |
import java.io.IOException; |
|
9 |
import java.io.InputStreamReader; |
|
10 |
import java.net.ServerSocket; |
|
11 |
import java.net.Socket; |
|
12 |
import java.net.SocketException; |
|
13 |
|
|
14 |
public class InputThread extends Thread { |
|
15 |
ServerSocket serverSocket; |
|
16 |
BufferedReader in; |
|
17 |
|
|
18 |
public InputThread(ServerSocket serverSocket) { |
|
19 |
this.serverSocket = serverSocket; |
|
20 |
} |
|
21 |
|
|
22 |
public void run() { |
|
23 |
|
|
24 |
try { |
|
25 |
Socket clientSocket = serverSocket.accept(); |
|
26 |
System.out.println("Connection established with " |
|
27 |
+ clientSocket); |
|
28 |
|
|
29 |
this.in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); |
|
30 |
|
|
31 |
String inputLine, outputLine; |
|
32 |
while ((inputLine = in.readLine()) != null) { |
|
33 |
System.out.println("Received:" + inputLine); |
|
34 |
if (inputLine.equals("option1")) |
|
35 |
{ |
|
36 |
// do something for option 1 |
|
37 |
} |
|
38 |
if (inputLine.equals("option2")) |
|
39 |
{ |
|
40 |
// do something for option 2 |
|
41 |
} |
|
42 |
if (inputLine.equals("Bye.")) |
|
43 |
break; |
|
44 |
} // while |
|
45 |
serverSocket.close(); |
|
46 |
|
|
47 |
} catch (SocketException e) { |
|
48 |
// output thread closed the socket |
|
49 |
} catch (IOException e) { |
|
50 |
System.out.println("Accept failed: 5757"); |
|
51 |
System.exit(-1); |
|
52 |
} |
|
53 |
try { |
|
54 |
in.close(); |
|
55 |
} catch (IOException e) { |
|
56 |
} |
|
57 |
} |
|
58 |
} |
|
0 | 59 |
tags/tmp_build/examples/exaExample1/src/com/iver/example/MyPrivateInfo.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 25-may-2005 |
|
3 |
* |
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
5 |
* |
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
7 |
* |
|
8 |
*/ |
|
9 |
package com.iver.example; |
|
10 |
|
|
11 |
import com.iver.andami.PluginServices; |
|
12 |
import com.iver.andami.plugins.Extension; |
|
13 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
14 |
import com.iver.cit.gvsig.fmap.MapContext; |
|
15 |
import com.iver.cit.gvsig.fmap.MapControl; |
|
16 |
import com.iver.cit.gvsig.fmap.tools.Behavior.PointBehavior; |
|
17 |
import com.iver.cit.gvsig.project.documents.view.IProjectView; |
|
18 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
|
19 |
import com.iver.example.tools.MyInfoListener; |
|
20 |
|
|
21 |
|
|
22 |
/** |
|
23 |
* @author Fjp |
|
24 |
* |
|
25 |
* Main class of this extension example. |
|
26 |
* The first time the method "execute" is called, we check if |
|
27 |
* we have already created MyInfoListener, and if not, we |
|
28 |
* create it and add to the mapControl. Then, if we receive the |
|
29 |
* acction command "MYINFO", we set this tool as active. |
|
30 |
*/ |
|
31 |
public class MyPrivateInfo extends Extension { |
|
32 |
|
|
33 |
MyInfoListener il = null; |
|
34 |
public void initialize() { |
|
35 |
|
|
36 |
|
|
37 |
} |
|
38 |
|
|
39 |
public void execute(String actionCommand) { |
|
40 |
View vista = (View) PluginServices.getMDIManager().getActiveWindow(); |
|
41 |
MapControl mapCtrl = vista.getMapControl(); |
|
42 |
if (il == null) // We create it for the first time. |
|
43 |
{ |
|
44 |
il = new MyInfoListener(mapCtrl); |
|
45 |
mapCtrl.addMapTool("myInfo", new PointBehavior(il)); |
|
46 |
} |
|
47 |
|
|
48 |
if (actionCommand.compareTo("MYINFO") == 0) |
|
49 |
{ |
|
50 |
mapCtrl.setTool("myInfo"); |
|
51 |
} |
|
52 |
} |
|
53 |
|
|
54 |
public boolean isEnabled() { |
|
55 |
return true; |
|
56 |
} |
|
57 |
|
|
58 |
/* (non-Javadoc) |
|
59 |
* @see com.iver.andami.plugins.Extension#isVisible() |
|
60 |
* |
|
61 |
* This tool will be visible only if the View class is the active view. |
|
62 |
*/ |
|
63 |
public boolean isVisible() { |
|
64 |
IWindow f = PluginServices.getMDIManager() |
|
65 |
.getActiveWindow(); |
|
66 |
|
|
67 |
if (f == null) { |
|
68 |
return false; |
|
69 |
} |
|
70 |
|
|
71 |
if (f.getClass() == View.class) { |
|
72 |
View vista = (View) f; |
|
73 |
IProjectView model = vista.getModel(); |
|
74 |
MapContext mapa = model.getMapContext(); |
|
75 |
|
|
76 |
return mapa.getLayers().getLayersCount() > 0; |
|
77 |
} else { |
|
78 |
return false; |
|
79 |
} |
|
80 |
} |
|
81 |
|
|
82 |
} |
|
0 | 83 |
tags/tmp_build/examples/exaExample1/src/com/iver/example/MySocket.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 13-jun-2005 |
|
3 |
* |
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
5 |
* |
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
7 |
* |
|
8 |
* This program is free software; you can redistribute it and/or |
|
9 |
* modify it under the terms of the GNU General Public License |
|
10 |
* as published by the Free Software Foundation; either version 2 |
|
11 |
* of the License, or (at your option) any later version. |
|
12 |
* |
|
13 |
* This program is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with this program; if not, write to the Free Software |
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
21 |
* |
|
22 |
* For more information, contact: |
|
23 |
* |
|
24 |
* Generalitat Valenciana |
|
25 |
* Conselleria d'Infraestructures i Transport |
|
26 |
* Av. Blasco Ib??ez, 50 |
|
27 |
* 46010 VALENCIA |
|
28 |
* SPAIN |
|
29 |
* |
|
30 |
* +34 963862235 |
|
31 |
* gvsig@gva.es |
|
32 |
* www.gvsig.gva.es |
|
33 |
* |
|
34 |
* or |
|
35 |
* |
|
36 |
* IVER T.I. S.A |
|
37 |
* Salamanca 50 |
|
38 |
* 46005 Valencia |
|
39 |
* Spain |
|
40 |
* |
|
41 |
* +34 963163400 |
|
42 |
* dac@iver.es |
|
43 |
*/ |
|
44 |
package com.iver.example; |
|
45 |
|
|
46 |
import java.io.IOException; |
|
47 |
import java.net.ServerSocket; |
|
48 |
import java.net.Socket; |
|
49 |
|
|
50 |
import com.iver.andami.plugins.Extension; |
|
51 |
import com.iver.example.socket.InputThread; |
|
52 |
|
|
53 |
public class MySocket extends Extension { |
|
54 |
|
|
55 |
public void initialize() { |
|
56 |
// Here we start the socket. This method is always |
|
57 |
// executed at the beginning. |
|
58 |
// TODO: Change method to Initialize in Extension interface. |
|
59 |
try { |
|
60 |
ServerSocket serverSocket = new ServerSocket(5757); |
|
61 |
Socket clientSocket = null; |
|
62 |
// accept waits till a client socket connects |
|
63 |
// (only one client in this example) |
|
64 |
System.out.println("Listening in port 5757"); |
|
65 |
Thread input = new InputThread(serverSocket); |
|
66 |
input.start( ); |
|
67 |
|
|
68 |
} catch (IOException e) { |
|
69 |
System.out.println("Could not listen on port: 5757"); |
|
70 |
System.exit(-1); |
|
71 |
} |
|
72 |
|
|
73 |
} |
|
74 |
|
|
75 |
public void execute(String actionCommand) { |
|
76 |
// TODO Auto-generated method stub |
|
77 |
|
|
78 |
} |
|
79 |
|
|
80 |
public boolean isEnabled() { |
|
81 |
// TODO Auto-generated method stub |
|
82 |
return false; |
|
83 |
} |
|
84 |
|
|
85 |
public boolean isVisible() { |
|
86 |
// TODO Auto-generated method stub |
|
87 |
return false; |
|
88 |
} |
|
89 |
|
|
90 |
} |
|
0 | 91 |
tags/tmp_build/examples/exaExample1/src/com/iver/example/tools/MyInfoListener.java | ||
---|---|---|
1 |
/* |
|
2 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
3 |
* |
|
4 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
5 |
* |
|
6 |
*/ |
|
7 |
package com.iver.example.tools; |
|
8 |
|
|
9 |
import java.awt.Cursor; |
|
10 |
import java.awt.geom.Point2D; |
|
11 |
|
|
12 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
13 |
import com.hardcode.gdbms.engine.data.DataSource; |
|
14 |
import com.hardcode.gdbms.engine.values.Value; |
|
15 |
import com.iver.andami.PluginServices; |
|
16 |
import com.iver.cit.gvsig.exceptions.visitors.VisitorException; |
|
17 |
import com.iver.cit.gvsig.fmap.MapControl; |
|
18 |
import com.iver.cit.gvsig.fmap.layers.FBitSet; |
|
19 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
20 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
|
21 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData; |
|
22 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.VectorialData; |
|
23 |
import com.iver.cit.gvsig.fmap.operations.strategies.QueryByPointVisitor; |
|
24 |
import com.iver.cit.gvsig.fmap.tools.BehaviorException; |
|
25 |
import com.iver.cit.gvsig.fmap.tools.Events.PointEvent; |
|
26 |
import com.iver.cit.gvsig.fmap.tools.Listeners.PointListener; |
|
27 |
import com.iver.example.dialogs.MyInfoDlg; |
|
28 |
|
|
29 |
public class MyInfoListener implements PointListener { |
|
30 |
|
|
31 |
private MapControl mapCtrl; |
|
32 |
private Cursor cur = java.awt.Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); |
|
33 |
|
|
34 |
|
|
35 |
public MyInfoListener(MapControl mc) { |
|
36 |
this.mapCtrl = mc; |
|
37 |
} |
|
38 |
|
|
39 |
|
|
40 |
/* (non-Javadoc) |
|
41 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#point(com.iver.cit.gvsig.fmap.tools.Events.PointEvent) |
|
42 |
* The PointEvent method bring you a point in pixel coordinates. You |
|
43 |
* need to transform it to world coordinates. The class to do conversions |
|
44 |
* is ViewPort, obtained thru the MapContext of mapCtrl. |
|
45 |
*/ |
|
46 |
public void point(PointEvent event) throws BehaviorException { |
|
47 |
|
|
48 |
Point2D pReal = mapCtrl.getMapContext().getViewPort().toMapPoint(event.getPoint()); |
|
49 |
|
|
50 |
MyInfoDlg dlg = new MyInfoDlg(); |
|
51 |
dlg = (MyInfoDlg) PluginServices.getMDIManager().addWindow(dlg); |
|
52 |
|
|
53 |
|
|
54 |
/* We will use a Visitor pattern to query the layer and |
|
55 |
* to obtain a FBitSet (the selected items). Then, we iterate thru |
|
56 |
* selection and extract the needed information from the dataSource. |
|
57 |
*/ |
|
58 |
QueryByPointVisitor visitor = new QueryByPointVisitor(); |
|
59 |
FLayers lyrs = mapCtrl.getMapContext().getLayers(); |
|
60 |
FLayer lyrProvin = lyrs.getLayer("Provin.shp"); |
|
61 |
visitor.setLayer(lyrProvin); |
|
62 |
visitor.setQueriedPoint(pReal); |
|
63 |
visitor.setTolerance(5.0); |
|
64 |
try { |
|
65 |
((VectorialData) lyrProvin).process(visitor); |
|
66 |
FBitSet selection = visitor.getBitSet(); |
|
67 |
|
|
68 |
DataSource ds = ((AlphanumericData) lyrProvin).getRecordset(); |
|
69 |
ds.start(); |
|
70 |
int idField = ds.getFieldIndexByName("NOM_PROVIN"); |
|
71 |
int numReg = 0; |
|
72 |
Value strNomProvin = null; |
|
73 |
|
|
74 |
while ((numReg = selection.nextSetBit(numReg)) > 0) |
|
75 |
{ |
|
76 |
strNomProvin = ds.getFieldValue(numReg, idField); |
|
77 |
numReg++; |
|
78 |
} |
|
79 |
ds.stop(); |
|
80 |
dlg.setProvince(strNomProvin.toString()); |
|
81 |
// dlg.setProvince("En un lugar de la Mancha"); |
|
82 |
} catch (ReadDriverException e) { |
|
83 |
// TODO Auto-generated catch block |
|
84 |
e.printStackTrace(); |
|
85 |
} catch (VisitorException e) { |
|
86 |
// TODO Auto-generated catch block |
|
87 |
e.printStackTrace(); |
|
88 |
} |
|
89 |
|
|
90 |
} |
|
91 |
|
|
92 |
public Cursor getCursor() { |
|
93 |
return cur; |
|
94 |
} |
|
95 |
|
|
96 |
public boolean cancelDrawing() { |
|
97 |
return false; |
|
98 |
} |
|
99 |
|
|
100 |
|
|
101 |
public void pointDoubleClick(PointEvent event) throws BehaviorException { |
|
102 |
// TODO Auto-generated method stub |
|
103 |
|
|
104 |
} |
|
105 |
|
|
106 |
} |
|
0 | 107 |
tags/tmp_build/examples/exaExample1/src/com/iver/example/dialogs/MyInfoDlg.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 26-may-2005 |
|
3 |
* |
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
5 |
* |
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
7 |
* |
|
8 |
* This program is free software; you can redistribute it and/or |
|
9 |
* modify it under the terms of the GNU General Public License |
|
10 |
* as published by the Free Software Foundation; either version 2 |
|
11 |
* of the License, or (at your option) any later version. |
|
12 |
* |
|
13 |
* This program is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with this program; if not, write to the Free Software |
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
21 |
* |
|
22 |
* For more information, contact: |
|
23 |
* |
|
24 |
* Generalitat Valenciana |
|
25 |
* Conselleria d'Infraestructures i Transport |
|
26 |
* Av. Blasco Ib??ez, 50 |
|
27 |
* 46010 VALENCIA |
|
28 |
* SPAIN |
|
29 |
* |
|
30 |
* +34 963862235 |
|
31 |
* gvsig@gva.es |
|
32 |
* www.gvsig.gva.es |
|
33 |
* |
|
34 |
* or |
|
35 |
* |
|
36 |
* IVER T.I. S.A |
|
37 |
* Salamanca 50 |
|
38 |
* 46005 Valencia |
|
39 |
* Spain |
|
40 |
* |
|
41 |
* +34 963163400 |
|
42 |
* dac@iver.es |
|
43 |
*/ |
|
44 |
package com.iver.example.dialogs; |
|
45 |
|
|
46 |
import javax.swing.JLabel; |
|
47 |
import javax.swing.JPanel; |
|
48 |
import javax.swing.JTextField; |
|
49 |
|
|
50 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
51 |
import com.iver.andami.ui.mdiManager.SingletonWindow; |
|
52 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
|
53 |
|
|
54 |
public class MyInfoDlg extends JPanel implements IWindow, SingletonWindow { |
|
55 |
|
|
56 |
private JLabel jLabel = null; |
|
57 |
private JTextField jTxtProvin = null; |
|
58 |
|
|
59 |
private WindowInfo mViewInfo = null; |
|
60 |
|
|
61 |
/** |
|
62 |
* This is the default constructor |
|
63 |
*/ |
|
64 |
public MyInfoDlg() { |
|
65 |
super(); |
|
66 |
initialize(); |
|
67 |
} |
|
68 |
|
|
69 |
/** |
|
70 |
* This method initializes this |
|
71 |
* |
|
72 |
* @return void |
|
73 |
*/ |
|
74 |
private void initialize() { |
|
75 |
jLabel = new JLabel(); |
|
76 |
jLabel.setText("Provincia:"); |
|
77 |
jLabel.setBounds(32, 29, 118, 32); |
|
78 |
jLabel.setFont(new java.awt.Font("Arial", java.awt.Font.PLAIN, 14)); |
|
79 |
this.setLayout(null); |
|
80 |
this.setSize(300, 200); |
|
81 |
this.add(getJTxtProvin(), null); |
|
82 |
this.add(jLabel, null); |
|
83 |
} |
|
84 |
|
|
85 |
/** |
|
86 |
* This method initializes jTextField |
|
87 |
* |
|
88 |
* @return javax.swing.JTextField |
|
89 |
*/ |
|
90 |
private JTextField getJTxtProvin() { |
|
91 |
if (jTxtProvin == null) { |
|
92 |
jTxtProvin = new JTextField(); |
|
93 |
jTxtProvin.setBounds(33, 78, 233, 43); |
|
94 |
jTxtProvin.setFont(new java.awt.Font("Arial", java.awt.Font.BOLD, 14)); |
|
95 |
} |
|
96 |
return jTxtProvin; |
|
97 |
} |
|
98 |
|
|
99 |
public void setProvince(String strProvin) |
|
100 |
{ |
|
101 |
jTxtProvin.setText(strProvin); |
|
102 |
} |
|
103 |
|
|
104 |
/* (non-Javadoc) |
|
105 |
* @see com.iver.andami.ui.mdiManager.View#getViewInfo() |
|
106 |
* Windows in Andami must implement this method. The ViewInfo |
|
107 |
* class states how a window will be shown. |
|
108 |
*/ |
|
109 |
public WindowInfo getWindowInfo() { |
|
110 |
if (mViewInfo == null) |
|
111 |
{ |
|
112 |
mViewInfo=new WindowInfo(WindowInfo.MODELESSDIALOG); |
|
113 |
mViewInfo.setTitle("INFO PROVIN"); |
|
114 |
} |
|
115 |
return mViewInfo; |
|
116 |
} |
|
117 |
|
|
118 |
public Object getWindowModel() { |
|
119 |
return "ID_MYVIEWINFO"; |
|
120 |
} |
|
121 |
|
|
122 |
} |
|
0 | 123 |
tags/tmp_build/examples/exaExample1/docs/Ejemplo_archivos/filelist.xml | ||
---|---|---|
1 |
<xml xmlns:o="urn:schemas-microsoft-com:office:office"> |
|
2 |
<o:MainFile HRef="../Ejemplo.htm"/> |
|
3 |
<o:File HRef="image003.png"/> |
|
4 |
<o:File HRef="image004.gif"/> |
|
5 |
<o:File HRef="image001.png"/> |
|
6 |
<o:File HRef="image005.jpg"/> |
|
7 |
<o:File HRef="filelist.xml"/> |
|
8 |
</xml> |
|
0 | 9 |
tags/tmp_build/examples/exaExample1/docs/Ejemplo.htm | ||
---|---|---|
1 |
<html> |
|
2 |
<head> |
|
3 |
<meta http-equiv=Content-Type content="text/html; charset=windows-1252"> |
|
4 |
<link rel=Edit-Time-Data href="Ejemplo_archivos/editdata.mso"> |
|
5 |
<link rel=Stylesheet type="text/css" media=all href=style.css> |
|
6 |
</head> |
|
7 |
<body bgcolor="#FFFFFF" link="#E86D26" vlink="#AD4D12" class="Normal" lang=ES> |
|
8 |
<div class=Section1> |
|
9 |
<p class=nivel2>Ejemplo de una sencilla extensi?n</p> |
|
10 |
<p class=nivel3>Introducci?n</p> |
|
11 |
<p>Con este tutorial se pretende mostrar una extensi?n |
|
12 |
b?sica que tan solo a?ada y muestre el contenido de una ventana en Andami?cuando se pulsa su icono |
|
13 |
<img width=15 height=15 |
|
14 |
src="Ejemplo_archivos/image004.gif" > , o opci?n de men?.</p> |
|
15 |
<p class=nivel3>Arbol del plugin</p> |
|
16 |
<p>Clases y ficheros necesarios para crear un plugin |
|
17 |
base.</p> |
|
18 |
<p>Esta extensi?n abrir? una ventana con la informaci?n referente a los autores, |
|
19 |
participaciones y software en el que se ha basado gvSIG.</p> |
|
20 |
<p class=pequenya>Esquema del proyecto de ejemplo.</p> |
|
21 |
<p> <img width=585 height=426 |
|
22 |
src="Ejemplo_archivos/image005.jpg" > </p> |
|
23 |
<p class=nivel3>Clases java</p> |
|
24 |
<h1>EjemploExtension.java></h1> |
|
25 |
<p>Se necesita como m?nimo una clase java. En nuestro caso ?EjemploExtension.java?, |
|
26 |
esta clase implementa la interfaz com.iver.andami.plugins.Extension |
|
27 |
con los m?todos: </p> |
|
28 |
<p>inicializar(); Que es invocado cuando se inicializa |
|
29 |
la extensi?n.</p> |
|
30 |
<p>execute(String actionCommand): El String que se pasa como par?metro indica que comando en concreto |
|
31 |
se ejecuta, de esta forma una misma extensi?n puede contener varios comandos.</p> |
|
32 |
<p>isEnabled(): Si devuelve |
|
33 |
true el icono o item de men? desplegable se quedan como habilitados ?y ?si por el contrario |
|
34 |
devuelve false se queda como deshabilitados.</p> |
|
35 |
<p>isVisible(): Si devuelve |
|
36 |
true el icono o item de men? se |
|
37 |
visualiza y si es false se oculta.</p> |
|
38 |
<h1>FPanelAbout.java</h1> |
|
39 |
<p>Es un ejemplo de como a?adir una ventana y su contenido a Andami, es un JPanel que implementa |
|
40 |
com.iver.andami.ui.mdiManager.View.</p> |
|
41 |
<h1>about.htm</h1> |
|
42 |
<p>P?gina HTML con la informaci?n que se mostrar? en la ventana que a?adimos |
|
43 |
a Andami, este archivo se utiliza para poder llevar a cabo el |
|
44 |
ejemplo.</p> |
|
45 |
<h1>config.xml</h1> |
|
46 |
<p>Archivo XML que sirve para configurar todas las extensiones que contiene |
|
47 |
el plugin.</p> |
|
48 |
<p style='text-autospace:none'><span |
|
49 |
class=GramE><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"; |
|
50 |
color:#0000E1;background:white;'><?<span |
|
51 |
class=SpellE>xml</span></span></span><span lang=EN-GB style='font-size:10.0pt; |
|
52 |
font-family:"Courier New";color:black;background:white;'> </span><span lang=EN-GB style='font-size:10.0pt; |
|
53 |
font-family:"Courier New";color:#0000E1;background:white;'>version=</span><span lang=EN-GB style='font-size:10.0pt; |
|
54 |
font-family:"Courier New";color:navy;background:white;'>"1.0"</span><span lang=EN-GB |
|
55 |
style='font-size:10.0pt;font-family:"Courier New";color:black;background:white; |
|
56 |
'> </span><span lang=EN-GB |
|
57 |
style='font-size:10.0pt;font-family:"Courier New";color:#0000E1;background: |
|
58 |
white;'>encoding=</span><span |
|
59 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:navy; |
|
60 |
background:white;'>"ISO-8859-1"</span><span |
|
61 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
62 |
background:white;'>?></span></p> |
|
63 |
<p style='text-autospace:none'><span |
|
64 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
65 |
background:white;'><<span |
|
66 |
class=SpellE><span class=GramE>plugin-config</span></span>></span></p> |
|
67 |
<p style='text-autospace:none'><span |
|
68 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:black; |
|
69 |
background:white;'>????? </span><span lang=EN-GB style='font-size: |
|
70 |
10.0pt;font-family:"Courier New";color:#0000E1;background:white;'><libraries</span><span lang=EN-GB |
|
71 |
style='font-size:10.0pt;font-family:"Courier New";color:black;background:white; |
|
72 |
'> </span><span lang=EN-GB |
|
73 |
style='font-size:10.0pt;font-family:"Courier New";color:#0000E1;background: |
|
74 |
white;'>library-dir=</span><span |
|
75 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:navy; |
|
76 |
background:white;'>"."</span><span |
|
77 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
78 |
background:white;'>/></span></p> |
|
79 |
<p style='text-autospace:none'><span |
|
80 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:black; |
|
81 |
background:white;'>??????????? </span><span lang=EN-GB |
|
82 |
style='font-size:10.0pt;font-family:"Courier New";color:#0000E1;background: |
|
83 |
white;'><<span class=SpellE>resourceBundle</span></span><span |
|
84 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:black; |
|
85 |
background:white;'> </span><span |
|
86 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
87 |
background:white;'>name=</span><span |
|
88 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:navy; |
|
89 |
background:white;'>"text"</span><span |
|
90 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
91 |
background:white;'>/></span></p> |
|
92 |
<p style='text-autospace:none'><span |
|
93 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:black; |
|
94 |
background:white;'>????? </span><span lang=EN-GB style='font-size: |
|
95 |
10.0pt;font-family:"Courier New";color:#0000E1;background:white;'><<span class=GramE>extensions</span>></span></p> |
|
96 |
<p class=pequenyacursiva><span lang=EN-GB>??????????? ??????????? </span>Nombre |
|
97 |
complete de la clase que implementa <span class=SpellE>Extension</span>.</p> |
|
98 |
<p style='text-autospace:none'><span |
|
99 |
style='font-size:10.0pt;font-family:"Courier New";color:black;background:white; |
|
100 |
'>??????????? </span><span |
|
101 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
102 |
background:white;'><extension</span><span |
|
103 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:black; |
|
104 |
background:white;'> </span><span |
|
105 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
106 |
background:white;'>class-name=</span><span |
|
107 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:navy; |
|
108 |
background:white;'>"<span |
|
109 |
class=SpellE>com.iver.ejemplo.EjemploExtension</span>"</span></p> |
|
110 |
<p class=pequenyacursiva><span lang=EN-GB>??????????? ??????????????????????? |
|
111 |
<span |
|
112 |
class=SpellE><span class=GramE>Descripci?n</span></span><span class=GramE> de |
|
113 |
la extension.</span></span></p> |
|
114 |
<p style='text-autospace:none'><span class=SpellE><span class=GramE><span |
|
115 |
style='font-size:10.0pt;font-family:"Courier New";color:#0000E1;background: |
|
116 |
white;'>description</span></span></span><span |
|
117 |
style='font-size:10.0pt;font-family:"Courier New";color:#0000E1;background: |
|
118 |
white;'>=</span><span style='font-size:10.0pt;font-family: |
|
119 |
"Courier New";color:navy;background:white;'>"Extensi?n de ejemplo que muestra |
|
120 |
una ventana nueva con informaci?n en <span class=SpellE>html</span>."</span></p> |
|
121 |
<p class=pequenyacursiva><span style='background:white;'>??????????????????????? |
|
122 |
??????????? Poner la extensi?n en modo activo o no <span class=GramE>activo(</span>Para |
|
123 |
ser cargada debe estar activa).</span></p> |
|
124 |
<p style='text-autospace:none'><span class=GramE><span lang=EN-GB style='font-size: |
|
125 |
10.0pt;font-family:"Courier New";color:#0000E1;background:white;'>active</span></span><span lang=EN-GB |
|
126 |
style='font-size:10.0pt;font-family:"Courier New";color:#0000E1;background: |
|
127 |
white;'>=</span><span lang=EN-GB |
|
128 |
style='font-size:10.0pt;font-family:"Courier New";color:navy;background:white; |
|
129 |
'>"true"</span><span |
|
130 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
131 |
background:white;'>></span></p> |
|
132 |
<p class=pequenyacursiva><span lang=EN-GB>??????????????????????? ??????????? |
|
133 |
</span>Ruta en el <span class=SpellE>menu</span> <span |
|
134 |
class=SpellE>desplegable</span>.</p> |
|
135 |
<p style='text-autospace:none'><span |
|
136 |
style='font-size:10.0pt;font-family:"Courier New";color:black;background:white; |
|
137 |
'>????????????????? </span><span |
|
138 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
139 |
background:white;'><menu</span><span |
|
140 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:black; |
|
141 |
background:white;'> </span><span |
|
142 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
143 |
background:white;'>text=</span><span |
|
144 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:navy; |
|
145 |
background:white;'>"<span |
|
146 |
class=SpellE>Archivo/ejemplo</span>"</span><span lang=EN-GB |
|
147 |
style='font-size:10.0pt;font-family:"Courier New";color:black;background:white; |
|
148 |
'> </span></p> |
|
149 |
<p class=pequenyacursiva><span |
|
150 |
class=SpellE><span lang=EN-GB>Tooltip</span></span><span |
|
151 |
lang=EN-GB> <st1:State w:st="on"><st1:place |
|
152 |
w:st="on"><span class=GramE>del</span> item.</span></p> |
|
153 |
<p style='text-autospace:none'><span |
|
154 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:black; |
|
155 |
background:white;'>????????????????? </span><span class=SpellE><span |
|
156 |
class=GramE><span style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
157 |
background:white;'>tooltip</span></span></span><span |
|
158 |
style='font-size:10.0pt;font-family:"Courier New";color:#0000E1;background: |
|
159 |
white;'>=</span><span style='font-size:10.0pt;font-family: |
|
160 |
"Courier New";color:navy;background:white;'>"ejemplo"</span></p> |
|
161 |
<p class=pequenyacursiva><span style='background:white;'>?????????????????????????????????? |
|
162 |
<u>Comando</u> en concreto, ya que <span class=GramE>pueden</span> haber varios |
|
163 |
en una misma extensi?n.</span></p> |
|
164 |
<p style='text-autospace:none'><span class=GramE><span lang=EN-GB style='font-size: |
|
165 |
10.0pt;font-family:"Courier New";color:#0000E1;background:white;'>action-command</span></span><span lang=EN-GB |
|
166 |
style='font-size:10.0pt;font-family:"Courier New";color:#0000E1;background: |
|
167 |
white;'>=</span><span lang=EN-GB |
|
168 |
style='font-size:10.0pt;font-family:"Courier New";color:navy;background:white; |
|
169 |
'>"EJEMPLO"</span><span |
|
170 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:black; |
|
171 |
background:white;'> </span></p> |
|
172 |
<p class=pequenyacursiva><span lang=EN-GB style='background:white;'>?????????????????????????????????? |
|
173 |
</span><span |
|
174 |
style='background:white;'>Icono que se mostrara en el <span |
|
175 |
class=SpellE>menu</span> <span class=SpellE>desplegable</span>.</span></p> |
|
176 |
<p style='text-autospace:none'><span class=GramE><span lang=EN-GB style='font-size: |
|
177 |
10.0pt;font-family:"Courier New";color:#0000E1;background:white;'>icon</span></span><span lang=EN-GB |
|
178 |
style='font-size:10.0pt;font-family:"Courier New";color:#0000E1;background: |
|
179 |
white;'>=</span><span lang=EN-GB |
|
180 |
style='font-size:10.0pt;font-family:"Courier New";color:navy;background:white; |
|
181 |
'>"images/<span class=SpellE>ejemplo.png</span>"</span><span |
|
182 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:black; |
|
183 |
background:white;'> </span><span |
|
184 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
185 |
background:white;'>/></span></p> |
|
186 |
<p class=pequenyacursiva><span lang=EN-GB>?????????????????????????????????????????????? |
|
187 |
??????????? </span>Nombre de la barra de herramientas en la que a?adimos el |
|
188 |
bot?n.</p> |
|
189 |
<p style='text-autospace:none'><span |
|
190 |
style='font-size:10.0pt;font-family:"Courier New";color:black;background:white; |
|
191 |
'>????????????????? </span><span |
|
192 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
193 |
background:white;'><tool-bar</span><span |
|
194 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:black; |
|
195 |
background:white;'> </span><span |
|
196 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
197 |
background:white;'>name=</span><span |
|
198 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:navy; |
|
199 |
background:white;'>"<span |
|
200 |
class=SpellE>Herramientas</span>"</span><span lang=EN-GB style='font-size: |
|
201 |
10.0pt;font-family:"Courier New";color:#0000E1;background:white;'>></span></p> |
|
202 |
<p class=pequenyacursiva><span lang=EN-GB>?????????????????????????????????????????????????????????? |
|
203 |
??????????? </span>Icono que se mostrara en el bot?n.</p> |
|
204 |
<p style='text-autospace:none'><span |
|
205 |
style='font-size:10.0pt;font-family:"Courier New";color:black;background:white; |
|
206 |
'>??????????????????????? </span><span |
|
207 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
208 |
background:white;'><action-tool</span><span |
|
209 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:black; |
|
210 |
background:white;'> </span><span |
|
211 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
212 |
background:white;'>icon=</span><span |
|
213 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:navy; |
|
214 |
background:white;'>"images/<span |
|
215 |
class=SpellE>ejemplo.png</span>"</span></p> |
|
216 |
<p class=pequenyacursiva><span lang=EN-GB>?????????????????????????????????????????????????????????? |
|
217 |
<span |
|
218 |
class=SpellE><span class=GramE>Comando</span></span><span class=GramE> <span |
|
219 |
class=SpellE>que</span> se <span class=SpellE>ejecutar?</span>.</span></span></p> |
|
220 |
<p style='text-autospace:none'><span |
|
221 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:black; |
|
222 |
background:white;'>???????????????????????????? </span><span |
|
223 |
class=GramE><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"; |
|
224 |
color:#0000E1;background:white;'>action-command</span></span><span |
|
225 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
226 |
background:white;'>=</span><span |
|
227 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:navy; |
|
228 |
background:white;'>"EJEMPLO"</span><span |
|
229 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:black; |
|
230 |
background:white;'> </span></p> |
|
231 |
<p class=pequenyacursiva><span |
|
232 |
class=SpellE><span lang=EN-GB>Tooltip</span></span><span |
|
233 |
lang=EN-GB> <st1:State w:st="on"><st1:place |
|
234 |
w:st="on"><span class=GramE>del</span> <span |
|
235 |
class=SpellE>bot?n</span>.</span></p> |
|
236 |
<p style='text-autospace:none'><span class=SpellE><span class=GramE><span |
|
237 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
238 |
background:white;'>tooltip</span></span></span><span |
|
239 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
240 |
background:white;'>=</span><span |
|
241 |
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:navy; |
|
242 |
background:white;'>"<span |
|
243 |
class=SpellE>ejemplo</span>"</span></p> |
|
244 |
<p class=pequenyacursiva><span lang=EN-GB>?????????????????????????????????????????????????????????? |
|
245 |
</span>Texto que se mostrar? cuando el bot?n est? deshabilitado.</p> |
|
246 |
<p style='text-autospace:none'><span |
|
247 |
style='font-size:10.0pt;font-family:"Courier New";color:black;background:white; |
|
248 |
'>???????????????????????????? </span><span |
|
249 |
class=SpellE><span class=GramE><span style='font-size:10.0pt;font-family:"Courier New"; |
|
250 |
color:#0000E1;background:white;'>enable</span></span></span><span |
|
251 |
class=GramE><span style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
252 |
background:white;'>-<span class=SpellE>text</span></span></span><span |
|
253 |
style='font-size:10.0pt;font-family:"Courier New";color:#0000E1;background: |
|
254 |
white;'>=</span><span style='font-size:10.0pt;font-family: |
|
255 |
"Courier New";color:navy;background:white;'>"deber?a de estar activada"</span><span style='font-size:10.0pt;font-family:"Courier New"; |
|
256 |
color:black;background:white;'> </span><span class=SpellE><span |
|
257 |
style='font-size:10.0pt;font-family:"Courier New";color:#0000E1;background: |
|
258 |
white;'>last</span></span><span style='font-size:10.0pt; |
|
259 |
font-family:"Courier New";color:#0000E1;background:white;'>=</span><span |
|
260 |
style='font-size:10.0pt;font-family:"Courier New";color:navy;background:white; |
|
261 |
'>"<span class=SpellE>true</span>"</span><span |
|
262 |
style='font-size:10.0pt;font-family:"Courier New";color:#0000E1;background: |
|
263 |
white;'>/></span></p> |
|
264 |
<p style='text-autospace:none'><span |
|
265 |
style='font-size:10.0pt;font-family:"Courier New";color:black;background:white; |
|
266 |
'>????????????????? </span><span |
|
267 |
style='font-size:10.0pt;font-family:"Courier New";color:#0000E1;background: |
|
268 |
white;'></<span class=SpellE><span class=GramE>tool</span></span><span |
|
269 |
class=GramE>-<span class=SpellE>bar</span></span>></span></p> |
|
270 |
<p style='text-autospace:none'><span |
|
271 |
style='font-size:10.0pt;font-family:"Courier New";color:black;background:white; |
|
272 |
'>??????????? </span><span |
|
273 |
style='font-size:10.0pt;font-family:"Courier New";color:#0000E1;background: |
|
274 |
white;'></<span class=SpellE><span class=GramE>extension</span></span>></span></p> |
|
275 |
<p style='text-autospace:none'><span |
|
276 |
style='font-size:10.0pt;font-family:"Courier New";color:black;background:white; |
|
277 |
'>????? </span><span |
|
278 |
style='font-size:10.0pt;font-family:"Courier New";color:#0000E1;background: |
|
279 |
white;'></extensions></span></p> |
|
280 |
<p><span style='font-size:10.0pt;font-family:"Courier New";color:#0000E1; |
|
281 |
background:white;'></</span> |
|
282 |
<p>plugin-config></p> |
|
283 |
<h1>Directorio images</h1> |
|
284 |
<p>Se guardan las im?genes que necesitamos para el plugin.</p> |
|
285 |
<h1>build.xml</h1> |
|
286 |
<p>Es un archivo Ant con todas las tareas necesarias |
|
287 |
para copiar el plugin con sus extensiones, im?genes |
|
288 |
y archivos necesarios al directorio de Andami donde |
|
289 |
le corresponde, para que este reconozca que existe un plugin |
|
290 |
que debe cargar.</p> |
|
291 |
</div> |
|
292 |
</body> |
|
293 |
</html> |
|
0 | 294 |
tags/tmp_build/examples/exaExample1/build.xml | ||
---|---|---|
1 |
<project name="Generar extension en Andami" default="generate-without-source" basedir="."> |
|
2 |
<description> |
|
3 |
Instala el plugin de ejemplo en Andami. |
|
4 |
</description> |
|
5 |
<!-- set global properties for this build --> |
|
6 |
<property name="src" location="src"/> |
|
7 |
<property name="build" location="bin"/> |
|
8 |
<property name="dist" location="dist"/> |
|
9 |
<property name="plugin" value="com.iver.ejemplo"/> |
|
10 |
<property name="extension-dir" location="../_fwAndami/gvSIG/extensiones"/> |
|
11 |
|
|
12 |
<target name="init"> |
|
13 |
<!-- Create the time stamp --> |
|
14 |
<tstamp/> |
|
15 |
<!-- Create the build directory structure used by compile --> |
|
16 |
<mkdir dir="${build}"/> |
|
17 |
<mkdir dir="${dist}"/> |
|
18 |
<!-- Creamos un fichero con el timeStamp para que lo lea el FPanelAbout --> |
|
19 |
<buildnumber/> |
|
20 |
|
|
21 |
</target> |
|
22 |
|
|
23 |
<target name="generate-without-source" description="generate the distribution without the source file" > |
|
24 |
<!-- Create the distribution directory --> |
|
25 |
<mkdir dir="${dist}"/> |
|
26 |
|
|
27 |
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file --> |
|
28 |
<jar jarfile="${dist}/${plugin}.jar" basedir="${build}"/> |
|
29 |
<copy file="config/config.xml" todir="${dist}"/> |
|
30 |
<copy file="config/about.htm" todir="${dist}"/> |
|
31 |
<copy todir="${dist}"> |
|
32 |
<fileset dir="." includes="text*.properties"/> |
|
33 |
</copy> |
|
34 |
<copy todir="${dist}/images"> |
|
35 |
<fileset dir="images/" includes="*"/> |
|
36 |
</copy> |
|
37 |
<move todir="${extension-dir}/${plugin}/"> |
|
38 |
<fileset dir="${dist}" includes="**/**"/> |
|
39 |
</move> |
|
40 |
</target> |
|
41 |
</project> |
|
42 |
|
|
0 | 43 |
tags/tmp_build/examples/exaLoadLayer/.project | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>exaLoadLayer</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
<buildCommand> |
|
9 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
10 |
<arguments> |
|
11 |
</arguments> |
|
12 |
</buildCommand> |
|
13 |
<buildCommand> |
|
14 |
<name>de.loskutov.FileSync.FSBuilder</name> |
|
15 |
<arguments> |
|
16 |
</arguments> |
|
17 |
</buildCommand> |
|
18 |
</buildSpec> |
|
19 |
<natures> |
|
20 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
21 |
</natures> |
|
22 |
</projectDescription> |
|
0 | 23 |
tags/tmp_build/examples/exaLoadLayer/config/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<plugin-config> |
|
3 |
<libraries library-dir="."/> |
|
4 |
<depends plugin-name="com.iver.cit.gvsig.jdbc_spatial" /> |
|
5 |
<resourceBundle name="text"/> |
|
6 |
<extensions> |
|
7 |
<extension class-name="org.gvsig.example.postgis.LoadLayer" |
|
8 |
description="Example to load a layer from postgis" |
|
9 |
active="true" |
|
10 |
priority="1"> |
|
11 |
<menu text="Tema/LoadLayer/provin" action-command="provin"/> |
|
12 |
</extension> |
|
13 |
<extension class-name="org.gvsig.example.memory.CreateMemoryLayer" |
|
14 |
description="Example to load a user made layer" |
|
15 |
active="true" |
|
16 |
priority="1"> |
|
17 |
<menu text="Tema/LoadMemoryLayer" action-command="MemoryLayer"/> |
|
18 |
</extension> |
|
19 |
|
|
20 |
</extensions> |
|
21 |
</plugin-config> |
|
0 | 22 |
tags/tmp_build/examples/exaLoadLayer/src/org/gvsig/example/memory/CreateMemoryLayer.java | ||
---|---|---|
1 |
package org.gvsig.example.memory; |
|
2 |
|
|
3 |
import java.util.ArrayList; |
|
4 |
|
|
5 |
import com.hardcode.gdbms.engine.values.Value; |
|
6 |
import com.hardcode.gdbms.engine.values.ValueFactory; |
|
7 |
import com.iver.andami.PluginServices; |
|
8 |
import com.iver.andami.plugins.Extension; |
|
9 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
10 |
import com.iver.cit.gvsig.fmap.MapControl; |
|
11 |
import com.iver.cit.gvsig.fmap.core.FPolyline2D; |
|
12 |
import com.iver.cit.gvsig.fmap.core.FShape; |
|
13 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
|
14 |
import com.iver.cit.gvsig.fmap.drivers.ConcreteMemoryDriver; |
|
15 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
16 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
|
17 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
|
18 |
|
|
19 |
/** |
|
20 |
* @author fjp |
|
21 |
* |
|
22 |
* Example of using a ConcreteMemoryDriver to obtain a "editable layer" where |
|
23 |
* you can write your features. |
|
24 |
* |
|
25 |
*/ |
|
26 |
public class CreateMemoryLayer extends Extension { |
|
27 |
|
|
28 |
public void initialize() { |
|
29 |
|
|
30 |
} |
|
31 |
|
|
32 |
public void execute(String actionCommand) { |
|
33 |
View v = (View) PluginServices.getMDIManager().getActiveWindow(); |
|
34 |
MapControl mapCtrl = v.getMapControl(); |
|
35 |
|
|
36 |
|
|
37 |
// DRIVER DEFINITION (SHAPE TYPE AND FIELDS) |
|
38 |
ConcreteMemoryDriver driver = new ConcreteMemoryDriver(); |
|
39 |
driver.setShapeType(FShape.LINE); |
|
40 |
|
|
41 |
ArrayList arrayFields = new ArrayList(); |
|
42 |
arrayFields.add("ID"); |
|
43 |
Value[] auxRow = new Value[1]; |
|
44 |
|
|
45 |
driver.getTableModel().setColumnIdentifiers(arrayFields.toArray()); |
|
46 |
|
|
47 |
|
|
48 |
// GEOMETRY DEFINITION |
|
49 |
GeneralPathX gp = new GeneralPathX(); |
|
50 |
|
|
51 |
gp.moveTo(20,80); |
|
52 |
gp.lineTo(80,60); |
|
53 |
gp.lineTo(100, 140); |
|
54 |
|
|
55 |
FShape shp = new FPolyline2D(gp); |
|
56 |
|
|
57 |
|
|
58 |
// ATRIBUTES |
|
59 |
auxRow[0] = ValueFactory.createValue(0); |
|
60 |
|
|
61 |
// ADD RECORD |
|
62 |
driver.addShape(shp, auxRow); |
|
63 |
|
|
64 |
|
|
65 |
// CREATE AND ADD LAYER |
|
66 |
FLayer lyr; |
|
67 |
String layerName = "Example"; |
|
68 |
lyr = LayerFactory.createLayer(layerName,driver, mapCtrl.getProjection()); |
|
69 |
|
|
70 |
if (lyr != null) { |
|
71 |
lyr.setVisible(true); |
|
72 |
mapCtrl.getMapContext().getLayers().addLayer(lyr); |
|
73 |
|
|
74 |
} |
|
75 |
|
|
76 |
|
|
77 |
} |
|
78 |
|
|
79 |
public boolean isEnabled() { |
|
80 |
return true; |
|
81 |
} |
|
82 |
|
|
83 |
public boolean isVisible() { |
|
84 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
|
85 |
|
|
86 |
if (v instanceof View) |
|
87 |
return true; |
|
88 |
else |
|
89 |
return false; |
|
90 |
} |
|
91 |
|
|
92 |
|
|
93 |
} |
|
94 |
|
|
0 | 95 |
tags/tmp_build/examples/exaLoadLayer/src/org/gvsig/example/postgis/LoadLayer.java | ||
---|---|---|
1 |
package org.gvsig.example.postgis; |
|
2 |
|
|
3 |
import java.sql.Connection; |
|
4 |
import java.sql.DriverManager; |
|
5 |
import java.sql.ResultSet; |
|
6 |
import java.sql.ResultSetMetaData; |
|
7 |
import java.sql.SQLException; |
|
8 |
import java.sql.Statement; |
|
9 |
|
|
10 |
import javax.swing.JOptionPane; |
|
11 |
|
|
12 |
import org.cresques.cts.ICoordTrans; |
|
13 |
import org.cresques.cts.IProjection; |
|
14 |
|
|
15 |
import com.hardcode.driverManager.DriverLoadException; |
|
16 |
import com.iver.andami.PluginServices; |
|
17 |
import com.iver.andami.plugins.Extension; |
|
18 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
19 |
import com.iver.cit.gvsig.fmap.MapControl; |
|
20 |
import com.iver.cit.gvsig.fmap.ViewPort; |
|
21 |
import com.iver.cit.gvsig.fmap.core.ICanReproject; |
|
22 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
|
23 |
import com.iver.cit.gvsig.fmap.drivers.ConnectionFactory; |
|
24 |
import com.iver.cit.gvsig.fmap.drivers.ConnectionJDBC; |
|
25 |
import com.iver.cit.gvsig.fmap.drivers.DBException; |
|
26 |
import com.iver.cit.gvsig.fmap.drivers.DBLayerDefinition; |
|
27 |
import com.iver.cit.gvsig.fmap.drivers.IConnection; |
|
28 |
import com.iver.cit.gvsig.fmap.drivers.IVectorialJDBCDriver; |
|
29 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
30 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
|
31 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
|
32 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
|
33 |
|
|
34 |
public class LoadLayer extends Extension { |
|
35 |
|
|
36 |
public void initialize() { |
|
37 |
|
|
38 |
} |
|
39 |
|
|
40 |
public void execute(String actionCommand) { |
|
41 |
// IN CONFIG.XML, the actionCommand should be the layer name. (table name) |
|
42 |
View v = (View) PluginServices.getMDIManager().getActiveWindow(); |
|
43 |
MapControl mapCtrl = v.getMapControl(); |
|
44 |
|
|
45 |
String dbURL = "jdbc:postgresql://localhost:5432/latin1"; // latin1 is the catalog name |
|
46 |
String user = "postgres"; |
|
47 |
String pwd = "aquilina"; |
|
48 |
String layerName = actionCommand; |
|
49 |
String tableName = actionCommand; |
|
50 |
IConnection conn; |
|
51 |
try { |
|
52 |
conn = ConnectionFactory.createConnection(dbURL, user, pwd); |
|
53 |
((ConnectionJDBC)conn).getConnection().setAutoCommit(false); |
|
54 |
|
|
55 |
String fidField = "gid"; // BE CAREFUL => MAY BE NOT!!! |
|
56 |
String geomField = "the_geom"; // BE CAREFUL => MAY BE NOT!!! => You should read table GEOMETRY_COLUMNS. |
|
57 |
// See PostGIS help. |
|
58 |
|
|
59 |
// To obtain the fields, make a connection and get them. |
|
60 |
Statement st = ((ConnectionJDBC)conn).getConnection().createStatement(); |
|
61 |
ResultSet rs = st.executeQuery("select * from " + tableName + " LIMIT 1"); |
|
62 |
ResultSetMetaData rsmd = rs.getMetaData(); |
|
63 |
String[] fields = new String[rsmd.getColumnCount()-1]; // We don't want to include the_geom field |
|
64 |
int j = 0; |
|
65 |
for (int i = 0; i < fields.length; i++) { |
|
66 |
if (!rsmd.getColumnName(i+1).equalsIgnoreCase(geomField)) |
|
67 |
{ |
|
68 |
fields[j++] = rsmd.getColumnName(i+1); |
|
69 |
} |
|
70 |
} |
|
71 |
rs.close(); |
|
72 |
|
|
73 |
/* String[] fields = new String[1]; |
|
74 |
fields[0] = "gid"; */ |
|
75 |
|
|
76 |
String whereClause = ""; |
|
77 |
|
|
78 |
IVectorialJDBCDriver driver = (IVectorialJDBCDriver) LayerFactory.getDM() |
|
79 |
.getDriver("PostGIS JDBC Driver"); |
|
80 |
|
|
81 |
// Here you can set the workingArea |
|
82 |
// driver.setWorkingArea(dbLayerDefinition.getWorkingArea()); |
|
83 |
|
|
84 |
|
|
85 |
String strEPSG = mapCtrl.getViewPort() |
|
86 |
.getProjection().getAbrev() |
|
87 |
.substring(5); |
|
88 |
DBLayerDefinition lyrDef = new DBLayerDefinition(); |
|
89 |
lyrDef.setName(layerName); |
|
90 |
lyrDef.setTableName(tableName); |
|
91 |
lyrDef.setWhereClause(whereClause); |
|
92 |
lyrDef.setFieldNames(fields); |
|
93 |
lyrDef.setFieldGeometry(geomField); |
|
94 |
lyrDef.setFieldID(fidField); |
|
95 |
// if (dbLayerDefinition.getWorkingArea() != null) |
|
96 |
// lyrDef.setWorkingArea(dbLayerDefinition.getWorkingArea()); |
|
97 |
|
|
98 |
lyrDef.setSRID_EPSG(strEPSG); |
|
99 |
if (driver instanceof ICanReproject) |
|
100 |
{ |
|
101 |
((ICanReproject)driver).setDestProjection(strEPSG); |
|
102 |
} |
|
103 |
driver.setData(conn, lyrDef); |
|
104 |
IProjection proj = null; |
|
105 |
if (driver instanceof ICanReproject) |
|
106 |
{ |
|
107 |
proj = CRSFactory.getCRS("EPSG:" + ((ICanReproject)driver).getSourceProjection(null,null)); |
|
108 |
} |
|
109 |
|
|
110 |
FLayer lyr = LayerFactory.createDBLayer(driver, layerName, proj); |
|
111 |
|
|
112 |
if (lyr != null) { |
|
113 |
lyr.setVisible(true); |
|
114 |
v.getMapControl().getMapContext().beginAtomicEvent(); |
|
115 |
// You shoud checkProjection to see if it is necesary to reproject |
|
116 |
checkProjection(lyr, v.getMapControl().getViewPort()); |
|
117 |
v.getMapControl().getMapContext().getLayers() |
|
118 |
.addLayer(lyr); |
|
119 |
v.getMapControl().getMapContext().endAtomicEvent(); |
|
120 |
|
|
121 |
} |
|
122 |
} catch (SQLException e) { |
|
123 |
// TODO Auto-generated catch block |
|
124 |
e.printStackTrace(); |
|
125 |
} catch (DriverLoadException e) { |
|
126 |
// TODO Auto-generated catch block |
|
127 |
e.printStackTrace(); |
|
128 |
} catch (DBException e) { |
|
129 |
// TODO Auto-generated catch block |
Also available in: Unified diff