root / trunk / extensions / extCatalogYNomenclator / src / es / gva / cit / gvsig / catalogClient / gui / ConnectDialog.java @ 3108
History | View | Annotate | Download (3.88 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(true,""); |
95 |
dialog.setBounds(0,0,525,85); |
96 |
dialog.setCatalogClient(getCliente()); |
97 |
dialog.setName(PluginServices.getText(this, "catalog_search")+" ["+getCurrentServer()+"]"); |
98 |
dialog.setCurrentServer(getCurrentServer()); |
99 |
dialog.setVisible(true);
|
100 |
PluginServices.getMDIManager().addView(dialog); |
101 |
} |
102 |
|
103 |
public void addHost(String host){ |
104 |
host = host.trim(); |
105 |
|
106 |
PluginServices ps = PluginServices.getPluginServices(this);
|
107 |
XMLEntity xml = ps.getPersistentXML(); |
108 |
|
109 |
try {
|
110 |
String[] servers = xml.getStringArrayProperty("cat-servers"); |
111 |
String[] newServers = new String[servers.length + 1]; |
112 |
System.arraycopy(servers, 0, newServers, 0, servers.length); |
113 |
newServers[servers.length] = host; |
114 |
xml.putProperty("cat-servers", newServers);
|
115 |
} catch (NotExistInXMLEntity e) {
|
116 |
xml.putProperty("cat-servers", new String[] { host }); |
117 |
} |
118 |
|
119 |
ps.setPersistentXML(xml); |
120 |
|
121 |
} |
122 |
|
123 |
/**
|
124 |
* Cierra el Dialog
|
125 |
*/
|
126 |
public void closeJDialog() { |
127 |
setVisible(false);
|
128 |
PluginServices.getMDIManager().closeView(ConnectDialog.this); |
129 |
} |
130 |
|
131 |
/* (non-Javadoc)
|
132 |
* @see com.iver.andami.ui.mdiManager.View#getViewInfo()
|
133 |
*/
|
134 |
public ViewInfo getViewInfo() {
|
135 |
ViewInfo m_viewinfo=new ViewInfo(ViewInfo.MODALDIALOG);
|
136 |
m_viewinfo.setTitle(PluginServices.getText(this, "metadata_catalog")); |
137 |
return m_viewinfo;
|
138 |
} |
139 |
|
140 |
// Anula la asignaci?n de Listeners del cliente 'Stand-alone'
|
141 |
public void setDefaultButtonListeners() { |
142 |
} |
143 |
} |