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