svn-gvsig-desktop / trunk / extensions / extCatalogYNomenclator / src / es / gva / cit / gvsig / gazetteer / gui / ConnectDialog.java @ 2966
History | View | Annotate | Download (3.57 KB)
1 | 2966 | jorpiell | /* 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 | } |