Statistics
| Revision:

root / trunk / extensions / extWFS2 / src / com / iver / cit / gvsig / gui / dialogs / WFSPropsDialog.java @ 13881

History | View | Annotate | Download (20.4 KB)

1
package com.iver.cit.gvsig.gui.dialogs;
2

    
3
import java.awt.Component;
4
import java.awt.event.ActionEvent;
5
import java.awt.event.ActionListener;
6
import java.net.MalformedURLException;
7
import java.net.URL;
8
import java.util.HashMap;
9

    
10
import javax.swing.JButton;
11
import javax.swing.JOptionPane;
12
import javax.swing.JPanel;
13

    
14
import org.gvsig.remoteClient.wfs.WFSStatus;
15

    
16
import com.iver.andami.PluginServices;
17
import com.iver.andami.ui.mdiManager.IWindow;
18
import com.iver.andami.ui.mdiManager.WindowInfo;
19
import com.iver.cit.gvsig.exceptions.layers.ConnectionErrorLayerException;
20
import com.iver.cit.gvsig.exceptions.layers.DriverLayerException;
21
import com.iver.cit.gvsig.exceptions.layers.LegendLayerException;
22
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException;
23
import com.iver.cit.gvsig.exceptions.layers.NameLayerException;
24
import com.iver.cit.gvsig.exceptions.layers.ProjectionLayerException;
25
import com.iver.cit.gvsig.exceptions.layers.TypeLayerException;
26
import com.iver.cit.gvsig.exceptions.layers.URLLayerException;
27
import com.iver.cit.gvsig.exceptions.layers.UnsupportedVersionLayerException;
28
import com.iver.cit.gvsig.exceptions.layers.XMLLayerException;
29
import com.iver.cit.gvsig.fmap.MapControl;
30
import com.iver.cit.gvsig.fmap.drivers.WFSLayerException;
31
import com.iver.cit.gvsig.fmap.drivers.wfs.FMapWFSDriver;
32
import com.iver.cit.gvsig.fmap.layers.FLayer;
33
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
34
import com.iver.cit.gvsig.fmap.layers.FLyrWFS;
35
import com.iver.cit.gvsig.fmap.layers.FLyrWFSFactory;
36
import com.iver.cit.gvsig.fmap.layers.WFSLayerNode;
37
import com.iver.cit.gvsig.fmap.rendering.IVectorLegend;
38
import com.iver.cit.gvsig.gui.panels.WFSAreaPanel;
39
import com.iver.cit.gvsig.gui.panels.WFSFilterPanel;
40
import com.iver.cit.gvsig.gui.panels.WFSParamsPanel;
41
import com.iver.cit.gvsig.gui.wizards.WFSWizardData;
42
import com.iver.cit.gvsig.gui.wizards.WizardListener;
43
import com.iver.cit.gvsig.gui.wizards.WizardListenerSupport;
44
import com.iver.cit.gvsig.project.documents.layout.gui.Layout;
45
import com.iver.cit.gvsig.project.documents.view.gui.BaseView;
46

    
47
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
48
 *
49
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
50
 *
51
 * This program is free software; you can redistribute it and/or
52
 * modify it under the terms of the GNU General Public License
53
 * as published by the Free Software Foundation; either version 2
54
 * of the License, or (at your option) any later version.
55
 *
56
 * This program is distributed in the hope that it will be useful,
57
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
58
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
59
 * GNU General Public License for more details.
60
 *
61
 * You should have received a copy of the GNU General Public License
62
 * along with this program; if not, write to the Free Software
63
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
64
 *
65
 * For more information, contact:
66
 *
67
 *  Generalitat Valenciana
68
 *   Conselleria d'Infraestructures i Transport
69
 *   Av. Blasco Ib??ez, 50
70
 *   46010 VALENCIA
71
 *   SPAIN
72
 *
73
 *      +34 963862235
74
 *   gvsig@gva.es
75
 *      www.gvsig.gva.es
76
 *
77
 *    or
78
 *
79
 *   IVER T.I. S.A
80
 *   Salamanca 50
81
 *   46005 Valencia
82
 *   Spain
83
 *
84
 *   +34 963163400
85
 *   dac@iver.es
86
 */
87
/* CVS MESSAGES:
88
 *
89
 * $Id: WFSPropsDialog.java 13881 2007-09-19 16:22:04Z jaume $
90
 * $Log$
91
 * Revision 1.40  2007-09-19 16:14:50  jaume
92
 * removed unnecessary imports
93
 *
94
 * Revision 1.39  2007/06/26 09:33:54  jorpiell
95
 * Information tab refreshed
96
 *
97
 * Revision 1.38  2007/05/28 07:00:05  jcampos
98
 * Fixed changes to 3D extension
99
 *
100
 * Revision 1.37  2007/05/10 10:33:43  jaume
101
 * Refactored legend interface names
102
 *
103
 * Revision 1.36  2007/04/11 11:55:47  ppiqueras
104
 * Corregido bug: actualizaci?n de ?rea visual despues de pulsar "Aplicar"
105
 *
106
 * Revision 1.35  2007/03/15 13:32:22  ppiqueras
107
 * Corregido bug de excepci?n que se lanzaba cuando se filtraba y no se pod?a cargar la capa.
108
 *
109
 * Revision 1.34  2007/03/06 16:55:54  caballero
110
 * Exceptions
111
 *
112
 * Revision 1.33  2007/03/01 13:11:27  ppiqueras
113
 * Cambios menores.
114
 *
115
 * Revision 1.32  2007/02/22 12:24:19  ppiqueras
116
 * Eliminadas l?neas que sobraban.
117
 *
118
 * Revision 1.31  2007/02/20 11:31:11  ppiqueras
119
 * Eliminados comentarios que sobraban.
120
 *
121
 * Revision 1.30  2007/02/16 13:36:53  ppiqueras
122
 * Que el ?rea seleccionada en el panel WFSArea sea accesible una vez se va a aplicar.
123
 *
124
 * Revision 1.29  2007/02/12 11:36:43  ppiqueras
125
 * A?adidos comentarios y m?todo para refrescar el MapControl de la pesta?a del ?rea.
126
 *
127
 * Revision 1.28  2007/02/02 12:35:29  ppiqueras
128
 * Mejora de la eficiencia y robustez del c?digo para alg?n m?todo.
129
 *
130
 * Revision 1.27  2007/01/18 12:38:35  jorpiell
131
 * el fullRefresh ha cambiado del mapcontext al mapcontrol
132
 *
133
 * Revision 1.26  2006/12/29 12:29:50  ppiqueras
134
 * Eliminados comentarios que sobraban.
135
 *
136
 * Revision 1.25  2006/12/29 12:28:29  ppiqueras
137
 * El anterior commit: refactorizaci?n unos m?todos.
138
 * El commit actual: eliminado c?digo comentado que sobraba.
139
 *
140
 * Revision 1.24  2006/12/29 09:24:50  ppiqueras
141
 * Cambios sin importancia.
142
 *
143
 * Revision 1.23  2006/12/26 10:26:03  ppiqueras
144
 * Corregida dependencia con Layer de appgvsig
145
 *
146
 * Revision 1.22  2006/12/26 09:26:51  ppiqueras
147
 * 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).
148
 *
149
 * Revision 1.20  2006/12/20 14:21:22  ppiqueras
150
 * Corregido bug que no actualice vista si el filtro no es correcto
151
 *
152
 * Revision 1.19  2006/12/19 08:27:29  jorpiell
153
 * Problem decreasing the selected attributes number solved
154
 *
155
 * Revision 1.18  2006/12/18 08:48:38  jorpiell
156
 * The props panel uses the same layer driver insteaf of create a nes driver each time
157
 *
158
 * Revision 1.17  2006/12/15 13:57:08  ppiqueras
159
 * Permite que se almacenen y/o recojan todos los campos y valores conocidos de la capa actual.
160
 *
161
 * Adem?s, control frentre a consultas de filtro err?neas, (esto a medias a?n).
162
 *
163
 * Revision 1.16  2006/12/13 14:00:24  ppiqueras
164
 * A?adido un comentario a una l?nea de instrucciones
165
 *
166
 * Revision 1.15  2006/12/04 08:59:47  ppiqueras
167
 * Algunos bugs corregidos. A cambio hay 2 bugs relacionados que todav?a no han sido corregidos (ver PHPCollab) (los tiene asignados Jorge).
168
 *
169
 * Revision 1.14  2006/11/28 08:05:31  jorpiell
170
 * Se refrescan los mapas despu?s de aplicar un filtro
171
 *
172
 * Revision 1.13  2006/11/16 16:57:49  jorpiell
173
 * Se copia la laeyenda de la capa anterior antes de eliminarla
174
 *
175
 * Revision 1.12  2006/11/14 13:45:49  ppiqueras
176
 * A?adida peque?a funcionalidad:
177
 * 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.
178
 *
179
 * Revision 1.11  2006/10/31 09:40:49  jorpiell
180
 * Se ha creado una factoria para crear la capa. De ese modo no se repite c?digo desde le panel de propiedades y desde el panel de la capa
181
 *
182
 * Revision 1.9  2006/10/23 08:47:12  jorpiell
183
 * Refactorizado un m?todo
184
 *
185
 * Revision 1.8  2006/10/23 08:29:06  ppiqueras
186
 * Algunos cambios
187
 *
188
 * Revision 1.6  2006/10/02 09:09:45  jorpiell
189
 * Cambios del 10 copiados al head
190
 *
191
 * Revision 1.4.2.3  2006/09/27 11:12:15  jorpiell
192
 * Hay que comprobar que se han devuelto un n?mero de features menor que el n?mero m?ximo permitido
193
 *
194
 * Revision 1.4.2.2  2006/09/27 09:15:01  jorpiell
195
 * Ya no se hace otra petici?n al pulsar sobre el bot?n aceptar.
196
 *
197
 * Revision 1.4.2.1  2006/09/19 12:28:11  jorpiell
198
 * Ya no se depende de geotools
199
 *
200
 *
201
 * Revision 1.4  2006/08/30 07:42:29  jorpiell
202
 * Se le asigna a la capa creada una proyecci?n concreta. Si esto no se hace, al exportar a postigis se produce un error.
203
 *
204
 * Revision 1.3  2006/08/29 07:56:12  cesar
205
 * Rename the *View* family of classes to *Window* (ie: SingletonView to SingletonWindow, ViewInfo to WindowInfo, etc)
206
 *
207
 * Revision 1.2  2006/08/29 07:13:40  cesar
208
 * Rename class com.iver.andami.ui.mdiManager.View to com.iver.andami.ui.mdiManager.IWindow
209
 *
210
 * Revision 1.1  2006/06/21 12:35:45  jorpiell
211
 * 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
212
 *
213
 *
214
 */
215
/**
216
 * Panel with tabs for change properties of a WFS layer
217
 * 
218
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
219
 * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
220
 */
221
public class WFSPropsDialog extends JPanel implements IWindow {
222
        private WFSParamsPanel wfsParamsTabbedPane = null;
223
        private WindowInfo m_ViewInfo = null;
224
        private FLayer fLayer = null;
225
        private JButton btnApply = null;
226
        private JButton btnOk = null;
227
        private JButton btnCancel = null;
228
        private CommandListener m_actionListener = null;
229
        private JPanel buttonsPanel = null;
230
        boolean applied = false;
231

    
232

    
233
        
234
        /**
235
         * Default constructor with a Layer as parameter
236
         * 
237
         * @param layer A layer
238
         */
239
    public WFSPropsDialog(FLayer layer) {
240
                super();
241
                initialize(layer);
242
        }
243

    
244
    /**
245
     * Initializes this component
246
     * 
247
     * @param layer A layer
248
     */
249
    private void initialize(FLayer layer) {
250
                setLayout(null);
251
        setFLayer(layer);
252
        wfsParamsTabbedPane = getParamsPanel(((FLyrWFS) layer).getProperties());
253
        wfsParamsTabbedPane.addWizardListener(new WizardListener(){
254
                        public void wizardStateChanged(boolean finishable) {
255
                                getBtnOk().setEnabled(finishable);
256
                                getBtnApply().setEnabled(finishable);
257
                        }
258

    
259
                        public void error(Exception e) {
260
                        }
261
        });
262

    
263
        //wfsParamsTabbedPane.disableDisagregatedLayers();
264
        this.add(wfsParamsTabbedPane);
265
        this.add(getButtonsPanel(), null);
266
    }
267

    
268
    
269
    /**
270
     * Buttons OK, Apply, Cancel
271
     * 
272
     * @return A panel with that buttons
273
     */
274
    public JPanel getButtonsPanel() {
275
                if (buttonsPanel == null) {
276
                        m_actionListener = new CommandListener(this);
277
                        buttonsPanel = new JPanel();
278
                buttonsPanel.setBounds(5, wfsParamsTabbedPane.getHeight(), 471, 40);
279
                        buttonsPanel.setLayout(null);
280
                        buttonsPanel.setName("buttonPanel");
281

    
282
                buttonsPanel.add(getBtnOk(), null);
283
                buttonsPanel.add(getBtnApply(), null);
284
                buttonsPanel.add(getBtnCancel(), null);
285
                }
286
                return buttonsPanel;
287
        }
288

    
289

    
290
    /**
291
         * With getParamsPanel we have access to the map config TabbedPane.
292
         * If this panel doesn't exist yet (which can occur when an existing project is
293
         * recovered) it is been automatically constructed by connecting to the server,
294
         * reloading the necessary data, filling up the content and setting the selected
295
         * values that were selected when the projet was saved.
296
         *
297
         *
298
         * Since a connection to the server is needed when rebuiliding the panel, this
299
         * causes a delay for the panel's showing up or a nullPointer error if there is
300
         * no path to the server.
301
         *
302
         *
303
         * Con getParamsPanel tenemos acceso a juego de pesta?as de configuraci?n
304
         * del mapa. Si este panel todav?a no existe (como puede ser cuando
305
         * recuperamos un proyecto guardado) ?ste se crea autom?ticamente conectando
306
         * al servidor, recuperando los datos necesarios, rellenando el contenido y
307
         * dejando seleccionados los valores que estaban seleccionados cuando se
308
         * guard? el proyecto.
309
         *
310
         *
311
         * Como para reconstruirse requiere una conexi?n con el servidor esto causa
312
         * un retardo en la aparici?n en el toc o un error de nullPointer si no
313
         * hay conexi?n hasta el servidor.
314
         *
315
         *
316
         * @return WMSParamsPanel
317
         */
318
        public WFSParamsPanel getParamsPanel(HashMap info) {
319
            if (info!=null){
320
                    URL host = (URL) info.get("host");
321
                    WFSWizardData dataSource = new WFSWizardData();
322
                    //dataSource.setHost(host, false);
323
                    dataSource.setDriver(((FLyrWFS)fLayer).getWfsDriver());
324
                    WFSParamsPanel toc = new WFSParamsPanel();
325
                    toc.setStatus((WFSStatus)info.get("status"));
326
                    toc.setWizardData(dataSource);
327
                    toc.setListenerSupport(new WizardListenerSupport());
328
                    toc.setSelectedFeature((WFSLayerNode)info.get("wfsLayerNode"));
329
                    toc.setLayerName(fLayer.getName());
330
                    toc.setVisible(true);
331
                    toc.refreshInfo();
332
                    applied = false;
333
                    return toc;                  
334
            }
335
            return null;
336
        }
337

    
338

    
339
        
340
        /*
341
         *  (non-Javadoc)
342
         * @see com.iver.andami.ui.mdiManager.IWindow#getWindowInfo()
343
         */
344
        public WindowInfo getWindowInfo() {
345
                if (m_ViewInfo == null){
346
                        m_ViewInfo=new WindowInfo(WindowInfo.MODALDIALOG);
347
                        m_ViewInfo.setTitle(PluginServices.getText(this,"fit_WFS_layer"));
348
                        m_ViewInfo.setWidth(wfsParamsTabbedPane.getWidth()+ 10);
349
                        m_ViewInfo.setHeight(wfsParamsTabbedPane.getHeight() + 40);
350
                }
351
                return m_ViewInfo;
352
        }
353

    
354
        /**
355
         * @return Returns the fLayer.
356
         */
357
        public FLayer getFLayer() {
358
                return fLayer;
359
        }
360

    
361
        /**
362
         * @param layer The fLayer to set.
363
         */
364
        public void setFLayer(FLayer layer) {
365
                fLayer = layer;
366
        }
367

    
368
        /**
369
         * JButton OK
370
         * 
371
         * @return javax.swing.JButton
372
         */
373
        public JButton getBtnOk() {
374
                if (btnOk == null) {
375
                btnOk = new JButton("ok");
376
                btnOk.setText(PluginServices.getText(this,"ok"));
377
                btnOk.setActionCommand("OK");
378
                btnOk.addActionListener(m_actionListener);
379
                btnOk.setBounds(367, 9, 90, 25);
380
                }
381
                return btnOk;
382
        }
383

    
384
        
385
        /**
386
         * JButton Apply
387
         * 
388
         * @return javax.swing.JButton
389
         */
390
        public JButton getBtnApply() {
391
                if (btnApply == null) {
392
                btnApply = new JButton("apply");
393
                btnApply.setText(PluginServices.getText(this,"apply"));
394
                btnApply.setEnabled(false);
395
                btnApply.setActionCommand("APPLY");
396
                btnApply.addActionListener(m_actionListener);
397
                btnApply.setBounds(267, 9, 90, 25);
398
                }
399
                return btnApply;
400
        }
401

    
402
        
403
        /**
404
         * JButton Cancel
405
         * 
406
         * @return javax.swing.JButton
407
         */
408
        public JButton getBtnCancel() {
409
                if (btnCancel == null) {
410
                btnCancel = new JButton("cancel");
411
                btnCancel.setText(PluginServices.getText(this,"cancel"));
412
                btnCancel.setActionCommand("CANCEL");
413
                btnCancel.addActionListener(m_actionListener);
414
                btnCancel.setBounds(137, 9, 90, 25);
415
                }
416
                return btnCancel;
417
        }
418

    
419

    
420
        /**
421
         * Closes this panel
422
         */
423
        public void close() {
424
                PluginServices.getMDIManager().closeWindow(this);
425
        }   
426
        
427
    /**
428
     * @see ActionListener
429
     * 
430
     * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
431
     */
432
        private class CommandListener implements ActionListener {
433
                /**
434
                 * Default constructor
435
                 * 
436
                 * @param tp
437
                 */
438
                public CommandListener(WFSPropsDialog tp) {
439
                }
440

    
441
                /* (non-Javadoc)
442
                 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
443
                 */
444
                public void actionPerformed(ActionEvent e) {
445
                        if ((e.getActionCommand() == "CANCEL") || (!getBtnApply().isEnabled())) {
446
                                close();
447
                                return;
448
                        }
449
                        try {
450

    
451
                        BaseView activeView = (BaseView) PluginServices.getMDIManager().getActiveWindow();
452
                        String layerName = null;
453

    
454
                        if (e.getActionCommand() == "APPLY") {
455
                                // We can't 'apply' if there is a filter query and it's incorrect
456
                                if (wfsParamsTabbedPane.getFilterQuery() != null) {
457

    
458
                                        if ((layerName = prepareFlyrWFSLayer()) != null) {
459
                                                MapControl mapCtrl = activeView.getMapControl();
460
                                                mapCtrl.getMapContext().getLayers().replaceLayer(layerName, fLayer);
461

    
462
                                                mapCtrl.getMapContext().invalidate();
463
                                        }
464

    
465
                                        applied = true;
466
                                        getBtnApply().setEnabled(!applied);
467
                                        refreshLayouts();
468
                                        
469
                                        // Restores the private attribute of the area panel: hasUserDefinedAnArea
470
                                        wfsParamsTabbedPane.setUserHasntDefinedAnArea();
471

    
472
                                        // If we load another layer, or the same but we've selected others fields -> notify it to the WFSFilter panel
473
                                        if (getWFSFilterPanelIsAsTabForWFSLayersLoad() || (wfsParamsTabbedPane.getFieldsSelectedOfSameLayerHasChanged())) {
474
                                                setWFSFilterPanelIsAsTabForWFSLayersLoad(false);
475
                                                wfsParamsTabbedPane.resetFieldsSelectedOfSameLayerHasChanged(); // reset that field
476
                                         }
477

    
478
                                        // Update values associated to the current selected field
479
                                        wfsParamsTabbedPane.updateWFSFilterFieldValues();
480
                                        wfsParamsTabbedPane.updateWFSArea();
481
                                }
482
                                return;
483
                        }
484

    
485
                        if (e.getActionCommand() == "OK") {
486
                                // We can't 'apply' if there is a filter query and it's incorrect
487
                                if (wfsParamsTabbedPane.getFilterQuery() != null) {
488
                                        if (!applied) {
489
                                                if (getBtnApply().isEnabled()){
490

    
491
                                                        if ((layerName = prepareFlyrWFSLayer()) != null)
492
                                                        {
493
                                                                BaseView vista = (BaseView) PluginServices.getMDIManager().getActiveWindow();
494
                                                                MapControl mapCtrl = vista.getMapControl();
495
                                                                mapCtrl.getMapContext().getLayers().replaceLayer(layerName, fLayer);
496
                                                                mapCtrl.getMapContext().invalidate();
497
                                                                refreshLayouts();
498

    
499
                                                                // Restores the private attribute of the area panel: hasUserDefinedAnArea
500
                                                                wfsParamsTabbedPane.setUserHasntDefinedAnArea();
501
                                                        }
502
                                                }
503
                                        }
504
                                        close();
505

    
506
                                        // Update all fields and values known about the current layer loaded (and selected)
507
                                        ((FLyrWFS)fLayer).setAllFieldsAndValuesKnown(wfsParamsTabbedPane.getAllFieldsAndValuesKnownOfCurrentLayer());
508
                                }
509

    
510
                        }
511
                        } catch (ConnectionErrorLayerException e1) {
512
                                e1.printStackTrace();
513
                        } catch (DriverLayerException e1) {
514
                                e1.printStackTrace();
515
                        } catch (LegendLayerException e1) {
516
                                e1.printStackTrace();
517
                        } catch (NameLayerException e1) {
518
                                e1.printStackTrace();
519
                        } catch (ProjectionLayerException e1) {
520
                                e1.printStackTrace();
521
                        } catch (TypeLayerException e1) {
522
                                e1.printStackTrace();
523
                        } catch (UnsupportedVersionLayerException e1) {
524
                                e1.printStackTrace();
525
                        } catch (URLLayerException e1) {
526
                                e1.printStackTrace();
527
                        } catch (XMLLayerException e1) {
528
                                e1.printStackTrace();
529
                        } catch (WFSLayerException e1) {
530
                                e1.printStackTrace();
531
                        } catch (LoadLayerException e1) {
532
                                e1.printStackTrace();
533
                        }
534
                }
535

    
536
                /**
537
                 * Updates data in the current layer of current active view
538
                 *
539
                 * @param currentView The current active view
540
                 * @return Te name of the layer
541
                 */
542
                private String prepareFlyrWFSLayer() {
543
//                         layerName = fLayer.getName();
544
        //                  View activeView = (View) PluginServices.getMDIManager().getActiveWindow();
545
                        IVectorLegend legend = (IVectorLegend)((FLyrVect)fLayer).getLegend();
546
                         FMapWFSDriver driver = wfsParamsTabbedPane.getDriver();
547
                         try {
548
                                 fLayer = wfsParamsTabbedPane.getLayer();
549

    
550
                                 if (fLayer != null) {
551
                                         URL host = new URL(wfsParamsTabbedPane.getData().getHost());
552
                                         String onlineResource = wfsParamsTabbedPane.getData().getOnlineResource();
553
                                         fLayer = new FLyrWFSFactory().getFLyrWFS(fLayer,host,onlineResource,driver,true);
554
                                         if (fLayer != null) {
555
                                                 ((FLyrWFS)fLayer).setLegend(legend);
556
        
557
                                                  // Update all fields and values known about the current layer loaded (and selected)
558
                                                 ((FLyrWFS)fLayer).setAllFieldsAndValuesKnown(wfsParamsTabbedPane.getAllFieldsAndValuesKnownOfCurrentLayer());
559
        
560
                                                 return fLayer.getName();
561
                                         }
562
                                 }
563
                        } catch (MalformedURLException e1) {
564
                                e1.printStackTrace();
565
                        } catch (LegendLayerException e) {
566
                                e.printStackTrace();
567
                        }
568

    
569
                        return null;
570
                }
571

    
572
                private boolean loadLayer(FLayer flayer) {
573
                                try {
574
                                        ((FLyrWFS)fLayer).load();
575
                                } catch (LoadLayerException e) {
576
                                        e.printStackTrace();
577
                                        JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),
578
                                                        PluginServices.getText(this,"cantLoad"));
579
                                        return false;
580

    
581
                                }
582

    
583
                                if (((FLyrWFS)fLayer).getNumfeatures() == ((FLyrWFS)fLayer).getWfsDriver().getRowCount()) {
584
                                        JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),
585
                                                PluginServices.getText(this,"maxFeatures_aviso"));
586
                                }
587
                        return true;
588
                }
589
        }
590

    
591
        /**
592
         * @see WFSFilterPanel#setWFSFilterPanelIsAsTabForWFSLayersLoad(boolean)
593
         */
594
        public void setWFSFilterPanelIsAsTabForWFSLayersLoad(boolean b) {
595
                this.wfsParamsTabbedPane.setWFSFilterPanelIsAsTabForWFSLayersLoad(b);
596
        }
597

    
598
        /**
599
         * @see WFSFilterPanel#getWFSFilterPanelIsAsTabForWFSLayersLoad()
600
         */
601
        public boolean getWFSFilterPanelIsAsTabForWFSLayersLoad() {
602
                return this.wfsParamsTabbedPane.getWFSFilterPanelIsAsTabForWFSLayersLoad();
603
        }
604

    
605
        /**
606
         * Sets all fielsd and values known of current layer to WFSFilterPanel
607
         */
608
        public void updateAllFieldsAndValuesKnownOfCurrentLayerToWFSFilterPanel() {
609
                this.wfsParamsTabbedPane.setAllFieldsAndValuesKnownOfCurrentLayer(((FLyrWFS)this.getFLayer()).getAllFieldsAndValuesKnown());
610
        }
611

    
612
        /**
613
         * Refresh the layouts
614
         */
615
        private void refreshLayouts(){
616
                IWindow[] windows = PluginServices.getMDIManager().getAllWindows();
617
                for (int i=0 ; i<windows.length ; i++){
618
                        if (windows[i] instanceof Layout){
619
                                ((Layout)windows[i]).getLayoutContext().fullRefresh();
620
                        }
621
                }
622
        }
623
        
624
        /**
625
         * @see WFSAreaPanel#updateWFSArea()
626
         */
627
        public void updateWFSArea() {
628
                this.wfsParamsTabbedPane.updateWFSArea();
629
        }
630
}
631