Statistics
| Revision:

root / trunk / extensions / extCatalogYNomenclator / src / es / gva / cit / gvsig / catalogClient / CatalogClientModule.java @ 2966

History | View | Annotate | Download (3.29 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.catalogClient;
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.catalogClient.gui.ConnectDialog;
50

    
51

    
52
/**
53
 * @author Luis W. Sevilla
54
 */
55
public class CatalogClientModule implements Extension {
56
        
57
        /* (non-Javadoc)
58
         * @see com.iver.andami.plugins.Extension#inicializar()
59
         */
60
        public void inicializar() {
61
                System.out.println("A?ado CatalogClientModule");
62
        }
63
        
64
        /* (non-Javadoc)
65
         * @see com.iver.andami.plugins.Extension#execute(java.lang.String)
66
         */
67
        public void execute(String actionCommand) {
68
                actionConnectDialogStart();
69
        }
70
        
71
        private void actionConnectDialogStart() {
72
                System.out.println("Bot?n Cliente de metadatos pulsado");
73
                //ConnectDialog.addServer("mapas.euitto.upm.es:2100");
74
                restoreServerList();
75
                ConnectDialog connectDialog = new ConnectDialog();
76
                PluginServices.getMDIManager().addView(connectDialog);
77
        }
78
        
79
        public void restoreServerList() {
80
                XMLEntity xml = PluginServices.getPluginServices(this)
81
                .getPersistentXML();
82
                if (xml == null)
83
                        xml = new XMLEntity();
84
                
85
                if (!xml.contains("cat-servers")) {
86
                        String[] servers = new String[6];
87
                        servers[5] = "http://localhost:2100";
88
                        servers[4] = "http://delta.icc.es/indicio/csw";
89
                        servers[3] = "sercartlin:2100";
90
                        servers[2] = "mapas.euitto.upm.es:2100";
91
                        servers[1] = "193.43.36.137:2100";
92
                        servers[0] = "gruposigp2:2100";
93
                        
94
                        xml.putProperty("cat-servers", servers);
95
                }
96
                
97
                try {
98
                        String[] servers = xml.getStringArrayProperty("cat-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
        /* (non-Javadoc)
108
         * @see com.iver.andami.plugins.Extension#isEnabled()
109
         */
110
        public boolean isEnabled() {
111
                return true;
112
        }
113
        
114
        /* (non-Javadoc)
115
         * @see com.iver.andami.plugins.Extension#isVisible()
116
         */
117
        public boolean isVisible() {
118
                com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager()
119
                .getActiveView();
120
                
121
                if (f == null) {
122
                        return false;
123
                }
124
                
125
                return (f.getClass() == View.class);
126
        }
127
}