Revision 2966

View differences:

trunk/extensions/extCatalogYNomenclator/config/config.xml
13 13
					tooltip="catalog_search"/>
14 14
			</tool-bar>
15 15
		</extension>
16
		<extension class-name="es.gva.cit.gvsig.catalogClient.gazetteer.GazetteerModule"
16
		<extension class-name="es.gva.cit.gvsig.gazetteer.GazetteerModule"
17 17
			description="M?dulo de Gazetteer." 
18 18
			active="true" 
19 19
			priority="2">
trunk/extensions/extCatalogYNomenclator/src/es/gva/cit/gvsig/catalogClient/CatalogClientModule.java
83 83
			xml = new XMLEntity();
84 84
		
85 85
		if (!xml.contains("cat-servers")) {
86
			String[] servers = new String[5];
86
			String[] servers = new String[6];
87
			servers[5] = "http://localhost:2100";
87 88
			servers[4] = "http://delta.icc.es/indicio/csw";
88 89
			servers[3] = "sercartlin:2100";
89 90
			servers[2] = "mapas.euitto.upm.es:2100";
trunk/extensions/extCatalogYNomenclator/src/es/gva/cit/gvsig/catalogClient/gui/ConnectDialog.java
43 43
import com.iver.andami.PluginServices;
44 44
import com.iver.andami.ui.mdiManager.View;
45 45
import com.iver.andami.ui.mdiManager.ViewInfo;
46
import com.iver.utiles.NotExistInXMLEntity;
47
import com.iver.utiles.XMLEntity;
46 48

  
47 49
import es.gva.cit.catalogClient.ui.ServerConnectDialogPanel;
48 50

  
......
73 75
	private void init() {
74 76
		this.setBounds(0, 0, 630, 260);
75 77
		setName("connectDialog");
76
				
78
						
77 79
		getConnectButton().addActionListener(this);
78 80
		getSearchButton().addActionListener(new java.awt.event.ActionListener() {
79 81
            public void actionPerformed(java.awt.event.ActionEvent evt) {
......
87 89
	}
88 90
	
89 91
	public void searchButtonActionPerformed() {
90
        closeJDialog();
92
	    addHost(getCliente().getUrl().toString());
93
	    closeJDialog();
91 94
		SearchDialog dialog = new SearchDialog();
92 95
		dialog.setCatalogClient(getCliente());
93 96
		dialog.setBounds(0, 0, 675, 490);
......
96 99
		PluginServices.getMDIManager().addView(dialog);
97 100
	}
98 101
	
102
	 public void addHost(String host){
103
	        host = host.trim();
104

  
105
	        PluginServices ps = PluginServices.getPluginServices(this);
106
			XMLEntity xml = ps.getPersistentXML();
107

  
108
			try {
109
				String[] servers = xml.getStringArrayProperty("cat-servers");
110
				String[] newServers = new String[servers.length + 1];
111
				System.arraycopy(servers, 0, newServers, 0, servers.length);
112
				newServers[servers.length] = host;
113
				xml.putProperty("cat-servers", newServers);
114
			} catch (NotExistInXMLEntity e) {
115
					xml.putProperty("cat-servers", new String[] { host });
116
			}
117

  
118
			ps.setPersistentXML(xml);
119
			
120
	    }
121
	
99 122
	/**
100 123
	 * Cierra el Dialog
101 124
	 */
trunk/extensions/extCatalogYNomenclator/src/es/gva/cit/gvsig/gazetteer/GazetteerModule.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 es.gva.cit.gvsig.gazetteer;
42

  
43
import com.iver.andami.PluginServices;
44
import com.iver.andami.plugins.Extension;
45
import com.iver.cit.gvsig.gui.View;
46
import com.iver.utiles.NotExistInXMLEntity;
47
import com.iver.utiles.XMLEntity;
48

  
49
import es.gva.cit.gvsig.gazetteer.gui.ConnectDialog;
50

  
51

  
52
/**
53
 * @author Jorge Piera Llodra (piera_jor@gva.es)
54
 */
55
public class GazetteerModule implements Extension{
56

  
57
    public static void main(String[] args) {
58
    }
59

  
60
    /* (non-Javadoc)
61
     * @see com.iver.andami.plugins.Extension#inicializar()
62
     */
63
    public void inicializar() {
64
        System.out.println("A?ado GazetteerModule");
65
        
66
    }
67

  
68
    /* (non-Javadoc)
69
     * @see com.iver.andami.plugins.Extension#execute(java.lang.String)
70
     */
71
    public void execute(String actionCommand) {
72
        actionConnectDialogStart();
73
        
74
    }
75
    
76
    private void actionConnectDialogStart() {
77
		System.out.println("Bot?n de Gazeteer pulsado");
78
		restoreServerList();
79
		ConnectDialog connectDialog = new ConnectDialog();
80
		PluginServices.getMDIManager().addView(connectDialog);
81
	}
82
    
83
    public void restoreServerList() {
84
		XMLEntity xml = PluginServices.getPluginServices(this)
85
		.getPersistentXML();
86
		if (xml == null)
87
			xml = new XMLEntity();
88
		
89
		if (!xml.contains("gaz-servers")) {
90
			String[] servers = new String[1];
91
			 
92
			servers[0] = "http://sercartlin:8080/geoserver/wfs";
93
			
94
			xml.putProperty("gaz-servers", servers);
95
		}
96
		
97
		try {
98
			String[] servers = xml.getStringArrayProperty("gaz-servers");
99
			
100
			for (int i = 0; i < servers.length; i++) {
101
				ConnectDialog.addServer(servers[i]);
102
			}
103
		} catch (NotExistInXMLEntity e) {
104
		}
105
	}
106
	
107

  
108
    /* (non-Javadoc)
109
     * @see com.iver.andami.plugins.Extension#isEnabled()
110
     */
111
    public boolean isEnabled() {
112
        return true;
113
    }
114

  
115
    /* (non-Javadoc)
116
     * @see com.iver.andami.plugins.Extension#isVisible()
117
     */
118
    public boolean isVisible() {
119
        com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager()
120
		.getActiveView();
121
		
122
		if (f == null) {
123
			return false;
124
		}
125
		
126
		return (f.getClass() == View.class);
127
    }
128
}
0 129

  
trunk/extensions/extCatalogYNomenclator/src/es/gva/cit/gvsig/gazetteer/gui/ShowResultsDialog.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 es.gva.cit.gvsig.gazetteer.gui;
42

  
43
import com.iver.andami.PluginServices;
44
import com.iver.andami.ui.mdiManager.View;
45
import com.iver.andami.ui.mdiManager.ViewInfo;
46

  
47
import es.gva.cit.gazetteer.GazetteerClient;
48
import es.gva.cit.gazetteer.querys.Feature;
49
import es.gva.cit.gazetteer.ui.ShowResultsDialogPanel;
50
import es.gva.cit.gvsig.gazetteer.loaders.FeatureLoader;
51

  
52
/**
53
 * @author Jorge Piera Llodra (piera_jor@gva.es)
54
 */
55
public class ShowResultsDialog extends ShowResultsDialogPanel implements View  {
56

  
57
    /**
58
     * @param client
59
     * @param features
60
     * @param recordsByPage
61
     */
62
    public ShowResultsDialog(GazetteerClient client, Feature[] features, int recordsByPage) {
63
        super(client, features, recordsByPage);
64
    }
65

  
66
      /* (non-Javadoc)
67
     * @see com.iver.andami.ui.mdiManager.View#getViewInfo()
68
     */
69
    public ViewInfo getViewInfo() {
70
        ViewInfo m_viewinfo=new ViewInfo(ViewInfo.MODALDIALOG);
71
		m_viewinfo.setTitle(PluginServices.getText(this, "gazetteer_search"));
72
		return m_viewinfo;
73
    }
74
    
75
    public void closeButtonActionPerformed() {
76
	     closeJDialog();
77
	 }
78
   
79
   public void closeJDialog() {
80
		setVisible(true);
81
		PluginServices.getMDIManager().closeView(ShowResultsDialog.this);
82
	}
83
   
84
   /**
85
    * This method have to load the selected feature into gvSIG
86
    */
87
   public void loadButtonActionPerformed() {
88
       Feature feature = ppalPanel.getFeature();
89
       if (feature != null){
90
           new FeatureLoader().load(feature);
91
       }
92
   }
93
    
94
    
95
}
0 96

  
trunk/extensions/extCatalogYNomenclator/src/es/gva/cit/gvsig/gazetteer/gui/SearchDialog.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 es.gva.cit.gvsig.gazetteer.gui;
42

  
43
import com.iver.andami.PluginServices;
44
import com.iver.andami.ui.mdiManager.View;
45
import com.iver.andami.ui.mdiManager.ViewInfo;
46

  
47
import es.gva.cit.gazetteer.GazetteerClient;
48
import es.gva.cit.gazetteer.querys.Feature;
49
import es.gva.cit.gazetteer.ui.SearchDialogPanel;
50

  
51

  
52
/**
53
 * @author Jorge Piera Llodra (piera_jor@gva.es)
54
 */
55
public class SearchDialog extends SearchDialogPanel
56
implements View {
57

  
58
    public SearchDialog(GazetteerClient client){
59
        super(client);
60
    }
61
    /* (non-Javadoc)
62
     * @see com.iver.andami.ui.mdiManager.View#getViewInfo()
63
     */
64
    public ViewInfo getViewInfo() {
65
        ViewInfo m_viewinfo=new ViewInfo(ViewInfo.MODALDIALOG);
66
		m_viewinfo.setTitle(PluginServices.getText(this, "gazetteer_search"));
67
		return m_viewinfo;
68
    }
69
    
70
    public void ShowResultsActionPerformed(Feature[] features) {
71
        closeJDialog();
72
		ShowResultsDialog dialog = new ShowResultsDialog(client,features,controlsPanel.getNPaginas());
73
		dialog.setBounds(0, 0, 625, 292);
74
		dialog.setName(PluginServices.getText(this, "gazetteer_search"));
75
		dialog.setVisible(true);
76
		PluginServices.getMDIManager().addView(dialog);
77
	        
78
    }
79
    
80
    public void closeButtonActionPerformed() {
81
	     closeJDialog();
82
	 }
83
    
84
    public void closeJDialog() {
85
		setVisible(true);
86
		PluginServices.getMDIManager().closeView(SearchDialog.this);
87
	}
88
   
89
}
0 90

  
trunk/extensions/extCatalogYNomenclator/src/es/gva/cit/gvsig/gazetteer/gui/ConnectDialog.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 es.gva.cit.gvsig.gazetteer.gui;
42

  
43

  
44
import com.iver.andami.PluginServices;
45
import com.iver.andami.ui.mdiManager.View;
46
import com.iver.andami.ui.mdiManager.ViewInfo;
47
import com.iver.utiles.NotExistInXMLEntity;
48
import com.iver.utiles.XMLEntity;
49

  
50
import es.gva.cit.gazetteer.ui.ServerConnectDialogPanel;
51

  
52
/**
53
 * @author Jorge Piera Llodra (piera_jor@gva.es)
54
 */
55
public class ConnectDialog extends ServerConnectDialogPanel
56
implements View {
57

  
58
    /**
59
     * Building the dialog Window
60
     */
61
    public ConnectDialog(/*FLayers layers, MapControl mapCtrl*/) {
62
		super();
63
		init();
64
		getConnectButton().addActionListener(this);
65
		getSearchButton().addActionListener(this);
66
           
67
	}
68
      
69
    /**
70
     * Establishing window properties
71
     *
72
     */
73
    private void init() {
74
		this.setBounds(0, 0, 630, 260);
75
		setName("connectDialog");
76
    }
77
   
78
    public static void addServer(String name) {
79
		ServerConnectDialogPanel.addServer(name);
80
    }
81
    
82
    public void searchButtonActionPerformed() {
83
        addHost(client.getUrl().toString());
84
        closeJDialog();
85
		SearchDialog dialog = new SearchDialog(client);
86
		dialog.setBounds(0, 0, 675, 490);
87
		dialog.setName(PluginServices.getText(this, "gazetteer_search")+" ["+getCurrentServer()+"]");
88
		dialog.setVisible(true);
89
		PluginServices.getMDIManager().addView(dialog);
90
	}
91
    
92
    public void addHost(String host){
93
        host = host.trim();
94

  
95
        PluginServices ps = PluginServices.getPluginServices(this);
96
		XMLEntity xml = ps.getPersistentXML();
97

  
98
		try {
99
			String[] servers = xml.getStringArrayProperty("gaz-servers");
100
			String[] newServers = new String[servers.length + 1];
101
			System.arraycopy(servers, 0, newServers, 0, servers.length);
102
			newServers[servers.length] = host;
103
			xml.putProperty("gaz-servers", newServers);
104
		} catch (NotExistInXMLEntity e) {
105
				xml.putProperty("gaz-servers", new String[] { host });
106
		}
107

  
108
		ps.setPersistentXML(xml);
109
		
110
    }
111
    
112
	/**
113
	 * Cierra el Dialog
114
	 */
115
	public void closeJDialog() {
116
		setVisible(false);
117
		PluginServices.getMDIManager().closeView(ConnectDialog.this);
118
	}
119
	
120
	/* (non-Javadoc)
121
	 * @see com.iver.andami.ui.mdiManager.View#getViewInfo()
122
	 */
123
	public ViewInfo getViewInfo() {
124
		ViewInfo m_viewinfo=new ViewInfo(ViewInfo.MODALDIALOG);
125
		m_viewinfo.setTitle(PluginServices.getText(this, "gazetteer_connect"));
126
	return m_viewinfo;
127
	}
128

  
129
	// Anula la asignaci?n de Listeners del cliente 'Stand-alone'
130
	public void setDefaultButtonListeners() {
131
	}
132
}
0 133

  
trunk/extensions/extCatalogYNomenclator/src/es/gva/cit/gvsig/gazetteer/loaders/FeatureLoader.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 es.gva.cit.gvsig.gazetteer.loaders;
42

  
43
import com.iver.cit.gvsig.fmap.layers.FLayer;
44

  
45
import es.gva.cit.gazetteer.querys.Feature;
46
import es.gva.cit.gvsig.catalogClient.loaders.AbstractLoader;
47

  
48

  
49
/**
50
 * This class is used to load a new feature like a layer in gvSIG
51
 * 
52
 * @author Jorge Piera Llodra (piera_jor@gva.es)
53
 */
54
public class FeatureLoader extends AbstractLoader{
55
     
56
    /**
57
     * It loads a new Layer into gvSIG
58
     * @param feature
59
     * @return
60
     */
61
    public boolean load(Feature feature) {
62
		try {
63
			FLayer flayer = createFeatureLayer(feature);
64
		    if (flayer == null){
65
		        return false;
66
		    }else{
67
		        addLayerToView(flayer);
68
		        return true;
69
		    }
70
		    
71
		} catch (Exception e) {
72
			// TODO Auto-generated catch block
73
			e.printStackTrace();
74
		} 
75
		return false;
76
	}
77
    /**
78
     * It creates the new Feature layer into gvSIG
79
     * @param feature
80
     * Feature to load
81
     * @return
82
     */
83
    
84
    private FLayer createFeatureLayer(Feature feature) {
85
       
86
        return null;
87
	   
88
	}
89
}
0 90

  
trunk/extensions/extCatalogYNomenclator/build.xml
8 8
  <property name="dist"  location="dist"/>
9 9
  <property name="mainplugin" value="com.iver.cit.gvsig"/>
10 10
  <property name="plugin" value="es.gva.cit.gvsig.catalogClient"/>
11
  <property name="pluginGaz" value="es.gva.cit.gvsig.gazetteer"/>
11 12
  <property name="gvsiglibjar" value="gvsig-catalogClient"/>
12 13
  <property name="extensionDir" location="../Andami/gvSIG/extensiones"/>
13 14
  <property name="catProtoDir" value="../CatalogClientPrototype"/>
14 15
  <property name="remoteMapClientsDir" value="../Cq RemoteMapClients"/>
15 16
  <property name="wfsDir" value="../gvSIG_WFS"/>	
16 17
  <property name="postgisDir" value="../gvSIG_JDBC"/>	
18
 
17 19
  
18 20
  <target name="init">
19 21
    <!-- Create the time stamp -->
......
39 41
  	<jar jarfile="${dist}/lib/wfsClient.jar" basedir="${wfsDir}/bin"/>
40 42
  	<jar jarfile="${dist}/lib/postgis.jar" basedir="${postgisDir}/bin"/>
41 43
  	<jar jarfile="${dist}/lib/${plugin}.jar" basedir="${build}" includes="es/gva/cit/gvsig/catalogClient/**"/>
42
    <!--jar jarfile="${dist}/${gvsiglibjar}.jar" basedir="${build}" includes="com/iver/cit/gvsig/gui/**"/-->
44
  	<jar jarfile="${dist}/lib/${pluginGaz}.jar" basedir="${build}" includes="es/gva/cit/gvsig/gazetteer/**"/>
45
  	<!--jar jarfile="${dist}/${gvsiglibjar}.jar" basedir="${build}" includes="com/iver/cit/gvsig/gui/**"/-->
43 46
   	<copy file="config/config.xml" todir="${dist}"/>
44 47
    <copy file="config/plugin.dtd" todir="${dist}"/>
45 48
    <copy todir="${dist}">

Also available in: Unified diff