root / trunk / extensions / extWFS2 / src / com / iver / cit / gvsig / gui / panels / WFSParamsPanel.java @ 11132
History | View | Annotate | Download (23.6 KB)
1 |
package com.iver.cit.gvsig.gui.panels; |
---|---|
2 |
|
3 |
import java.awt.event.FocusEvent; |
4 |
import java.awt.event.FocusListener; |
5 |
import java.awt.geom.Rectangle2D; |
6 |
import java.util.Map; |
7 |
import java.util.prefs.Preferences; |
8 |
|
9 |
import javax.swing.JOptionPane; |
10 |
import javax.swing.JTabbedPane; |
11 |
|
12 |
import org.gvsig.remoteClient.wfs.WFSStatus; |
13 |
|
14 |
import com.iver.andami.PluginServices; |
15 |
import com.iver.cit.gvsig.fmap.drivers.wfs.FMapWFSDriver; |
16 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
17 |
import com.iver.cit.gvsig.fmap.layers.FLyrWFS; |
18 |
import com.iver.cit.gvsig.fmap.layers.WFSLayerNode; |
19 |
import com.iver.cit.gvsig.gui.WizardPanel; |
20 |
import com.iver.cit.gvsig.gui.dialogs.WFSPropsDialog; |
21 |
import com.iver.cit.gvsig.gui.wizards.WFSWizard; |
22 |
import com.iver.cit.gvsig.gui.wizards.WFSWizardData; |
23 |
import com.iver.cit.gvsig.gui.wizards.WizardListener; |
24 |
import com.iver.cit.gvsig.gui.wizards.WizardListenerSupport; |
25 |
|
26 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
27 |
*
|
28 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
29 |
*
|
30 |
* This program is free software; you can redistribute it and/or
|
31 |
* modify it under the terms of the GNU General Public License
|
32 |
* as published by the Free Software Foundation; either version 2
|
33 |
* of the License, or (at your option) any later version.
|
34 |
*
|
35 |
* This program is distributed in the hope that it will be useful,
|
36 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
37 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
38 |
* GNU General Public License for more details.
|
39 |
*
|
40 |
* You should have received a copy of the GNU General Public License
|
41 |
* along with this program; if not, write to the Free Software
|
42 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
43 |
*
|
44 |
* For more information, contact:
|
45 |
*
|
46 |
* Generalitat Valenciana
|
47 |
* Conselleria d'Infraestructures i Transport
|
48 |
* Av. Blasco Ib??ez, 50
|
49 |
* 46010 VALENCIA
|
50 |
* SPAIN
|
51 |
*
|
52 |
* +34 963862235
|
53 |
* gvsig@gva.es
|
54 |
* www.gvsig.gva.es
|
55 |
*
|
56 |
* or
|
57 |
*
|
58 |
* IVER T.I. S.A
|
59 |
* Salamanca 50
|
60 |
* 46005 Valencia
|
61 |
* Spain
|
62 |
*
|
63 |
* +34 963163400
|
64 |
* dac@iver.es
|
65 |
*/
|
66 |
/* CVS MESSAGES:
|
67 |
*
|
68 |
* $Id: WFSParamsPanel.java 11132 2007-04-11 12:08:55Z ppiqueras $
|
69 |
* $Log$
|
70 |
* Revision 1.40 2007-04-11 12:08:55 ppiqueras
|
71 |
* Varios cambios:
|
72 |
* - Corregida etiqueta "Campo"
|
73 |
* - Cambiada actualizaci?n
|
74 |
* - Corregido bug: actualizar ?rea visible despu?s de pulsar "Aplicar" en la interfaz gr?fica.
|
75 |
*
|
76 |
* Revision 1.39 2007/03/15 13:33:44 ppiqueras
|
77 |
* Corregido bug de excepci?n que se lanzaba cuando se filtraba y no se pod?a cargar la capa.
|
78 |
*
|
79 |
* Revision 1.38 2007/03/05 13:49:42 ppiqueras
|
80 |
* Si una capa WFS no tiene campos (y por tanto no tiene un campo obligatorio de tipo geometr?a), que avise al usuario y no permita que se intente cargar dicha capa.
|
81 |
*
|
82 |
* Revision 1.37 2007/03/01 13:12:09 ppiqueras
|
83 |
* Mejorado el filtrado por ?rea.
|
84 |
*
|
85 |
* Revision 1.36 2007/02/22 12:30:59 ppiqueras
|
86 |
* - Eliminado m?todo que sobraba.
|
87 |
* - Mejorada la relaci?n con el panel del ?rea.
|
88 |
* - A?adido JOptionPanel de aviso que no se aplicar? ?rea porque es incorrecta.
|
89 |
*
|
90 |
* Revision 1.35 2007/02/20 11:31:11 ppiqueras
|
91 |
* Eliminados comentarios que sobraban.
|
92 |
*
|
93 |
* Revision 1.34 2007/02/19 11:44:42 jorpiell
|
94 |
* A?adidos los filtros por ?rea
|
95 |
*
|
96 |
* Revision 1.33 2007/02/16 13:36:53 ppiqueras
|
97 |
* Que el ?rea seleccionada en el panel WFSArea sea accesible una vez se va a aplicar.
|
98 |
*
|
99 |
* Revision 1.32 2007/02/12 11:37:00 ppiqueras
|
100 |
* A?adidos comentarios y m?todo para refrescar el MapControl de la pesta?a del ?rea.
|
101 |
*
|
102 |
* Revision 1.31 2007/02/09 14:12:39 jorpiell
|
103 |
* Soporte para WFS 1.1 y WFS-T
|
104 |
*
|
105 |
* Revision 1.30 2007/02/02 12:22:22 ppiqueras
|
106 |
* Corregido alg?n bug.
|
107 |
*
|
108 |
* Revision 1.29 2007/01/08 09:37:39 ppiqueras
|
109 |
* Eliminado comentario que sobraba
|
110 |
*
|
111 |
* Revision 1.28 2006/12/29 09:27:02 ppiqueras
|
112 |
* Corregidos varios bugs:
|
113 |
*
|
114 |
* - Se ejecuta 2 veces "Aplicar" o "Aceptar" en los filtros WFS.
|
115 |
* - Cuando se carga por primera vez una capa WFS, si se pone un
|
116 |
* filtro incorrecto, se ignora el filtro (cargando toda la informaci?n posible de la capa, y borrando el texto de filtrado).
|
117 |
*
|
118 |
* Revision 1.27 2006/12/26 09:19:40 ppiqueras
|
119 |
* Cambiado "atttibutes" en todas las aparaciones en atributos, m?todos, clases, paquetes o comentarios por "fields". (S?lo a aquellas que afectan a clases dentro del proyecto extWFS2).
|
120 |
*
|
121 |
* Revision 1.26 2006/12/20 14:22:06 ppiqueras
|
122 |
* A?adido comentario
|
123 |
*
|
124 |
* Revision 1.25 2006/12/15 13:59:36 ppiqueras
|
125 |
* -Permite que se almacenen y/o recojan todos los campos y valores conocidos de la capa actual.
|
126 |
*
|
127 |
* -Adem?s, control frentre a consultas de filtro err?neas, (esto a medias a?n).
|
128 |
*
|
129 |
* - Alg?n comentario m?s.
|
130 |
*
|
131 |
* Revision 1.24 2006/12/12 10:24:45 ppiqueras
|
132 |
* Nueva funcionalidad: Pulsando doble 'click' sobre una capa de un servidor, se carga (igual que antes), pero adem?s se avanza a la siguiente pesta?a sin tener que pulsar el bot?n 'Siguiente'.
|
133 |
*
|
134 |
* Revision 1.23 2006/12/11 11:02:24 ppiqueras
|
135 |
* Corregido bug -> que se mantenga la frase de filtrado
|
136 |
*
|
137 |
* Revision 1.22 2006/12/04 08:59:47 ppiqueras
|
138 |
* Algunos bugs corregidos. A cambio hay 2 bugs relacionados que todav?a no han sido corregidos (ver PHPCollab) (los tiene asignados Jorge).
|
139 |
*
|
140 |
* Revision 1.21 2006/11/28 08:05:13 jorpiell
|
141 |
* Se escribe la query en la pesta?a del filtro
|
142 |
*
|
143 |
* Revision 1.20 2006/11/14 13:45:49 ppiqueras
|
144 |
* A?adida peque?a funcionalidad:
|
145 |
* Cuando se pulsa el bot?n "Aplicar", (al seleccionar un nuevo filtro), si el ?rbol de campos posee alguno seleccionado, actualiza los valores (con los nuevos), asociados a ?ste campo seleccionado.
|
146 |
*
|
147 |
* Revision 1.19 2006/10/27 12:10:02 ppiqueras
|
148 |
* Nueva funcionalidad
|
149 |
*
|
150 |
* Revision 1.16 2006/10/23 07:37:04 jorpiell
|
151 |
* Ya funciona el filterEncoding
|
152 |
*
|
153 |
* Revision 1.14 2006/10/13 13:05:32 ppiqueras
|
154 |
* Permite el refrescado de datos del panel de filtrado sobre capa WFS.
|
155 |
*
|
156 |
* Revision 1.13 2006/10/10 12:55:06 jorpiell
|
157 |
* Se ha a?adido el soporte de features complejas
|
158 |
*
|
159 |
* Revision 1.12 2006/10/02 09:17:48 jorpiell
|
160 |
* A?adido el setCRS a la capa
|
161 |
*
|
162 |
* Revision 1.11 2006/09/29 13:02:38 ppiqueras
|
163 |
* Filtro para WFS. De momento s?lo interfaz gr?fica.
|
164 |
*
|
165 |
* Revision 1.10 2006/07/21 11:50:31 jaume
|
166 |
* improved appearance
|
167 |
*
|
168 |
* Revision 1.9 2006/06/21 12:35:45 jorpiell
|
169 |
* Se ha a?adido la ventana de propiedades. Esto implica a?adir listeners por todos los paneles. Adem?s no se muestra la geomatr?a en la lista de atributos y se muestran ?nicamnete los que se van a descargar
|
170 |
*
|
171 |
* Revision 1.8 2006/06/15 07:50:58 jorpiell
|
172 |
* A?adida la funcionalidad de reproyectar y hechos algunos cambios en la interfaz
|
173 |
*
|
174 |
* Revision 1.7 2006/05/25 16:22:47 jorpiell
|
175 |
* Se limpia el panel cada vez que se conecta con un servidor distinto
|
176 |
*
|
177 |
* Revision 1.6 2006/05/25 16:01:43 jorpiell
|
178 |
* Se ha a?adido la funcionalidad para eliminar el namespace de los tipos de atributos
|
179 |
*
|
180 |
* Revision 1.5 2006/05/25 10:31:06 jorpiell
|
181 |
* Como ha cambiado la forma de mostrar las capas (una tabla, en lugar de una lista), los paneles han tenido que ser modificados
|
182 |
*
|
183 |
* Revision 1.4 2006/05/23 08:09:39 jorpiell
|
184 |
* 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
|
185 |
*
|
186 |
* Revision 1.3 2006/05/19 12:57:08 jorpiell
|
187 |
* Modificados algunos paneles
|
188 |
*
|
189 |
* Revision 1.2 2006/04/20 16:38:24 jorpiell
|
190 |
* 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().
|
191 |
*
|
192 |
* Revision 1.1 2006/04/19 12:50:16 jorpiell
|
193 |
* Primer commit de la aplicaci?n. Se puede hacer un getCapabilities y ver el mensaje de vienvenida del servidor
|
194 |
*
|
195 |
*
|
196 |
*/
|
197 |
/**
|
198 |
* A JPanel with a JTabbedPane with JPanels for WFS
|
199 |
*
|
200 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
201 |
* @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
|
202 |
*/
|
203 |
public class WFSParamsPanel extends WizardPanel{ |
204 |
private JTabbedPane jTabbedPane = null; // @jve:decl-index=0:visual-constraint="37,30" |
205 |
private WFSSelectFeaturePanel featurePanel = null; |
206 |
private WFSSelectFieldsPanel fieldsPanel = null; |
207 |
private WFSOptionsPanel optionsPanel = null; |
208 |
private WFSFormatPanel formatPanel = null; |
209 |
private WFSFilterPanel filterPanel = null; |
210 |
private WFSAreaPanel areaPanel = null; |
211 |
private WFSWizardData data;
|
212 |
private WizardListenerSupport listenerSupport;
|
213 |
public static Preferences fPrefs = Preferences.userRoot().node( "gvsig.wcs-wizard" ); |
214 |
private WFSInfoPanel infoPanel;
|
215 |
private int indFields; |
216 |
private int indFilter; |
217 |
private int indArea; |
218 |
|
219 |
/**
|
220 |
* This method initializes jTabbedPane
|
221 |
*
|
222 |
* @return javax.swing.JTabbedPane
|
223 |
*/
|
224 |
|
225 |
public WFSParamsPanel(){
|
226 |
super();
|
227 |
initialize(); |
228 |
} |
229 |
/**
|
230 |
* Returns the tab amount that the WFSParamsPanel currently have
|
231 |
*
|
232 |
* Devuelve el n?mero de solapas que tiene actualmente el WFSParamsPanel
|
233 |
*
|
234 |
* @return int
|
235 |
*/
|
236 |
public int getNumTabs(){ |
237 |
return getJTabbedPane().getTabCount();
|
238 |
} |
239 |
|
240 |
private void initialize() { |
241 |
this.setLayout(null); |
242 |
this.setVisible(false); |
243 |
this.setBounds(0, 0, 510, 427); |
244 |
this.add(getJTabbedPane(), null); |
245 |
} |
246 |
|
247 |
/**
|
248 |
* Sets the focus to the tab next to the current one.
|
249 |
*
|
250 |
* Enfoca a la solapa siguiente a la actualmente enfocada del TabbedPane
|
251 |
*
|
252 |
*/
|
253 |
public void avanzaTab(){ |
254 |
int currentPage = currentPage();
|
255 |
int nPages = getNumTabs();
|
256 |
if (nPages -1 > currentPage){ |
257 |
getJTabbedPane().setSelectedIndex(nextPageEnabled()); |
258 |
} |
259 |
} |
260 |
|
261 |
/**
|
262 |
* Sets the focus to the tab previous to the current one.
|
263 |
*
|
264 |
* Enfoca a la solapa anterior a la actualmente enfocada del TabbedPane
|
265 |
*
|
266 |
*/
|
267 |
public void retrocedeTab(){ |
268 |
this.getJTabbedPane().setSelectedIndex(previousEnabledPage());
|
269 |
} |
270 |
|
271 |
/**
|
272 |
* Returns the current tab index.
|
273 |
*
|
274 |
* Devuelve el n?mero de solapa en que se encuentra
|
275 |
*
|
276 |
* @return
|
277 |
*/
|
278 |
public int getIndiceSolapaActual(){ |
279 |
return this.getJTabbedPane().getSelectedIndex(); |
280 |
} |
281 |
|
282 |
public JTabbedPane getJTabbedPane() { |
283 |
if (jTabbedPane == null) { |
284 |
jTabbedPane = new JTabbedPane(); |
285 |
jTabbedPane.setBounds(4, 4, 502, 415); |
286 |
jTabbedPane.addTab(PluginServices.getText(this, "info"), null, getInfoPanel()); |
287 |
jTabbedPane.addTab(PluginServices.getText(this, "feature"), null, getFeaturesPanel(), null); |
288 |
jTabbedPane.addTab(PluginServices.getText(this, "fields_uppercase_first"),null, getFieldsPanel(), null); |
289 |
indFields = jTabbedPane.getTabCount() - 1;
|
290 |
jTabbedPane.setEnabledAt(indFields, false);
|
291 |
//jTabbedPane.addTab(PluginServices.getText(this,"formatos"),null,getFormatPanel(),null);
|
292 |
// indFormat = jTabbedPane.getTabCount() - 1;
|
293 |
// jTabbedPane.setEnabledAt(indFormat, false);
|
294 |
jTabbedPane.addTab(PluginServices.getText(this, "options"),null, getOptionsPanel(), null); |
295 |
jTabbedPane.addTab(PluginServices.getText(this, "filter"),null, getFilterPanel(), null); |
296 |
indFilter = jTabbedPane.getTabCount() - 1;
|
297 |
jTabbedPane.setEnabledAt(indFilter, false);
|
298 |
jTabbedPane.addTab(PluginServices.getText(this, "area"),null, getAreaPanel(), null); |
299 |
indArea = jTabbedPane.getTabCount() - 1;
|
300 |
jTabbedPane.setEnabledAt(indArea, false);
|
301 |
} |
302 |
return jTabbedPane;
|
303 |
} |
304 |
|
305 |
private WFSInfoPanel getInfoPanel() {
|
306 |
if (infoPanel==null) { |
307 |
infoPanel = new WFSInfoPanel();
|
308 |
infoPanel.addFocusListener(new FocusListener() { |
309 |
public void focusGained(java.awt.event.FocusEvent e) { |
310 |
refreshInfo(); |
311 |
} |
312 |
|
313 |
private void refreshInfo() { |
314 |
WFSLayerNode selectedNode = featurePanel.getSelectedFeature(); |
315 |
if (selectedNode != null){ |
316 |
selectedNode.setSelectedFields(fieldsPanel.getSelectedFields()); |
317 |
} |
318 |
data.setUserName(optionsPanel.getUserName()); |
319 |
data.setBuffer(optionsPanel.getBuffer()); |
320 |
data.setTimeOut(optionsPanel.getTimeout()); |
321 |
infoPanel.refresh(data, selectedNode); |
322 |
} |
323 |
|
324 |
public void focusLost(FocusEvent e) { |
325 |
|
326 |
} |
327 |
}); |
328 |
} |
329 |
return infoPanel;
|
330 |
} |
331 |
|
332 |
/**
|
333 |
*
|
334 |
* @return the selected list
|
335 |
*/
|
336 |
private Object getSelectedFeature() { |
337 |
return featurePanel.getSelectedFeature();
|
338 |
} |
339 |
|
340 |
|
341 |
/**
|
342 |
* This method initializes panelFeatures
|
343 |
*
|
344 |
* @return javax.swing.JPanel
|
345 |
*/
|
346 |
private WFSSelectFeaturePanel getFeaturesPanel() {
|
347 |
if (featurePanel == null) { |
348 |
featurePanel = new WFSSelectFeaturePanel(this); |
349 |
featurePanel.setLayout(null);
|
350 |
} |
351 |
return featurePanel;
|
352 |
} |
353 |
|
354 |
/**
|
355 |
* This method initializes fieldsPanel
|
356 |
*
|
357 |
* @return javax.swing.JPanel
|
358 |
*/
|
359 |
private WFSSelectFieldsPanel getFieldsPanel(){
|
360 |
if (fieldsPanel == null) { |
361 |
fieldsPanel = new WFSSelectFieldsPanel(this); |
362 |
fieldsPanel.setLayout(null);
|
363 |
} |
364 |
return fieldsPanel;
|
365 |
} |
366 |
|
367 |
|
368 |
|
369 |
/**
|
370 |
* This method initializes fieldsPanel
|
371 |
*
|
372 |
* @return javax.swing.JPanel
|
373 |
*/
|
374 |
private WFSOptionsPanel getOptionsPanel(){
|
375 |
if (optionsPanel == null) { |
376 |
optionsPanel = new WFSOptionsPanel(this); |
377 |
optionsPanel.setLayout(null);
|
378 |
} |
379 |
return optionsPanel;
|
380 |
} |
381 |
|
382 |
|
383 |
/**
|
384 |
* This method initializes filterPanel
|
385 |
*
|
386 |
* @return javax.swing.JPanel
|
387 |
*/
|
388 |
private WFSFilterPanel getFilterPanel(){
|
389 |
if (filterPanel == null) { |
390 |
filterPanel = new WFSFilterPanel(this); |
391 |
filterPanel.setVisible(true);
|
392 |
//filterPanel.setLayout(null);
|
393 |
} |
394 |
return filterPanel;
|
395 |
} |
396 |
|
397 |
/**
|
398 |
* This method initializes areaPanel
|
399 |
*
|
400 |
* @return javax.swing.JPanel
|
401 |
*/
|
402 |
private WFSAreaPanel getAreaPanel(){
|
403 |
if (areaPanel == null) { |
404 |
areaPanel = new WFSAreaPanel(this); |
405 |
areaPanel.setVisible(true);
|
406 |
} |
407 |
return areaPanel;
|
408 |
} |
409 |
|
410 |
/**
|
411 |
* This method initializes formatPanel
|
412 |
*
|
413 |
* @return javax.swing.JPanel
|
414 |
*/
|
415 |
private WFSFormatPanel getFormatPanel(){
|
416 |
if (formatPanel == null) { |
417 |
formatPanel = new WFSFormatPanel();
|
418 |
formatPanel.setLayout(null);
|
419 |
} |
420 |
return formatPanel;
|
421 |
} |
422 |
|
423 |
/**
|
424 |
* Verifies that the selected parameters are enough to request the coverage
|
425 |
* to the server.
|
426 |
*
|
427 |
* Comprueba que los par?metros seleccionados son suficientes para pedir la
|
428 |
* cobertura al servidor.
|
429 |
*
|
430 |
* @return boolean
|
431 |
*/
|
432 |
public boolean isCorretlyConfigured() { |
433 |
if ((featurePanel.getSelectedFeature() != null) && (fieldsPanel.getSelectedFields().length > 0)) { |
434 |
return true; |
435 |
}else{
|
436 |
return false; |
437 |
} |
438 |
} |
439 |
|
440 |
/**
|
441 |
* Cleans up the wizard's components but the server's layers list.
|
442 |
*
|
443 |
* Limpia todos los componentes del wizard excepto la lista de capas del
|
444 |
* servidor.
|
445 |
*/
|
446 |
public void cleanupWizard() { |
447 |
jTabbedPane.setEnabledAt(indFields,false);
|
448 |
// jTabbedPane.setEnabledAt(indFormat,false);
|
449 |
} |
450 |
|
451 |
/**
|
452 |
* Refreshes the wizard components data each time a feature
|
453 |
* is selected.
|
454 |
*
|
455 |
* Actualiza los datos de los componentes del wizard cada vez
|
456 |
* que se selecciona una feature diferente.
|
457 |
*
|
458 |
* @param feature
|
459 |
* Selected feature
|
460 |
*/
|
461 |
public void refreshData(WFSLayerNode feature){ |
462 |
boolean refreshed = false; |
463 |
|
464 |
if (feature != null){ |
465 |
feature = (WFSLayerNode)data.getFeatureInfo(feature.getName(), feature.getNameSpace()); |
466 |
|
467 |
// If there is no fields -> disable not necessary tabs
|
468 |
if (feature.getFields().size() == 0) { |
469 |
jTabbedPane.setEnabledAt(indFields, false);
|
470 |
jTabbedPane.setEnabledAt(indFilter, false);
|
471 |
jTabbedPane.setEnabledAt(indArea, false);
|
472 |
isApplicable(false);
|
473 |
|
474 |
return;
|
475 |
} |
476 |
|
477 |
refreshed = filterPanel.refresh(feature); |
478 |
|
479 |
if (refreshed) {
|
480 |
jTabbedPane.setEnabledAt(indFields, true);
|
481 |
jTabbedPane.setEnabledAt(indFilter, true);
|
482 |
jTabbedPane.setEnabledAt(indArea, true);
|
483 |
fieldsPanel.refresh(feature); |
484 |
optionsPanel.refresh(feature); |
485 |
} |
486 |
else {
|
487 |
featurePanel.unselectAllFeatures(); |
488 |
} |
489 |
} |
490 |
|
491 |
if (refreshed)
|
492 |
listenerSupport.callStateChanged(isCorretlyConfigured()); |
493 |
} |
494 |
|
495 |
public void refreshInfo(WFSLayerNode feature){ |
496 |
infoPanel.refresh(data,feature); |
497 |
} |
498 |
|
499 |
/**
|
500 |
* Sets the object that holds the wizard data.
|
501 |
*
|
502 |
* Establece el objeto que contiene los datos del wizard.
|
503 |
*
|
504 |
* @param data
|
505 |
*/
|
506 |
public void setWizardData(WFSWizardData data) { |
507 |
this.data = data;
|
508 |
//WFSLayerNode selectedNode = (WFSLayerNode)featurePanel.getSelectedFeature();
|
509 |
featurePanel.setWizardData(data); |
510 |
data.setBuffer(optionsPanel.getBuffer()); |
511 |
data.setTimeOut(optionsPanel.getTimeout()); |
512 |
infoPanel.refresh(data,null);
|
513 |
} |
514 |
|
515 |
/**
|
516 |
* Sets the wizard's data source
|
517 |
*
|
518 |
* Establece el origen de los datos del wizard
|
519 |
* @param dataSource
|
520 |
*/
|
521 |
public void setDataSource(WFSWizardData dataSource) { |
522 |
this.data = dataSource;
|
523 |
|
524 |
} |
525 |
|
526 |
|
527 |
/**
|
528 |
* Returns the next enabled tab's index.
|
529 |
*
|
530 |
* Devuelve el ?ndicie de la siguiente pesta?a habilitada del wizard o -1 si no hay
|
531 |
* ninguna.
|
532 |
*
|
533 |
* @return The index or -1 if there is no one.
|
534 |
*/
|
535 |
public int nextPageEnabled() { |
536 |
int currentPage = currentPage();
|
537 |
int nPages = getNumTabs();
|
538 |
if (currentPage == nPages)
|
539 |
return -1; |
540 |
for (int i=currentPage+1; i<nPages; i++){ |
541 |
if (getJTabbedPane().isEnabledAt(i)){
|
542 |
return i;
|
543 |
} |
544 |
} |
545 |
return -1; |
546 |
} |
547 |
|
548 |
/**
|
549 |
* Returns the index of the current tab.
|
550 |
*
|
551 |
* Devuelve el ?ndice de la p?gina actual del wizard.
|
552 |
*
|
553 |
* @return
|
554 |
*/
|
555 |
public int currentPage() { |
556 |
return getJTabbedPane().getSelectedIndex();
|
557 |
} |
558 |
|
559 |
/**
|
560 |
* Returns the index of the previous enabled tab.
|
561 |
*
|
562 |
* Devuelve el ?ndice de la anterior p?gina habilitada del wizard o -1 si no hay
|
563 |
* ninguna.
|
564 |
*
|
565 |
* @return The index, or -1 if there is no one.
|
566 |
*/
|
567 |
public int previousEnabledPage() { |
568 |
int currentPage = currentPage();
|
569 |
int j=0; |
570 |
if (currentPage == 0) |
571 |
j= -1;
|
572 |
for (int i = currentPage-1; i>-1; i--){ |
573 |
if (getJTabbedPane().isEnabledAt(i)){
|
574 |
j= i; |
575 |
break;
|
576 |
} |
577 |
} |
578 |
return j;
|
579 |
} |
580 |
|
581 |
public FMapWFSDriver getDriver() {
|
582 |
return data.getDriver();
|
583 |
} |
584 |
|
585 |
public void setListenerSupport(WizardListenerSupport support) { |
586 |
listenerSupport = support; |
587 |
} |
588 |
|
589 |
|
590 |
/*
|
591 |
* (non-Javadoc)
|
592 |
* @see com.iver.cit.gvsig.gui.WizardPanel#initWizard()
|
593 |
*/
|
594 |
public void initWizard() { |
595 |
|
596 |
} |
597 |
|
598 |
/*
|
599 |
* (non-Javadoc)
|
600 |
* @see com.iver.cit.gvsig.gui.WizardPanel#execute()
|
601 |
*/
|
602 |
public void execute() { |
603 |
|
604 |
} |
605 |
|
606 |
/*
|
607 |
* (non-Javadoc)
|
608 |
* @see com.iver.cit.gvsig.gui.ILayerPanel#getLayer()
|
609 |
*/
|
610 |
public FLayer getLayer() {
|
611 |
FLyrWFS layer = new FLyrWFS();
|
612 |
layer.setName(getFeaturesPanel().getLayerText()); |
613 |
layer.setLayerName(getFeaturesPanel().getLayerName()); |
614 |
layer.setWfsLayerNode(getLayerNode()); |
615 |
layer.setFields(getFieldsPanel().getSelectedFields()); |
616 |
layer.setUserName(getOptionsPanel().getUserName()); |
617 |
layer.setPassword(getOptionsPanel().getPassword()); |
618 |
layer.setNumfeatures(getOptionsPanel().getBuffer()); |
619 |
layer.setTimeout(getOptionsPanel().getTimeout()); |
620 |
layer.setSrs(getOptionsPanel().getSRS()); |
621 |
|
622 |
// Sets the area (bounding box) filter
|
623 |
Rectangle2D bbox = getAreaPanel().getExtent();
|
624 |
|
625 |
if (getAreaPanel().hasUserDefinedAnArea()) {
|
626 |
// If user has written some invalid data in the coordinates text fields of the area tab
|
627 |
if ((bbox == null) && (getAreaPanel().areThereSomeCoordinatesWritten())) { |
628 |
// Notify to user that no filter area will be applied
|
629 |
JOptionPane.showMessageDialog(null, PluginServices.getText(null, "no_filter_area_will_be_applied_in_the_load_of_the_layer"), PluginServices.getText(null, "warning"), JOptionPane.WARNING_MESSAGE); |
630 |
} |
631 |
} |
632 |
|
633 |
layer.setBbox(bbox); |
634 |
String BboxPropertyName = getFieldsPanel().getGeometryFieldName();
|
635 |
|
636 |
layer.setBboxPropertyName(BboxPropertyName); |
637 |
|
638 |
// Set the filter subconsultation that layer is
|
639 |
layer.setFieldsQuery(getLayerNode().getFilter()); |
640 |
layer.setVisualFilterQuery(getFilterPanel().getFilterExpressionFromInterface()); |
641 |
layer.setWfsDriver(data.getDriver()); |
642 |
return layer;
|
643 |
} |
644 |
|
645 |
/**
|
646 |
* Returns true if there is a field of geometry type selected in this layer
|
647 |
*
|
648 |
* @return A boolean value
|
649 |
*/
|
650 |
public boolean isThereAGeometryFieldSelected() { |
651 |
return (getFieldsPanel().getSelectedFields().length > 0); |
652 |
} |
653 |
|
654 |
/**
|
655 |
*
|
656 |
* @return
|
657 |
*/
|
658 |
private WFSLayerNode getLayerNode(){
|
659 |
WFSLayerNode layerNode = getFeaturesPanel().getWFSLayerNode(); |
660 |
layerNode.setSelectedFields(getFieldsPanel().getSelectedFields()); |
661 |
|
662 |
// If the query is incorrect -> no query (no filter)
|
663 |
String query = getFilterPanel().getQuery();
|
664 |
if (query == null) { |
665 |
layerNode.setFilter("");
|
666 |
|
667 |
// Removes filter expression from the JTextArea
|
668 |
getFilterPanel().removeFilterExpression(); |
669 |
|
670 |
// Notify to user that no filter will be applied
|
671 |
JOptionPane.showMessageDialog(null, PluginServices.getText(null, "no_filter_will_be_applied_in_the_load_of_the_layer"), PluginServices.getText(null, "warning"), JOptionPane.WARNING_MESSAGE); |
672 |
} |
673 |
else {
|
674 |
layerNode.setFilter(query); |
675 |
} |
676 |
|
677 |
return layerNode;
|
678 |
} |
679 |
|
680 |
public void setSelectedFeature(WFSLayerNode layerNode){ |
681 |
getFeaturesPanel().setSelectedFeature(layerNode); |
682 |
getFieldsPanel().setSelectedFields(layerNode); |
683 |
// getFilterPanel().setFilterExpressionIntoInterface(layerNode.getFilter());
|
684 |
} |
685 |
|
686 |
|
687 |
/**
|
688 |
* @return Returns the data.
|
689 |
*/
|
690 |
public WFSWizardData getData() {
|
691 |
return data;
|
692 |
} |
693 |
public void setLayerName(String name) { |
694 |
getFeaturesPanel().setLayerName(name); |
695 |
|
696 |
} |
697 |
|
698 |
public void addWizardListener(WizardListener listener) { |
699 |
listenerSupport.addWizardListener(listener); |
700 |
} |
701 |
|
702 |
public void isApplicable(boolean applicable){ |
703 |
listenerSupport.callStateChanged(applicable); |
704 |
} |
705 |
|
706 |
|
707 |
public void setStatus(WFSStatus status) { |
708 |
getOptionsPanel().setStatus(status); |
709 |
getFilterPanel().setFilterExpressionIntoInterface(status.getFilterVisualText()); |
710 |
} |
711 |
|
712 |
/**
|
713 |
* Updates the filter fields values with the new values
|
714 |
*/
|
715 |
public void updateWFSFilterFieldValues() { |
716 |
this.getFilterPanel().updateFieldValues();
|
717 |
} |
718 |
|
719 |
/**
|
720 |
* @see WFSFilterPanel#setWFSFilterPanelIsAsTabForWFSLayersLoad(boolean)
|
721 |
*/
|
722 |
public void setWFSFilterPanelIsAsTabForWFSLayersLoad(boolean b) { |
723 |
this.getFilterPanel().setWFSFilterPanelIsAsTabForWFSLayersLoad(b);
|
724 |
} |
725 |
|
726 |
/**
|
727 |
* @see WFSFilterPanel#getWFSFilterPanelIsAsTabForWFSLayersLoad()
|
728 |
*/
|
729 |
public boolean getWFSFilterPanelIsAsTabForWFSLayersLoad() { |
730 |
return this.getFilterPanel().getWFSFilterPanelIsAsTabForWFSLayersLoad(); |
731 |
} |
732 |
|
733 |
/**
|
734 |
* @see WFSSelectFieldsPanel#getFieldsSelectedOfSameLayerHasChanged()
|
735 |
*/
|
736 |
public boolean getFieldsSelectedOfSameLayerHasChanged() { |
737 |
return this.getFieldsPanel().getFieldsSelectedOfSameLayerHasChanged(); |
738 |
} |
739 |
|
740 |
/**
|
741 |
* @see WFSSelectFieldsPanel#resetFieldsSelectedOfSameLayerHasChanged()
|
742 |
*/
|
743 |
public void resetFieldsSelectedOfSameLayerHasChanged() { |
744 |
this.getFieldsPanel().resetFieldsSelectedOfSameLayerHasChanged();
|
745 |
} |
746 |
|
747 |
/**
|
748 |
* @see WFSWizard#doClickOnNextButton()
|
749 |
*/
|
750 |
public void doClickOnNextButton() { |
751 |
Object obj = this.getParent(); |
752 |
|
753 |
// When we start to connect to a server -> the interface is the dialog WFSWizard
|
754 |
if (obj instanceof WFSWizard) |
755 |
((WFSWizard)this.getParent()).doClickOnNextButton();
|
756 |
else {
|
757 |
// When we are modifying a loaded layer -> the interface is the dialog WFSPropsDialog
|
758 |
if (obj instanceof WFSPropsDialog) |
759 |
this.advanceCurrentTab();
|
760 |
} |
761 |
} |
762 |
|
763 |
/**
|
764 |
* Selects the next tab
|
765 |
*/
|
766 |
public void advanceCurrentTab() { |
767 |
int currentTabIndex = this.getJTabbedPane().getSelectedIndex(); |
768 |
|
769 |
// Ensure we can select next tab
|
770 |
if ((currentTabIndex != -1) && (currentTabIndex < (this.getJTabbedPane().getTabCount() -1))) |
771 |
this.getJTabbedPane().setSelectedIndex(currentTabIndex + 1); |
772 |
} |
773 |
|
774 |
/**
|
775 |
* @see WFSFilterPanel#getAllFieldsAndValuesKnownOfCurrentLayer(Map)
|
776 |
*/
|
777 |
public Map getAllFieldsAndValuesKnownOfCurrentLayer() { |
778 |
return this.getFilterPanel().getAllFieldsAndValuesKnownOfCurrentLayer(); |
779 |
} |
780 |
|
781 |
/**
|
782 |
* @see WFSFilterPanel#setAllFieldsAndValuesKnownOfCurrentLayer(Map)
|
783 |
*/
|
784 |
public void setAllFieldsAndValuesKnownOfCurrentLayer(Map allFieldsAndValuesKnownOfCurrentLayer) { |
785 |
this.getFilterPanel().setAllFieldsAndValuesKnownOfCurrentLayer(allFieldsAndValuesKnownOfCurrentLayer);
|
786 |
} |
787 |
|
788 |
/**
|
789 |
* @see WFSFilterPanel#getQuery()
|
790 |
*/
|
791 |
public String getFilterQuery() { |
792 |
return this.getFilterPanel().getQuery(); |
793 |
} |
794 |
|
795 |
/**
|
796 |
* @see WFSAreaPanel#setUserHasntDefineAnArea()
|
797 |
*/
|
798 |
public void setUserHasntDefinedAnArea() { |
799 |
this.getAreaPanel().setUserHasntDefineAnArea();
|
800 |
} |
801 |
|
802 |
/**
|
803 |
* @see WFSAreaPanel#updateWFSArea()
|
804 |
*/
|
805 |
public void updateWFSArea() { |
806 |
this.getAreaPanel().updateWFSArea();
|
807 |
} |
808 |
} |