svn-gvsig-desktop / import / extWFS2 / src / com / iver / cit / gvsig / gui / wizards / WFSWizardData.java @ 18294
History | View | Annotate | Download (6.21 KB)
1 | 4886 | jorpiell | package com.iver.cit.gvsig.gui.wizards; |
---|---|---|---|
2 | |||
3 | import java.awt.Component; |
||
4 | import java.io.IOException; |
||
5 | import java.net.ConnectException; |
||
6 | import java.net.URL; |
||
7 | |||
8 | import javax.swing.JOptionPane; |
||
9 | |||
10 | import com.iver.andami.PluginServices; |
||
11 | import com.iver.cit.gvsig.fmap.DriverException; |
||
12 | 18294 | jpiera | import com.iver.cit.gvsig.fmap.drivers.WFSDriverException; |
13 | 4886 | jorpiell | import com.iver.cit.gvsig.fmap.drivers.wfs.FMapWFSDriver; |
14 | 8823 | jorpiell | import com.iver.cit.gvsig.fmap.drivers.wfs.FMapWFSDriverFactory; |
15 | 4886 | jorpiell | |
16 | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
17 | *
|
||
18 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
19 | *
|
||
20 | * This program is free software; you can redistribute it and/or
|
||
21 | * modify it under the terms of the GNU General Public License
|
||
22 | * as published by the Free Software Foundation; either version 2
|
||
23 | * of the License, or (at your option) any later version.
|
||
24 | *
|
||
25 | * This program is distributed in the hope that it will be useful,
|
||
26 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
28 | * GNU General Public License for more details.
|
||
29 | *
|
||
30 | * You should have received a copy of the GNU General Public License
|
||
31 | * along with this program; if not, write to the Free Software
|
||
32 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
33 | *
|
||
34 | * For more information, contact:
|
||
35 | *
|
||
36 | * Generalitat Valenciana
|
||
37 | * Conselleria d'Infraestructures i Transport
|
||
38 | * Av. Blasco Ib??ez, 50
|
||
39 | * 46010 VALENCIA
|
||
40 | * SPAIN
|
||
41 | *
|
||
42 | * +34 963862235
|
||
43 | * gvsig@gva.es
|
||
44 | * www.gvsig.gva.es
|
||
45 | *
|
||
46 | * or
|
||
47 | *
|
||
48 | * IVER T.I. S.A
|
||
49 | * Salamanca 50
|
||
50 | * 46005 Valencia
|
||
51 | * Spain
|
||
52 | *
|
||
53 | * +34 963163400
|
||
54 | * dac@iver.es
|
||
55 | */
|
||
56 | /* CVS MESSAGES:
|
||
57 | *
|
||
58 | * $Id$
|
||
59 | * $Log$
|
||
60 | 9353 | jorpiell | * Revision 1.7.2.3 2006-12-18 08:44:12 jorpiell
|
61 | * Add a method to set the layer Driver
|
||
62 | *
|
||
63 | * Revision 1.7.2.2 2006/11/17 11:28:45 ppiqueras
|
||
64 | 8847 | ppiqueras | * Corregidos bugs y a?adida nueva funcionalidad.
|
65 | 8823 | jorpiell | *
|
66 | 8847 | ppiqueras | * Revision 1.9 2006/11/16 16:57:30 jorpiell
|
67 | * Un mensaje de error que no se mostraba
|
||
68 | *
|
||
69 | * Revision 1.8 2006/11/16 13:28:50 jorpiell
|
||
70 | * Se usa la factoria de layers para crear la capa
|
||
71 | *
|
||
72 | 8823 | jorpiell | * Revision 1.7 2006/07/11 07:26:43 caballero
|
73 | 6282 | caballero | * traducci?n cant_connect_wfs
|
74 | *
|
||
75 | * Revision 1.6 2006/06/14 08:46:24 jorpiell
|
||
76 | 5830 | jorpiell | * Se tiene en cuanta la opcion para refrescar las capabilities
|
77 | *
|
||
78 | * Revision 1.5 2006/05/23 13:21:59 jorpiell
|
||
79 | 5367 | jorpiell | * Si hay alg?n problema en la carga se muestra un mensaje de error
|
80 | *
|
||
81 | * Revision 1.4 2006/05/23 08:09:53 jorpiell
|
||
82 | 5339 | jorpiell | * Se ha cambiado la forma en la que se leian los valores seleccionados en los paneles y se ha cambiado el comportamiento de los botones
|
83 | *
|
||
84 | * Revision 1.3 2006/05/19 12:58:03 jorpiell
|
||
85 | 5300 | jorpiell | * Modificados algunos paneles
|
86 | *
|
||
87 | * Revision 1.2 2006/04/20 16:38:24 jorpiell
|
||
88 | 4911 | jorpiell | * Ahora mismo ya se puede hacer un getCapabilities y un getDescribeType de la capa seleccionada para ver los atributos a dibujar. Queda implementar el panel de opciones y hacer el getFeature().
|
89 | *
|
||
90 | * Revision 1.1 2006/04/19 12:50:16 jorpiell
|
||
91 | 4886 | jorpiell | * Primer commit de la aplicaci?n. Se puede hacer un getCapabilities y ver el mensaje de vienvenida del servidor
|
92 | *
|
||
93 | *
|
||
94 | */
|
||
95 | /**
|
||
96 | * @author Jorge Piera Llodr? (piera_jor@gva.es)
|
||
97 | */
|
||
98 | public class WFSWizardData { |
||
99 | private FMapWFSDriver driver = null; |
||
100 | private String title = null; |
||
101 | private String _abstract = null; |
||
102 | private String serverVersion = null; |
||
103 | 5339 | jorpiell | private int buffer = 0; |
104 | private int timeOut = 0; |
||
105 | private String UserName = null; |
||
106 | 6282 | caballero | |
107 | 5367 | jorpiell | public String getOnlineResource(){ |
108 | return driver.getOnlineResource();
|
||
109 | } |
||
110 | 6282 | caballero | |
111 | 4886 | jorpiell | /**
|
112 | 6282 | caballero | *
|
113 | 4886 | jorpiell | * @return The host name
|
114 | */
|
||
115 | public String getHost(){ |
||
116 | return driver.getHost();
|
||
117 | } |
||
118 | 6282 | caballero | |
119 | 4886 | jorpiell | /**
|
120 | * Create the WFSClient and try to connect
|
||
121 | * @param host
|
||
122 | * Server name
|
||
123 | * @throws DriverException
|
||
124 | */
|
||
125 | 5830 | jorpiell | public void setHost(URL host,boolean override) throws DriverException{ |
126 | 4886 | jorpiell | try {
|
127 | 8823 | jorpiell | driver = FMapWFSDriverFactory.getFMapDriverForURL(host); |
128 | 4886 | jorpiell | driver.createClient(host); |
129 | 6282 | caballero | |
130 | 5830 | jorpiell | if (!driver.connect(override,null)){ |
131 | 6282 | caballero | throw new DriverException(PluginServices.getText(this, "cant_connect_wfs") + host.toString()); |
132 | } |
||
133 | |||
134 | 4886 | jorpiell | } catch (ConnectException e) { |
135 | JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this,"server_timeout")); |
||
136 | e.printStackTrace(); |
||
137 | return;
|
||
138 | } catch (IOException e) { |
||
139 | JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this, "cant_connect")); |
||
140 | e.printStackTrace(); |
||
141 | return;
|
||
142 | 18294 | jpiera | } catch (WFSDriverException e) {
|
143 | 8823 | jorpiell | JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this, "cant_connect")); |
144 | e.printStackTrace(); |
||
145 | return;
|
||
146 | 6282 | caballero | } |
147 | 4886 | jorpiell | } |
148 | 6282 | caballero | |
149 | 4886 | jorpiell | /**
|
150 | * Server's title (not used in gvSIG)
|
||
151 | 6282 | caballero | *
|
152 | * T?tulo del servidor (no se usa en gvSIG)
|
||
153 | *
|
||
154 | 4886 | jorpiell | * @return
|
155 | */
|
||
156 | public String getTitle() { |
||
157 | title = driver.getServiceTitle(); |
||
158 | if (title == null){ |
||
159 | return "None"; |
||
160 | } |
||
161 | return title;
|
||
162 | } |
||
163 | 6282 | caballero | |
164 | 4886 | jorpiell | /**
|
165 | * The server description.
|
||
166 | 6282 | caballero | *
|
167 | 4886 | jorpiell | * La descripci?n del servidor
|
168 | 6282 | caballero | *
|
169 | 4886 | jorpiell | * @return String
|
170 | */
|
||
171 | public String getAbstract() { |
||
172 | _abstract= driver.getServiceAbstract(); |
||
173 | if (_abstract == null){ |
||
174 | return "None"; |
||
175 | } |
||
176 | return _abstract;
|
||
177 | } |
||
178 | 6282 | caballero | |
179 | 4886 | jorpiell | /**
|
180 | * @return Returns the driver.
|
||
181 | */
|
||
182 | public FMapWFSDriver getDriver() {
|
||
183 | return driver;
|
||
184 | } |
||
185 | 6282 | caballero | |
186 | 4886 | jorpiell | /**
|
187 | 6282 | caballero | *
|
188 | 4886 | jorpiell | * @return Features vector
|
189 | */
|
||
190 | 4911 | jorpiell | public Object[] getFeatures(){ |
191 | return driver.getLayerList();
|
||
192 | 4886 | jorpiell | } |
193 | 6282 | caballero | |
194 | 4886 | jorpiell | /**
|
195 | 4911 | jorpiell | * Return the feature info
|
196 | * @param featureName
|
||
197 | * @return
|
||
198 | */
|
||
199 | public Object getFeatureInfo(String featureName){ |
||
200 | return driver.getLayerInfo(featureName);
|
||
201 | } |
||
202 | 6282 | caballero | |
203 | 4911 | jorpiell | /**
|
204 | 6282 | caballero | *
|
205 | 4886 | jorpiell | * @return server type
|
206 | */
|
||
207 | public String getServerType() { |
||
208 | serverVersion = driver.getVersion(); |
||
209 | if (serverVersion==null){ |
||
210 | return "WFS"; |
||
211 | } |
||
212 | return "WFS "+ serverVersion; |
||
213 | } |
||
214 | 5339 | jorpiell | |
215 | /**
|
||
216 | * @return Returns the buffer.
|
||
217 | */
|
||
218 | public int getBuffer() { |
||
219 | return buffer;
|
||
220 | } |
||
221 | |||
222 | /**
|
||
223 | * @param buffer The buffer to set.
|
||
224 | */
|
||
225 | public void setBuffer(int buffer) { |
||
226 | this.buffer = buffer;
|
||
227 | } |
||
228 | |||
229 | /**
|
||
230 | * @return Returns the timeOut.
|
||
231 | */
|
||
232 | public int getTimeOut() { |
||
233 | return timeOut;
|
||
234 | } |
||
235 | |||
236 | /**
|
||
237 | * @param timeOut The timeOut to set.
|
||
238 | */
|
||
239 | public void setTimeOut(int timeOut) { |
||
240 | this.timeOut = timeOut;
|
||
241 | } |
||
242 | |||
243 | /**
|
||
244 | * @return Returns the userName.
|
||
245 | */
|
||
246 | public String getUserName() { |
||
247 | return UserName;
|
||
248 | } |
||
249 | |||
250 | /**
|
||
251 | * @param userName The userName to set.
|
||
252 | */
|
||
253 | public void setUserName(String userName) { |
||
254 | UserName = userName; |
||
255 | } |
||
256 | 6282 | caballero | |
257 | 9353 | jorpiell | public void setDriver(FMapWFSDriver driver) { |
258 | this.driver = driver;
|
||
259 | } |
||
260 | 6282 | caballero | |
261 | |||
262 | 9353 | jorpiell | |
263 | 4886 | jorpiell | } |