Statistics
| Revision:

root / trunk / extensions / extCatalogYNomenclator / src / es / gva / cit / gvsig / gazetteer / GazetteerModule.java @ 3034

History | View | Annotate | Download (3.3 KB)

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[2];
91
                         
92
                        servers[1] = "http://sercartlin:8080/geoserver/wfs";
93
                        servers[0] = "http://testbed.alexandria.ucsb.edu:8080/gaz/adl_gaz2/dispatch";
94
                        
95
                        xml.putProperty("gaz-servers", servers);
96
                }
97
                
98
                try {
99
                        String[] servers = xml.getStringArrayProperty("gaz-servers");
100
                        
101
                        for (int i = 0; i < servers.length; i++) {
102
                                ConnectDialog.addServer(servers[i]);
103
                        }
104
                } catch (NotExistInXMLEntity e) {
105
                }
106
        }
107
        
108

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

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