Statistics
| Revision:

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

History | View | Annotate | Download (3.83 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.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
import com.iver.utiles.NotExistInXMLEntity;
47
import com.iver.utiles.XMLEntity;
48

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

    
51
/**
52
 * Inicia la consulta de cat?logo de metadatos
53
 * @author luisw
54
 */
55
public class ConnectDialog extends ServerConnectDialogPanel
56
implements View {
57

    
58
        
59

    
60
        /**
61
         * Constructor de la ventana de dialogo.
62
         *
63
         */
64
        public ConnectDialog(/*FLayers layers, MapControl mapCtrl*/) {
65
                super();
66
                //super.setModal(true);
67
                //this.layers = layers;
68
                //this.mapCtrl = mapCtrl;
69
                init();
70
        }
71
        
72
        /**
73
         * Inicializa el Dialog        
74
         */    
75
        private void init() {
76
                this.setBounds(0, 0, 630, 260);
77
                setName("connectDialog");
78
                                                
79
                getConnectButton().addActionListener(this);
80
                getSearchButton().addActionListener(new java.awt.event.ActionListener() {
81
            public void actionPerformed(java.awt.event.ActionEvent evt) {
82
                    searchButtonActionPerformed();
83
            }
84
        });
85
        }
86
        
87
        public static void addServer(String name) {
88
                ServerConnectDialogPanel.addServer(name);
89
        }
90
        
91
        public void searchButtonActionPerformed() {
92
            addHost(getCliente().getUrl().toString());
93
            closeJDialog();
94
                SearchDialog dialog = new SearchDialog();
95
                dialog.setCatalogClient(getCliente());
96
                dialog.setBounds(0, 0, 675, 490);
97
                dialog.setName(PluginServices.getText(this, "catalog_search")+" ["+getCurrentServer()+"]");
98
                dialog.setVisible(true);
99
                PluginServices.getMDIManager().addView(dialog);
100
        }
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
        
122
        /**
123
         * Cierra el Dialog
124
         */
125
        public void closeJDialog() {
126
                setVisible(false);
127
                PluginServices.getMDIManager().closeView(ConnectDialog.this);
128
        }
129
        
130
        /* (non-Javadoc)
131
         * @see com.iver.andami.ui.mdiManager.View#getViewInfo()
132
         */
133
        public ViewInfo getViewInfo() {
134
                ViewInfo m_viewinfo=new ViewInfo(ViewInfo.MODALDIALOG);
135
                m_viewinfo.setTitle(PluginServices.getText(this, "metadata_catalog"));
136
        return m_viewinfo;
137
        }
138

    
139
        // Anula la asignaci?n de Listeners del cliente 'Stand-alone'
140
        public void setDefaultButtonListeners() {
141
        }
142
}