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