Statistics
| Revision:

svn-gvsig-desktop / tags / v1_0_2_Build_900 / extensions / extWMS / src / com / iver / cit / gvsig / gui / panels / WMSParamsPanel.java @ 10562

History | View | Annotate | Download (44.6 KB)

1 4594 jaume
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2 6500 jaume
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41 3746 jaume
package com.iver.cit.gvsig.gui.panels;
42
43 4222 jaume
import java.awt.Component;
44
import java.awt.Dimension;
45
import java.awt.event.FocusAdapter;
46 3746 jaume
import java.awt.event.FocusEvent;
47
import java.awt.event.FocusListener;
48 4222 jaume
import java.awt.event.MouseAdapter;
49
import java.awt.event.MouseEvent;
50 3746 jaume
import java.awt.geom.Rectangle2D;
51 4947 ldiaz
import java.net.MalformedURLException;
52
import java.net.URL;
53 3850 jaume
import java.util.AbstractCollection;
54 3746 jaume
import java.util.ArrayList;
55 4222 jaume
import java.util.Hashtable;
56 3746 jaume
import java.util.TreeSet;
57
import java.util.Vector;
58 4222 jaume
import java.util.prefs.Preferences;
59 3746 jaume
60 4222 jaume
import javax.swing.ImageIcon;
61 3746 jaume
import javax.swing.JCheckBox;
62 6122 jaume
import javax.swing.JList;
63 4222 jaume
import javax.swing.JOptionPane;
64 3746 jaume
import javax.swing.JPanel;
65 6122 jaume
import javax.swing.JScrollPane;
66 3746 jaume
import javax.swing.JTabbedPane;
67
import javax.swing.JTextField;
68
import javax.swing.tree.TreePath;
69
70 4222 jaume
import org.cresques.cts.ICoordTrans;
71
import org.cresques.cts.IProjection;
72 4606 jaume
import org.gvsig.gui.beans.controls.dnd.JDnDListModel;
73
import org.gvsig.gui.beans.listeners.BeanListener;
74 6115 jaume
import org.gvsig.gui.beans.swing.JButton;
75 4222 jaume
76 3746 jaume
import com.iver.andami.PluginServices;
77 4222 jaume
import com.iver.andami.messages.NotificationManager;
78 7703 luisw2
import com.iver.cit.gvsig.fmap.crs.CRSFactory;
79 3746 jaume
import com.iver.cit.gvsig.fmap.drivers.wms.FMapWMSDriver;
80 4222 jaume
import com.iver.cit.gvsig.fmap.exceptions.CannotReprojectException;
81 3746 jaume
import com.iver.cit.gvsig.fmap.layers.FLayer;
82 4947 ldiaz
import com.iver.cit.gvsig.fmap.layers.FLayers;
83
import com.iver.cit.gvsig.fmap.layers.FLyrWMS;
84 3746 jaume
import com.iver.cit.gvsig.fmap.layers.IFMapWMSDimension;
85
import com.iver.cit.gvsig.fmap.layers.WMSLayerNode;
86
import com.iver.cit.gvsig.fmap.layers.WMSLayerNode.FMapWMSStyle;
87
import com.iver.cit.gvsig.gui.WizardPanel;
88
import com.iver.cit.gvsig.gui.wizards.FormatListModel;
89
import com.iver.cit.gvsig.gui.wizards.LayerTreeModel;
90
import com.iver.cit.gvsig.gui.wizards.SRSListModel;
91
import com.iver.cit.gvsig.gui.wizards.WMSWizardData;
92
import com.iver.cit.gvsig.gui.wizards.WizardListenerSupport;
93 9536 jcampos
import com.iver.cit.gvsig.project.documents.view.gui.BaseView;
94 6500 jaume
95 3746 jaume
/**
96
 * This class implements the map option panel.
97 6115 jaume
 *
98 3746 jaume
 * It includes a set of Listeners that implement some control rules which
99
 * refresh the component values that depends on those selected in the other
100
 * components to avoid to choose an invalid set of options. It also includes a
101 3756 jaume
 * method (isCorrectlyConfigured()) that checks if the current set of values is
102
 * enough to correctly launch a GetMap request.
103 6115 jaume
 *
104 3746 jaume
 * The information is obtained from a WMSWizardDataSource object.
105 6115 jaume
 *
106
 *
107 3756 jaume
 * Esta clase implementa el panel de opciones disponibles sobre el mapa
108 6115 jaume
 *
109 3746 jaume
 * Incluye una serie de Listeners que implementan unas reglas de control que
110 6115 jaume
 * refrescan los valores de componentes cuyos valores dependen de aqu?llos
111 4594 jaume
 * seleccionados en otros componentes para evitar que se escoja una combinaci?n
112
 * de opciones err?nea as? como una funci?n (isCorrectlyConfigured()) que
113
 * comprueba si la combinaci?n escogida actualmente es suficiente para lanzar
114
 * una operaci?n GetMap correctamente.
115 6115 jaume
 *
116 4594 jaume
 * La informaci?n obtiene a partir de un objeto WMSWizardDataSource.
117 6115 jaume
 *
118 3746 jaume
 * @author jaume - jaume dominguez faus
119
 *
120
 */
121
public class WMSParamsPanel extends WizardPanel {
122 6122 jaume
        private JScrollPane jScrollPane1 = null;
123
        private JScrollPane jScrollPane2 = null;
124
        private JScrollPane jScrollPane5 = null;
125 6115 jaume
        private JButton btnAdd = null;
126
        private JButton btnDel = null;
127 6122 jaume
        private JScrollPane jScrollPane6 = null;
128
        private JPanel jPanel2 = null;
129
        private JPanel tabFormats = null;
130 3746 jaume
        private JPanel jPanel4 = null;
131
        private JTextField jTxtNomCapa = null;
132 4222 jaume
        private LayerList lstSelectedLayers = null;
133 4473 ldiaz
        private ArrayList selectedPaths = new ArrayList();
134 6122 jaume
        private JList lstSRSs = null;
135 3746 jaume
        private LayerTree treeLayers = null;
136 6122 jaume
        private JList lstFormats = null;
137 3746 jaume
        private WizardListenerSupport listenerSupport;
138 4397 ldiaz
        public WMSWizardData dataSource;
139 3746 jaume
        private JTabbedPane jTabbedPane = null;
140
        private JPanel tabLayers = null;
141
        private JPanel jPanel1 = null;
142
        private JPanel jPanel5 = null;
143
        private StylesPanel tabStyle = null;
144
        private JCheckBox chkTransparency = null;
145 6500 jaume
        private InfoPanel tabInfo = null;
146
        private DimensionPanel tabDimensions = null;
147
        private int dimensionTabIndex;
148
        private int stylesTabIndex;
149
        private String oldSRS = null;
150 4222 jaume
        private AbstractCollection oldDimensions = null;
151
        private Dimension sizeFixed;
152
        private JCheckBox chkExtendedNames = null;
153
        private JButton btnUp = null;
154
        private JButton btnDown = null;
155 6500 jaume
156
        public static Preferences fPrefs = Preferences.userRoot().node(
157
                        "gvsig.wms-wizard");
158
159 4449 ldiaz
        private JCheckBox chkDisagregate = null;
160 6115 jaume
161 6500 jaume
        public WMSParamsPanel() {
162 3746 jaume
                super();
163
                initialize();
164
        }
165 6115 jaume
166 6500 jaume
        // TODO: crear nuevo constructor para a?adir los panels que quieras...
167
        public WMSParamsPanel(WMSWizardData data) {
168
                super();
169
                setWizardData(data);
170 4360 ldiaz
                this.setLayout(null);
171
                this.setVisible(false);
172 6844 ldiaz
                this.setBounds(0, 0, 510, 427);
173 4360 ldiaz
                if (jTabbedPane == null) {
174
                        jTabbedPane = new JTabbedPane();
175 6844 ldiaz
                        jTabbedPane.setBounds(4, 4, 502, 415);
176 6500 jaume
                        StylesPanel sp = getTabStyle();
177
                        DimensionPanel dp = getTabDimensions();
178 6115 jaume
179 6500 jaume
                        jTabbedPane.addTab(PluginServices.getText(this, "capas"), null,
180
                                        getTabLayers(), null);
181
                        jTabbedPane.addTab(PluginServices.getText(this, "estilos"), null,
182
                                        sp, null);
183
                        stylesTabIndex = jTabbedPane.getTabCount() - 1;
184
                        jTabbedPane.addTab(PluginServices.getText(this, "dimensiones"),
185
                                        null, dp, null);
186
                        dimensionTabIndex = jTabbedPane.getTabCount() - 1;
187
                        jTabbedPane.addTab(PluginServices.getText(this, "formatos"), null,
188
                                        getTabFormats(), null);
189
                        jTabbedPane.setEnabledAt(dimensionTabIndex, false);
190
                        jTabbedPane.setEnabledAt(stylesTabIndex, false);
191 4360 ldiaz
                }
192
                this.add(jTabbedPane, null);
193 6115 jaume
194 6500 jaume
                setListenerSupport(new WizardListenerSupport());
195
        }
196 6115 jaume
197 3746 jaume
        /**
198
         * This method initializes panelPage2
199
         *
200 6122 jaume
         * @return Panel
201 3746 jaume
         */
202
        private void initialize() {
203
                this.setLayout(null);
204
                this.setVisible(false);
205 6500 jaume
                this.setBounds(0, 0, 510, 427);
206 3746 jaume
                this.add(getJTabbedPane(), null);
207
        }
208 6500 jaume
209 3746 jaume
        /**
210
         * This method initializes jPanel2
211
         *
212 6122 jaume
         * @return Panel
213 3746 jaume
         */
214 6122 jaume
        private JPanel getJPanel2() {
215 3746 jaume
                if (jPanel2 == null) {
216 6122 jaume
                        jPanel2 = new JPanel();
217 3746 jaume
                        jPanel2.setLayout(null);
218 6500 jaume
                        jPanel2.setBounds(5, 59, 485, 328);
219 3746 jaume
                        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(
220 3774 jaume
                                        null, PluginServices.getText(this, "select_layers"),
221 3746 jaume
                                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
222 6500 jaume
                                        javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
223
                                        null));
224 4222 jaume
                        jPanel2.add(getChkExtendedNames(), null);
225 6115 jaume
226 3746 jaume
                        jPanel2.add(getJScrollPane1(), null);
227
                        jPanel2.add(getBtnDel(), null);
228
                        jPanel2.add(getBtnAdd(), null);
229
                        jPanel2.add(getJScrollPane5(), null);
230 4222 jaume
                        jPanel2.add(getBtnUp(), null);
231
                        jPanel2.add(getBtnDown(), null);
232 4449 ldiaz
                        jPanel2.add(getChkDisagregate(), null);
233 3746 jaume
                }
234
235
                return jPanel2;
236
        }
237 6115 jaume
238 3746 jaume
        /**
239
         * This method initializes jPanel4
240
         *
241 6122 jaume
         * @return Panel
242 3746 jaume
         */
243
        private JPanel getJPanel4() {
244
                if (jPanel4 == null) {
245
                        jPanel4 = new JPanel();
246
                        jPanel4.setLayout(null);
247
                        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(
248 3774 jaume
                                        null, PluginServices.getText(this, "layer_name"),
249 3746 jaume
                                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
250 6500 jaume
                                        javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
251
                                        null));
252
                        jPanel4.setBounds(5, 8, 485, 49);
253 3746 jaume
                        jPanel4.add(getJTxtNomCapa(), null);
254
                }
255
256
                return jPanel4;
257
        }
258 6115 jaume
259 3746 jaume
        /**
260
         * This method initializes jPanel3
261
         *
262 6122 jaume
         * @return Panel
263 3746 jaume
         */
264 6122 jaume
        private JPanel getTabFormats() {
265 3746 jaume
                if (tabFormats == null) {
266 6122 jaume
                        tabFormats = new JPanel();
267 3746 jaume
                        tabFormats.setLayout(null);
268
                        tabFormats.add(getJPanel1(), null);
269
                        tabFormats.add(getJPanel5(), null);
270
                }
271
272
                return tabFormats;
273
        }
274 6500 jaume
275 3746 jaume
        /**
276
         * This method initializes jScrollPane1
277
         *
278 6122 jaume
         * @return ScrollPane
279 3746 jaume
         */
280 6122 jaume
        private JScrollPane getJScrollPane1() {
281 3746 jaume
                if (jScrollPane1 == null) {
282 6122 jaume
                        jScrollPane1 = new JScrollPane();
283 6500 jaume
                        jScrollPane1.setBounds(11, 22, 460, 123);
284 3746 jaume
                        jScrollPane1.setViewportView(getTreeLayers());
285
                        jScrollPane1.setPreferredSize(new java.awt.Dimension(205, 75));
286
                }
287
288
                return jScrollPane1;
289
        }
290 6115 jaume
291 3746 jaume
        /**
292
         * This method initializes btnDel
293
         *
294 6122 jaume
         * @return Button
295 3746 jaume
         */
296 6115 jaume
        private JButton getBtnDel() {
297 3746 jaume
                if (btnDel == null) {
298 6115 jaume
                        btnDel = new JButton();
299 6500 jaume
                        // btnDel.setPreferredSize(new java.awt.Dimension(23, 23));
300 4222 jaume
                        btnDel.setText(PluginServices.getText(this, "remove"));
301 3746 jaume
                        btnDel.setMargin(new java.awt.Insets(2, 0, 2, 0));
302 4222 jaume
                        btnDel.setBounds(339, 300, 101, 20);
303 3746 jaume
                        btnDel.setEnabled(false);
304
                        btnDel.addActionListener(new java.awt.event.ActionListener() {
305 6500 jaume
                                public void actionPerformed(java.awt.event.ActionEvent e) {
306
                                        delLayer();
307
                                }
308
                        });
309 3746 jaume
                }
310
                return btnDel;
311
        }
312 6115 jaume
313 3746 jaume
        /**
314
         * This method initializes btnAdd
315
         *
316 6122 jaume
         * @return Button
317 3746 jaume
         */
318 6122 jaume
        private JButton getBtnAdd() {
319 3746 jaume
                if (btnAdd == null) {
320 6115 jaume
                        btnAdd = new JButton();
321 6500 jaume
                        // btnAdd.setPreferredSize(new java.awt.Dimension(23, 23));
322 3774 jaume
                        btnAdd.setText(PluginServices.getText(this, "add"));
323 3746 jaume
                        btnAdd.setMargin(new java.awt.Insets(2, 0, 2, 0));
324 4222 jaume
                        btnAdd.setBounds(236, 300, 101, 20);
325 3746 jaume
                        btnAdd.setEnabled(false);
326
                        btnAdd.addActionListener(new java.awt.event.ActionListener() {
327 6500 jaume
                                public void actionPerformed(java.awt.event.ActionEvent e) {
328
                                        addLayer();
329
                                }
330
                        });
331 3746 jaume
                }
332
                return btnAdd;
333
        }
334 6115 jaume
335 3746 jaume
        /**
336
         * This method initializes jScrollPane5
337
         *
338 6122 jaume
         * @return ScrollPane
339 3746 jaume
         */
340 6122 jaume
        private JScrollPane getJScrollPane5() {
341 3746 jaume
                if (jScrollPane5 == null) {
342 6122 jaume
                        jScrollPane5 = new JScrollPane();
343 6500 jaume
                        jScrollPane5.setBounds(11, 155, 422, 120);
344 3746 jaume
                        jScrollPane5.setViewportView(getLstSelectedLayers());
345
                        jScrollPane5.setPreferredSize(new java.awt.Dimension(205, 75));
346
                }
347
348
                return jScrollPane5;
349
        }
350 6115 jaume
351 3746 jaume
        /**
352
         * This method initializes jTextField
353
         *
354 6122 jaume
         * @return TextField
355 3746 jaume
         */
356
        private JTextField getJTxtNomCapa() {
357
                if (jTxtNomCapa == null) {
358
                        jTxtNomCapa = new JTextField();
359 6500 jaume
                        jTxtNomCapa.setBounds(10, 19, 460, 20);
360 3774 jaume
                        jTxtNomCapa.setText(PluginServices.getText(this, "WMSLayer"));
361 6115 jaume
                        jTxtNomCapa.addKeyListener(new java.awt.event.KeyAdapter() {
362
                                public void keyTyped(java.awt.event.KeyEvent e) {
363 4222 jaume
                                        fireWizardComplete(isCorrectlyConfigured());
364
                                }
365
                        });
366 3746 jaume
                }
367
368
                return jTxtNomCapa;
369
        }
370
371
        /**
372
         * This method initializes jScrollPane6
373
         *
374 6122 jaume
         * @return ScrollPane
375 3746 jaume
         */
376 6122 jaume
        private JScrollPane getJScrollPane6() {
377 3746 jaume
                if (jScrollPane6 == null) {
378 6122 jaume
                        jScrollPane6 = new JScrollPane();
379 6500 jaume
                        jScrollPane6.setBounds(5, 23, 470, 140);
380 3746 jaume
                        jScrollPane6.setViewportView(getLstFormats());
381
                        jScrollPane6.setPreferredSize(new java.awt.Dimension(250, 200));
382
                }
383
384
                return jScrollPane6;
385
        }
386 6115 jaume
387 3746 jaume
        /**
388
         * This method initializes jScrollPane2
389
         *
390 6122 jaume
         * @return ScrollPane
391 3746 jaume
         */
392 6122 jaume
        private JScrollPane getJScrollPane2() {
393 3746 jaume
                if (jScrollPane2 == null) {
394 6122 jaume
                        jScrollPane2 = new JScrollPane();
395 6500 jaume
                        jScrollPane2.setBounds(5, 23, 470, 140);
396 3746 jaume
                        jScrollPane2.setViewportView(getLstSRSs());
397
                        jScrollPane2.setPreferredSize(new java.awt.Dimension(100, 200));
398
                }
399
400
                return jScrollPane2;
401
        }
402 6115 jaume
403 3746 jaume
        /**
404 4449 ldiaz
         * Gets the available layers in WMS maintaining the tree structure
405 6500 jaume
         *
406 4449 ldiaz
         * @return
407
         */
408 6500 jaume
        public LayerTree getLayerStructure() {
409 4449 ldiaz
                return treeLayers;
410
        }
411 6115 jaume
412 4449 ldiaz
        /**
413 3746 jaume
         * This method initializes treeLayers
414
         *
415 6122 jaume
         * @return Tree
416 3746 jaume
         */
417
        private LayerTree getTreeLayers() {
418
                if (treeLayers == null) {
419
                        treeLayers = new LayerTree();
420
                        treeLayers.setRootVisible(true);
421 6115 jaume
                        treeLayers.addMouseListener(new java.awt.event.MouseAdapter() {
422
                                public void mouseClicked(java.awt.event.MouseEvent e) {
423 6500 jaume
                                        if (e.getClickCount() == 2) {
424
                                                addLayer();
425
                                        }
426 3746 jaume
                                }
427
                        });
428 6500 jaume
                        treeLayers
429
                                        .addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
430
                                                public void valueChanged(
431
                                                                javax.swing.event.TreeSelectionEvent e) {
432 6115 jaume
433 6500 jaume
                                                        boolean isGetMapable = false; // pffff, jajaja
434
                                                        TreePath[] selecciones = getTreeLayers()
435
                                                                        .getSelectionPaths();
436
                                                        if (selecciones != null) // no entenc perqu?
437
                                                                                                                // peta ac? i li
438
                                                                                                                // arriba null a
439
                                                                                                                // voltes...
440
                                                        {
441
                                                                for (int i = 0; i < selecciones.length
442
                                                                                && !isGetMapable; i++) {
443
                                                                        WMSLayerNode layer = ((WMSLayerNode) selecciones[i]
444
                                                                                        .getLastPathComponent());
445
                                                                        isGetMapable = layer.getChildren().size() == 0
446
                                                                                        || layer.getName() != null;
447
                                                                }
448 6115 jaume
449 6500 jaume
                                                        }
450
                                                        getBtnAdd().setEnabled(isGetMapable);
451
                                                        fireWizardComplete(isCorrectlyConfigured());
452
                                                }
453
                                        });
454 3746 jaume
                }
455
456
                return treeLayers;
457
        }
458
459 6500 jaume
        /**
460
         * This method checks for the options selected within the configuration
461
         * dialog are correct and enough to perform a GetMap request.
462
         *
463 3746 jaume
         * @return true if you're done, false if not.
464
         */
465
        public boolean isCorrectlyConfigured() {
466 6115 jaume
467 3746 jaume
                boolean b;
468 6500 jaume
                this.repaint();
469
                if ((getLstSRSs().getSelectedIndex() != -1)
470
                                && (getLstFormats().getSelectedIndex() != -1)
471
                                && (getLstSelectedLayers().getModel().getSize() > 0)) {
472 3746 jaume
                        b = true;
473
                } else {
474
                        b = false;
475
                }
476 6115 jaume
477 6500 jaume
                // Enable or disable del button.
478 4222 jaume
                int[] selectedIndices = getLstSelectedLayers().getSelectedIndices();
479 6115 jaume
480 6500 jaume
                getBtnDel().setEnabled(
481
                                selectedIndices != null && selectedIndices.length > 0);
482 6115 jaume
483 6500 jaume
                return b;
484 3746 jaume
        }
485 6115 jaume
486 4222 jaume
        public WMSLayerNode[] selectedLayersToArray() {
487 6115 jaume
                JDnDListModel modelo = ((JDnDListModel) lstSelectedLayers.getModel());
488 6500 jaume
                ArrayList elements = modelo.getElements();
489
                WMSLayerNode[] layers = (WMSLayerNode[]) elements
490
                                .toArray(new WMSLayerNode[0]);
491
                return layers;
492 4222 jaume
        }
493 6115 jaume
494 3746 jaume
        /**
495
         * DOCUMENT ME!
496
         */
497
        private void delLayer() {
498
                int[] indices = lstSelectedLayers.getSelectedIndices();
499
500 4222 jaume
                try {
501
                        ArrayList removeList = new ArrayList();
502
                        WMSLayerNode[] infos = selectedLayersToArray();
503 6500 jaume
                        JDnDListModel modelo = ((JDnDListModel) lstSelectedLayers
504
                                        .getModel());
505 4222 jaume
                        for (int i = 0; i < indices.length; i++) {
506
                                removeList.add(infos[indices[i]]);
507 6115 jaume
                        }
508 4222 jaume
                        modelo.delIndices(indices);
509
                        lstSelectedLayers.clearSelection();
510
                        fireWizardComplete(isCorrectlyConfigured());
511 6115 jaume
512 6500 jaume
                        // delete from selectedPaths as well
513 4492 ldiaz
                        WMSLayerNode elemento = null;
514
                        WMSLayerNode last = null;
515
                        TreePath path = null;
516 6500 jaume
                        for (int i = removeList.size() - 1; i >= 0; i--) {
517
                                elemento = (WMSLayerNode) removeList.get(i);
518
                                for (int j = 0; j < selectedPaths.size(); j++) {
519
                                        path = (TreePath) selectedPaths.get(j);
520
                                        last = (WMSLayerNode) path.getLastPathComponent();
521
                                        if (last.getTitle().compareTo(elemento.getTitle()) == 0) {
522 4492 ldiaz
                                                selectedPaths.remove(path);
523
                                        }
524
                                }
525
                        }
526 6115 jaume
527 4222 jaume
                        refreshData();
528
                        refreshInfo();
529
                } catch (ArrayIndexOutOfBoundsException ex) {
530
                        // if you reach this, please, tell me how you did it.
531
                        ex.printStackTrace();
532 3746 jaume
                }
533
        }
534 6115 jaume
535 3746 jaume
        /**
536
         * Fires a notification to this wizard listeners telling them if the
537
         * configuration is fair enough to send a GetMap request.
538 6500 jaume
         *
539 3746 jaume
         * @param b
540
         */
541 6500 jaume
        private void fireWizardComplete(boolean b) {
542 3746 jaume
                listenerSupport.callStateChanged(b);
543
                callStateChanged(b);
544
        }
545 6115 jaume
546 3746 jaume
        /**
547 6500 jaume
         * Refreshes the content shown by this.
548
         */
549
        public void refreshData() {
550
                refreshSRS();
551
                getLstSelectedLayers().repaint();
552
                refreshStyleTree();
553
                refreshDimensions();
554 6115 jaume
555 6500 jaume
        }
556 6115 jaume
557 6500 jaume
        /**
558
         * Refreshes the info tab
559
         *
560
         */
561
        public void refreshInfo() {
562
                getTabInfo().refresh(dataSource, selectedLayersVector(),
563
                                getStyleTitles(), getFormat(), getSRS(), getDimensions());
564
        }
565 3746 jaume
566 6500 jaume
        private void refreshDimensions() {
567
                int size = getLstSelectedLayers().getModel().getSize();
568
                boolean enable = false;
569
                for (int i = 0; i < size; i++) {
570
                        WMSLayerNode node = (WMSLayerNode) getLstSelectedLayers()
571
                                        .getModel().getElementAt(i);
572
                        if (node.getDimensions() == null)
573
                                continue;
574 3746 jaume
575 6500 jaume
                        for (int j = 0; j < node.getDimensions().size(); j++) {
576
                                IFMapWMSDimension dim = (IFMapWMSDimension) node
577
                                                .getDimensions().get(j);
578 6115 jaume
579 6500 jaume
                                try {
580
                                        getTabDimensions().addDimension(dim);
581
                                        enable = true;
582
                                } catch (IllegalArgumentException e) {
583
                                        NotificationManager.addWarning(
584
                                                        "Unrecognized dimension expression: "
585
                                                                        + dim.getExpression() + " (for "
586
                                                                        + dim.getName() + " in layer '"
587
                                                                        + node.getName() + "')", null);
588
                                }
589
                        }
590
                }
591
                jTabbedPane.setEnabledAt(dimensionTabIndex, enable);
592 6115 jaume
593 6500 jaume
        }
594 3746 jaume
595 6500 jaume
        /**
596
         *
597
         */
598
        private void refreshStyleTree() {
599 6115 jaume
600 6500 jaume
                int size = getLstSelectedLayers().getModel().getSize();
601
                WMSLayerNode styleRoot = new WMSLayerNode();
602
                styleRoot.setTitle(PluginServices.getText(this, "selected_layers"));
603 6115 jaume
604 6500 jaume
                StyleTreeModel model = new StyleTreeModel(styleRoot);
605
                jTabbedPane.setEnabledAt(stylesTabIndex, false);
606
                for (int i = 0; i < size; i++) {
607
                        WMSLayerNode node = (WMSLayerNode) getLstSelectedLayers()
608
                                        .getModel().getElementAt(i);
609
                        // If any of the layers defines styles, the tab will be enabled.
610
                        if (model.addLayerBranch(node)) {
611
                                jTabbedPane.setEnabledAt(stylesTabIndex, true);
612
                        }
613
                }
614 6115 jaume
615 6500 jaume
                getStyleTree().setModel(model);
616
                getStyleTree().expandAll();
617
                getStyleTree().repaint();
618
        }
619 6115 jaume
620 6500 jaume
        /**
621
         * Takes the array of selected layers and a vector containing the style
622
         * names and set them as selected in the styles panel
623
         *
624
         * @param selectedLayers
625
         * @param styles
626
         */
627
        public void setStyleSelections(Vector styles) {
628 6115 jaume
629 6500 jaume
                WMSLayerNode[] layers = selectedLayersToArray();
630
                int length = layers.length;
631 10399 ldiaz
                if (styles.isEmpty()) return;
632 6500 jaume
                for (int i = 0; i < length; i++) {
633 10399 ldiaz
                        if(styles.get(i) != null){
634
                                String styleName = (String) styles.get(i);
635
                                layers[length - i - 1].setSelectedStyleByName(styleName);
636
                        }
637 4222 jaume
                }
638 6500 jaume
        }
639 6115 jaume
640 6500 jaume
        /**
641
         * Gets the currently shown style tree.
642
         *
643
         * @return
644
         */
645
        private StyleTree getStyleTree() {
646
                return getTabStyle().getStyleTree();
647
        }
648 3746 jaume
649 6500 jaume
        /**
650
         * Method called when pressing the Add layer button or when double-clicking
651
         * on a layer from the server's layer tree.
652 3746 jaume
         */
653 4962 ldiaz
        public void addLayer() {
654 3746 jaume
                boolean alguno = false;
655
656
                TreePath[] selecciones = getTreeLayers().getSelectionPaths();
657 3806 jaume
                if (selecciones == null)
658
                        return;
659 3746 jaume
                for (int i = 0; i < selecciones.length; i++) {
660 6115 jaume
                        selectedPaths.add(selecciones[i]);
661 6500 jaume
                        WMSLayerNode nodo = (WMSLayerNode) selecciones[i]
662
                                        .getLastPathComponent();
663 4222 jaume
                        if (nodo.getName() == null || nodo.getName().equals(""))
664
                                // no es un node que es puga demanar
665
                                continue;
666
                        if (nodo.isSizeFixed()) {
667
                                if (sizeFixed == null)
668
                                        sizeFixed = nodo.getFixedSize();
669 6500 jaume
                                else if ((sizeFixed.getHeight() != nodo.getFixedSize()
670
                                                .getHeight())
671
                                                || (sizeFixed.getWidth() != nodo.getFixedSize()
672
                                                                .getWidth())) {
673
                                        JOptionPane.showMessageDialog((Component) PluginServices
674
                                                        .getMainFrame(), PluginServices.getText(this,
675
                                                        "server_cant_render_layers"));
676 3749 jaume
                                        continue;
677 4222 jaume
                                }
678
                        }
679
                        // s'afegeix a la llista de capes seleccionades
680 3746 jaume
                        JDnDListModel modelo = (JDnDListModel) lstSelectedLayers.getModel();
681
682
                        if (modelo.addElement(0, nodo.clone())) {
683
                                alguno = true;
684
                        }
685 6500 jaume
                }
686 3746 jaume
687
                if (alguno) {
688 4222 jaume
                        refreshData();
689 3746 jaume
                }
690 6500 jaume
                refreshInfo();
691 3746 jaume
        }
692 6115 jaume
693 3746 jaume
        /**
694
         * This method initializes lstSelectedLayers
695
         *
696 6122 jaume
         * @return List
697 3746 jaume
         */
698 4222 jaume
        public LayerList getLstSelectedLayers() {
699 3746 jaume
                if (lstSelectedLayers == null) {
700 6500 jaume
                        lstSelectedLayers = new LayerList();
701 4606 jaume
                        lstSelectedLayers.setModel(new JDnDListModel());
702 6500 jaume
                        lstSelectedLayers
703
                                        .setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
704
                        lstSelectedLayers
705
                                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
706
                                                public void valueChanged(
707
                                                                javax.swing.event.ListSelectionEvent e) {
708
                                                        fireWizardComplete(isCorrectlyConfigured());
709
                                                }
710
                                        });
711
                        lstSelectedLayers.addMouseListener(new MouseAdapter() {
712 4222 jaume
                                public void mouseReleased(MouseEvent e) {
713 6115 jaume
                                        refreshData();
714 4222 jaume
                                }
715
                        });
716 3746 jaume
                }
717
718
                return lstSelectedLayers;
719
        }
720 6115 jaume
721 3746 jaume
        /**
722
         * This method initializes lstSRSs
723
         *
724 6122 jaume
         * @return JList
725 3746 jaume
         */
726 6122 jaume
        public JList getLstSRSs() {
727 3746 jaume
                if (lstSRSs == null) {
728 6122 jaume
                        lstSRSs = new JList();
729 3746 jaume
                        lstSRSs.setModel(new SRSListModel());
730 6500 jaume
                        lstSRSs
731
                                        .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
732
                        lstSRSs
733
                                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
734
                                                public void valueChanged(
735
                                                                javax.swing.event.ListSelectionEvent e) {
736
                                                        int i = lstSRSs.getSelectedIndex();
737
                                                        if (i != -1)
738
                                                                oldSRS = (String) lstSRSs.getModel()
739
                                                                                .getElementAt(i);
740
                                                        fireWizardComplete(isCorrectlyConfigured());
741
                                                }
742
                                        });
743 3746 jaume
                }
744
745
                return lstSRSs;
746
        }
747
748
        /**
749 4222 jaume
         * This method initializes lstFormats
750 3746 jaume
         *
751 6122 jaume
         * @return List
752 3746 jaume
         */
753 6122 jaume
        public JList getLstFormats() {
754 3746 jaume
                if (lstFormats == null) {
755 6122 jaume
                        lstFormats = new JList();
756 6500 jaume
                        lstFormats
757
                                        .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
758
                        lstFormats
759
                                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
760
                                                public void valueChanged(
761
                                                                javax.swing.event.ListSelectionEvent e) {
762
                                                        fireWizardComplete(isCorrectlyConfigured());
763
                                                }
764
                                        });
765 3746 jaume
                }
766
767
                return lstFormats;
768
        }
769
770
        /**
771 4222 jaume
         * Refreshes the SRS list
772 3746 jaume
         */
773
        private void refreshSRS() {
774 6500 jaume
                ArrayList elements = ((JDnDListModel) lstSelectedLayers.getModel())
775
                                .getElements();
776
                WMSLayerNode[] layers = (WMSLayerNode[]) elements
777
                                .toArray(new WMSLayerNode[0]);
778 3746 jaume
779 6115 jaume
                SRSListModel model = new SRSListModel();
780
781 3746 jaume
                if (layers.length == 0) {
782 6500 jaume
                        lstSRSs.setModel(model);// new DefaultListModel());
783 4222 jaume
                        sizeFixed = null;
784 3746 jaume
                } else {
785
                        TreeSet srsSet = new TreeSet();
786
                        srsSet.addAll(layers[0].getAllSrs());
787 4222 jaume
                        model.setAll(srsSet);
788
                        for (int i = 1; i < layers.length; i++) {
789
                                model.setAll(model.intersect(layers[i].getAllSrs()));
790 3746 jaume
                        }
791
                        lstSRSs.setModel(model);
792
                }
793 6500 jaume
                int srsIndex = getSRSIndex(oldSRS);
794
                if (srsIndex != -1)
795
                        getLstSRSs().setSelectedIndex(srsIndex);
796 6115 jaume
797 3746 jaume
        }
798
799
        public void setListenerSupport(WizardListenerSupport support) {
800
                listenerSupport = support;
801
        }
802
803
        public void setWizardData(WMSWizardData data) {
804
                this.dataSource = data;
805
                ((JDnDListModel) getLstSelectedLayers().getModel()).clear();
806
                getLstSelectedLayers().repaint();
807 6115 jaume
808 6500 jaume
                getLstFormats().setModel(
809
                                new FormatListModel(this.dataSource.getFormats()));
810
                getTreeLayers()
811
                                .setModel(new LayerTreeModel(this.dataSource.getLayer()));
812
                refreshInfo();
813 3746 jaume
        }
814 6115 jaume
815 6500 jaume
        private Vector getStyleTitles() {
816
                return getTabStyle().getStyleTree().getStyleSelectionTitles();
817
        }
818 3746 jaume
819 6500 jaume
        /**
820
         * @return
821
         */
822
        private Vector selectedLayersVector() {
823
                JDnDListModel mod = (JDnDListModel) getLstSelectedLayers().getModel();
824
                Vector lyrs = new Vector();
825
                for (int i = 0; i < mod.getSize(); i++) {
826
                        lyrs.add(mod.getElementAt(i));
827
                }
828
                return lyrs;
829
        }
830 3746 jaume
831 6500 jaume
        public String getFormat() {
832 3746 jaume
                return (String) getLstFormats().getSelectedValue();
833
        }
834
835
        public String getLayersQuery() {
836 6500 jaume
                ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel())
837
                                .getElements();
838
                WMSLayerNode[] layers = (WMSLayerNode[]) elements
839
                                .toArray(new WMSLayerNode[0]);
840 6115 jaume
841 6500 jaume
                // Nombre separado por comas de las capas
842
                String layersQuery = layers[layers.length - 1].getName();
843 3746 jaume
844 6500 jaume
                for (int i = layers.length - 2; i >= 0; i--) {
845 3746 jaume
                        layersQuery += ("," + layers[i].getName());
846
                }
847
848
                return layersQuery;
849 6115 jaume
850 3746 jaume
        }
851
852 4222 jaume
        /**
853
         * Returns the current selected SRS.
854 6500 jaume
         *
855 4222 jaume
         * @return
856
         */
857 3746 jaume
        public String getSRS() {
858
                return (String) getLstSRSs().getSelectedValue();
859
        }
860
861 4222 jaume
        /**
862 6115 jaume
         * Returns the name of the layer that the user has typed-in
863 6500 jaume
         *
864 4222 jaume
         * @return
865
         */
866 3746 jaume
        public String getLayerName() {
867 6115 jaume
                return getJTxtNomCapa().getText();
868 3746 jaume
        }
869 6115 jaume
870 4222 jaume
        public void setLayerName(String name) {
871 6115 jaume
                getJTxtNomCapa().setText(name);
872 4222 jaume
        }
873 6115 jaume
874 6500 jaume
        public Rectangle2D getLayersRectangle() throws CannotReprojectException {
875
                ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel())
876
                                .getElements();
877
                WMSLayerNode[] layers = (WMSLayerNode[]) elements
878
                                .toArray(new WMSLayerNode[0]);
879
                String[] layerNames = new String[layers.length];
880
                for (int i = 0; i < layerNames.length; i++) {
881
                        layerNames[i] = layers[i].getName();
882
                }
883
                // Boundingbox de todas las capas
884
                // ArrayList rectangulos = new ArrayList();
885 6115 jaume
886 6500 jaume
                Rectangle2D rect;
887
                String latLonID;
888 6115 jaume
889 6500 jaume
                rect = dataSource.getBoundingBox(layerNames, getSRS());
890
                if (rect == null) {
891
                        latLonID = "EPSG:4326";
892
                        rect = dataSource.getBoundingBox(layerNames, latLonID);
893
                        if (rect == null) {
894
                                rect = dataSource.getBoundingBox(layerNames, "CRS:84");
895
                        }
896 6115 jaume
897 7703 luisw2
                        IProjection reqProj = CRSFactory.getCRS(getSRS());
898
                        IProjection latLonProj = CRSFactory.getCRS(latLonID);
899 6500 jaume
                        if ((reqProj != null) && (latLonProj != null)) {
900
                                ICoordTrans ct = latLonProj.getCT(reqProj);
901
                                Rectangle2D reprojectedRect;
902
                                reprojectedRect = ct.convert(rect);
903
                                rect = reprojectedRect;
904
                        } else {
905
                                throw new CannotReprojectException(PluginServices.getText(this,
906
                                                "cannotReproject")
907
                                                + " " + getSRS() + " -> " + latLonID);
908
                        }
909
                }
910 6115 jaume
911 6500 jaume
                return rect;
912
        }
913 6115 jaume
914 3746 jaume
        public TreePath[] getSelectedLayers() {
915
                return getTreeLayers().getSelectionPaths();
916
        }
917 6115 jaume
918 4222 jaume
        public Hashtable getOnlineResources() {
919
                return dataSource.getOnlineResources();
920 3746 jaume
        }
921
922 6500 jaume
        /**
923
         * The piece of the GetMap request that has the layer names.
924
         *
925
         * @return
926
         */
927 3746 jaume
        public String getQueryableLayerQuery() {
928 6500 jaume
                ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel())
929
                                .getElements();
930
                WMSLayerNode[] layers = (WMSLayerNode[]) elements
931
                                .toArray(new WMSLayerNode[0]);
932
                // Nombre separado por comas de las capas
933 3746 jaume
                String layersQuery = "";
934
                int i;
935
936
                for (i = 0; i < layers.length; i++) {
937
                        if (layers[i].isQueryable()) {
938
                                layersQuery = layers[i].getName();
939
940
                                break;
941
                        }
942
                }
943
944
                for (int j = i + 1; j < layers.length; j++) {
945
                        if (layers[j].isQueryable()) {
946
                                layersQuery += ("," + layers[j].getName());
947
                        }
948
                }
949
950
                return layersQuery;
951
        }
952
953
        /**
954
         * Returns the index of the CRS within the CRS list.
955 6115 jaume
         *
956 3746 jaume
         * Devuelve la posicion que ocupa el CRS en la lista de CRS
957 6115 jaume
         *
958 3746 jaume
         * @param crs
959
         * @return The CRS's index if it exists, -1 if it not exists.
960
         */
961
        public int getSRSIndex(String crs) {
962 6500 jaume
                for (int i = 0; i < getLstSRSs().getModel().getSize(); i++) {
963
                        if (crs != null
964
                                        && crs.equals(getLstSRSs().getModel().getElementAt(i)))
965 3746 jaume
                                return i;
966
                }
967
                return -1;
968
        }
969 6115 jaume
970 3746 jaume
        /**
971
         * Returns the index of the format within the formats list.
972 6115 jaume
         *
973 3746 jaume
         * Devuelve la posicion que ocupa el formato en la lista de formatos
974 6500 jaume
         *
975 3746 jaume
         * @param format
976 6115 jaume
         *
977 3746 jaume
         * @return The format's index if it exists, -1 if it not exists.
978
         */
979
        public int getFormatIndex(String format) {
980 6500 jaume
                for (int i = 0; i < getLstFormats().getModel().getSize(); i++) {
981
                        if (format != null
982
                                        && format
983
                                                        .equals(getLstFormats().getModel().getElementAt(i)))
984 3746 jaume
                                return i;
985
                }
986
                return -1;
987
        }
988
989
        /**
990 6115 jaume
         * This method initializes jTabbedPane
991
         *
992 6122 jaume
         * @return TabbedPane
993 6115 jaume
         */
994 3746 jaume
        public JTabbedPane getJTabbedPane() {
995
                if (jTabbedPane == null) {
996
                        jTabbedPane = new JTabbedPane();
997 6500 jaume
                        jTabbedPane.setBounds(4, 4, 502, 415);
998
                        InfoPanel ip = getTabInfo();
999
                        ip.addFocusListener(new FocusListener() {
1000
                                public void focusGained(FocusEvent e) {
1001
                                        refreshInfo();
1002
                                }
1003 6115 jaume
1004 6500 jaume
                                public void focusLost(FocusEvent e) {
1005
                                }
1006
                        });
1007 6115 jaume
1008 6500 jaume
                        StylesPanel sp = getTabStyle();
1009
                        DimensionPanel dp = getTabDimensions();
1010 6115 jaume
1011 6500 jaume
                        jTabbedPane.addTab(PluginServices.getText(this, "info"), null, ip,
1012
                                        null);
1013
                        jTabbedPane.addTab(PluginServices.getText(this, "capas"), null,
1014
                                        getTabLayers(), null);
1015
                        jTabbedPane.addTab(PluginServices.getText(this, "estilos"), null,
1016
                                        sp, null);
1017
                        stylesTabIndex = jTabbedPane.getTabCount() - 1;
1018
                        jTabbedPane.addTab(PluginServices.getText(this, "dimensiones"),
1019
                                        null, dp, null);
1020
                        dimensionTabIndex = jTabbedPane.getTabCount() - 1;
1021
                        jTabbedPane.addTab(PluginServices.getText(this, "formatos"), null,
1022
                                        getTabFormats(), null);
1023
                        jTabbedPane.setEnabledAt(dimensionTabIndex, false);
1024
                        jTabbedPane.setEnabledAt(stylesTabIndex, false);
1025 3746 jaume
                }
1026
                return jTabbedPane;
1027
        }
1028
1029
        /**
1030 6115 jaume
         * This method initializes jPanel
1031
         *
1032 6122 jaume
         * @return Panel
1033 6115 jaume
         */
1034 3746 jaume
        private JPanel getTabLayers() {
1035
                if (tabLayers == null) {
1036
                        tabLayers = new JPanel();
1037
                        tabLayers.setLayout(null);
1038
                        tabLayers.add(getJPanel4(), null);
1039
                        tabLayers.add(getJPanel2(), null);
1040
                }
1041
                return tabLayers;
1042
        }
1043
1044
        /**
1045 6115 jaume
         * This method initializes jPanel1
1046
         *
1047 6122 jaume
         * @return Panel
1048 6115 jaume
         */
1049 3746 jaume
        private JPanel getJPanel1() {
1050
                if (jPanel1 == null) {
1051
                        jPanel1 = new JPanel();
1052
                        jPanel1.setLayout(null);
1053 6500 jaume
                        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(
1054
                                        null, PluginServices.getText(this, "select_formats"),
1055
                                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
1056
                                        javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
1057
                                        null));
1058
                        jPanel1.setBounds(5, 10, 485, 194);
1059 3746 jaume
                        jPanel1.add(getJScrollPane6(), null);
1060
                        jPanel1.add(getChkTransparency(), null);
1061
                }
1062
                return jPanel1;
1063
        }
1064
1065
        /**
1066 6115 jaume
         * This method initializes jPanel5
1067
         *
1068 6122 jaume
         * @return Panel
1069 6115 jaume
         */
1070 3746 jaume
        private JPanel getJPanel5() {
1071
                if (jPanel5 == null) {
1072
                        jPanel5 = new JPanel();
1073
                        jPanel5.setLayout(null);
1074 6500 jaume
                        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(
1075
                                        null, PluginServices.getText(this, "seleccionar_srs"),
1076
                                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
1077
                                        javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
1078
                                        null));
1079
                        jPanel5.setBounds(5, 205, 485, 173);
1080 3746 jaume
                        jPanel5.add(getJScrollPane2(), null);
1081
                }
1082
                return jPanel5;
1083
        }
1084
1085
        /**
1086 6115 jaume
         * This method initializes jPanel6
1087
         *
1088 6122 jaume
         * @return Panel
1089 6115 jaume
         */
1090 3746 jaume
        private StylesPanel getTabStyle() {
1091
                if (tabStyle == null) {
1092 4222 jaume
                        tabStyle = new StylesPanel(this);
1093 6500 jaume
                        tabStyle.setEnabled(false);
1094
                        tabStyle.addListener(new BeanListener() {
1095
                                public void beanValueChanged(Object value) {
1096
                                        fireWizardComplete(isCorrectlyConfigured());
1097
                                };
1098
                        });
1099
                        tabStyle.addFocusListener(new FocusAdapter() {
1100
                                public void focusGained(FocusEvent e) {
1101
                                        refreshStyleTree();
1102
                                }
1103
                        });
1104 3746 jaume
                }
1105
                return tabStyle;
1106
        }
1107 6115 jaume
1108 3746 jaume
        /**
1109
         * Sets the focus to the tab next to the current one.
1110 6115 jaume
         *
1111 3746 jaume
         * Enfoca a la solapa siguiente a la actualmente enfocada del TabbedPane
1112
         *
1113
         */
1114 6500 jaume
        public void avanzaTab() {
1115 3746 jaume
                int currentPage = currentPage();
1116
                int nPages = getNumTabs();
1117 6500 jaume
                if (nPages - 1 > currentPage) {
1118 3746 jaume
                        getJTabbedPane().setSelectedIndex(nextEnabledPage());
1119
                }
1120
        }
1121 6115 jaume
1122 3746 jaume
        /**
1123 6115 jaume
         * Sets the focus to the tab previous to the current one.
1124
         *
1125 3746 jaume
         * Enfoca a la solapa anterior a la actualmente enfocada del TabbedPane
1126 6115 jaume
         *
1127 3746 jaume
         */
1128 6500 jaume
        public void retrocedeTab() {
1129 3746 jaume
                this.getJTabbedPane().setSelectedIndex(previousEnabledPage());
1130 6115 jaume
1131 3746 jaume
        }
1132 6115 jaume
1133 3746 jaume
        /**
1134 6500 jaume
         * Returns the index of the current tab.
1135
         *
1136
         * Devuelve el ?ndice de la p?gina actual del wizard.
1137
         *
1138
         * @return
1139
         */
1140
        public int currentPage() {
1141
                return getJTabbedPane().getSelectedIndex();
1142
        }
1143
1144
        /**
1145 3746 jaume
         * Returns the tab amount that the WMSParamsPanel currently have
1146 6115 jaume
         *
1147 4222 jaume
         * Devuelve el n?mero de solapas que tiene actualmente el WMSParamsPanel
1148 6115 jaume
         *
1149 3746 jaume
         * @return int
1150
         */
1151 6500 jaume
        public int getNumTabs() {
1152 3746 jaume
                return getJTabbedPane().getTabCount();
1153
        }
1154 6115 jaume
1155 3746 jaume
        /**
1156 6500 jaume
         * <p>
1157
         * Returns the index of the previous enabled tab.
1158
         * </p>
1159
         * <p>
1160
         * Devuelve el ?ndice de la anterior p?gina habilitada del wizard o -1
1161
         * si no hay ninguna.
1162
         * </p>
1163
         *
1164
         * @return The index, or -1 if there is no one.
1165
         */
1166
        public int previousEnabledPage() {
1167
                int currentPage = currentPage();
1168
                int j = 0;
1169
                if (currentPage == 0)
1170
                        j = -1;
1171
                for (int i = currentPage - 1; i > -1; i--) {
1172
                        if (getJTabbedPane().isEnabledAt(i)) {
1173
                                j = i;
1174
                                break;
1175
                        }
1176
                }
1177
                return j;
1178
        }
1179 6115 jaume
1180 6500 jaume
        /**
1181
         * <p>
1182
         * Returns the previous of the previous enabled tab.
1183
         * </p>
1184
         * <p>
1185
         * Devuelve el ?ndice de la siguiente p?gina habilitada del wizard o -1
1186
         * si no hay ninguna.
1187
         * </p>
1188
         *
1189
         * @return The index, or -1 if there is no one.
1190
         */
1191
        public int nextEnabledPage() {
1192
                int currentPage = currentPage();
1193
                int nPages = getNumTabs();
1194
                if (currentPage == nPages)
1195
                        return -1;
1196
                for (int i = currentPage + 1; i < nPages; i++) {
1197
                        if (getJTabbedPane().isEnabledAt(i)) {
1198
                                return i;
1199
                        }
1200
                }
1201
                return -1;
1202
        }
1203 6115 jaume
1204 6500 jaume
        /**
1205
         * Selects/deselects the transparency checkbox.
1206
         *
1207
         * @param b
1208
         */
1209
        public void setTransparent(boolean b) {
1210
                getChkTransparency().setSelected(b);
1211
        }
1212 6115 jaume
1213 6500 jaume
        /**
1214
         * This method initializes chkTrasparency
1215
         *
1216
         * @return CheckBox
1217
         */
1218
        private JCheckBox getChkTransparency() {
1219
                if (chkTransparency == null) {
1220
                        chkTransparency = new JCheckBox();
1221
                        chkTransparency.setText(PluginServices.getText(this,
1222
                                        "wms_transparency"));
1223
                        chkTransparency.setSelected(true);
1224
                        chkTransparency.addItemListener(new java.awt.event.ItemListener() {
1225
                                public void itemStateChanged(java.awt.event.ItemEvent e) {
1226
                                        fireWizardComplete(isCorrectlyConfigured());
1227
                                }
1228
                        });
1229
                        chkTransparency.setBounds(5, 168, 441, 21);
1230 6115 jaume
1231 6500 jaume
                }
1232
                return chkTransparency;
1233
        }
1234
1235
        /**
1236
         * Returns a vector of strings containing the styles selected for the
1237
         * layers. A blank style is correct and means that default style will be
1238
         * used.
1239
         *
1240
         * @return Vector
1241
         */
1242
        public Vector getStyles() {
1243
                Vector v = new Vector();
1244
                WMSLayerNode[] layers = selectedLayersToArray();
1245
                for (int i = 0; i < layers.length; i++) {
1246 4222 jaume
                        FMapWMSStyle sty = layers[i].getSelectedStyle();
1247 6500 jaume
                        String s = (sty != null) ? sty.name : "";
1248 4222 jaume
                        v.add(s);
1249
                }
1250 6500 jaume
                return v;
1251
        }
1252 6115 jaume
1253 6500 jaume
        public Vector getLayerStyle(String layerName) {
1254
                Vector v = new Vector();
1255
                WMSLayerNode[] layers = selectedLayersToArray();
1256
                for (int i = 0; i < layers.length; i++) {
1257
                        if (layers[i].getName().equalsIgnoreCase(layerName)) {
1258
                                FMapWMSStyle sty = layers[i].getSelectedStyle();
1259
                                String s = (sty != null) ? sty.name : "";
1260
                                v.add(s);
1261
                                return v;
1262
                        }
1263 5518 ldiaz
                }
1264 6500 jaume
                return v;
1265
        }
1266 6115 jaume
1267 6500 jaume
        /**
1268
         * This method initializes tabInfo
1269
         *
1270
         * @return Panel
1271
         */
1272
        private InfoPanel getTabInfo() {
1273
                if (tabInfo == null) {
1274
                        tabInfo = new InfoPanel();
1275 6115 jaume
1276 6500 jaume
                }
1277
                return tabInfo;
1278
        }
1279 3746 jaume
1280 6500 jaume
        public void setDimensions(Vector dimensions) {
1281
                for (int i = 0; i < dimensions.size(); i++) {
1282
                        String st = (String) dimensions.get(i);
1283
                        if (st.split("=").length == 2) {
1284
                                String[] s = st.split("=");
1285
                                getTabDimensions().setDimensionValue(s[0], s[1]);
1286
                        }
1287 3746 jaume
                }
1288 6115 jaume
1289 6500 jaume
        }
1290 3746 jaume
1291 6500 jaume
        /**
1292
         * This method initializes tabDimension
1293
         *
1294
         * @return Panel
1295
         */
1296
        private DimensionPanel getTabDimensions() {
1297
                if (tabDimensions == null) {
1298
                        tabDimensions = new DimensionPanel();
1299
                        tabDimensions.setEnabled(false);
1300
                        tabDimensions.addListener(new BeanListener() {
1301
                                public void beanValueChanged(Object value) {
1302
                                        Vector myDimensions = (Vector) value;
1303
                                        if (value != null
1304
                                                        && (oldDimensions == null || !(oldDimensions.size() == myDimensions
1305
                                                                        .size() && oldDimensions
1306
                                                                        .containsAll(myDimensions)))) {
1307
                                                oldDimensions = myDimensions;
1308
                                        }
1309
                                        fireWizardComplete(isCorrectlyConfigured());
1310
                                }
1311
                        });
1312 6115 jaume
1313 6500 jaume
                }
1314
                return tabDimensions;
1315
        }
1316 3746 jaume
1317 6500 jaume
        /**
1318
         * @return
1319
         */
1320
        public boolean getTransparency() {
1321
                return getChkTransparency().isSelected();
1322
        }
1323 3746 jaume
1324 6500 jaume
        /**
1325
         * @return
1326
         */
1327
        public Vector getDimensions() {
1328
                return getTabDimensions().getDimensions();
1329
        }
1330 3746 jaume
1331 6500 jaume
        public void initWizard() {
1332
        }
1333 6115 jaume
1334 6500 jaume
        public void execute() {
1335
        }
1336
1337
        // Gets all the layers available in the WMS Server
1338
        protected FLayer getAllSubTree(WMSLayerNode node) {
1339
                if (node.getChildren().size() > 0) {
1340 6434 ldiaz
                        FLayers l = null;
1341 6500 jaume
                        if (this.getMapCtrl() == null) {
1342 9536 jcampos
//                                com.iver.cit.gvsig.project.documents.view.gui.View v = (com.iver.cit.gvsig.project.documents.view.gui.View) PluginServices
1343
//                                                .getMDIManager().getActiveWindow();
1344
                                BaseView v = (BaseView) PluginServices.getMDIManager().getActiveWindow();
1345 6434 ldiaz
                                l = new FLayers(v.getMapControl().getMapContext(), null);
1346 6500 jaume
                        } else {
1347 6434 ldiaz
                                l = new FLayers(this.getMapCtrl().getMapContext(), null);
1348
                        }
1349
1350 6500 jaume
                        l.setName(node.getTitle());
1351
                        l.setVisible(false);
1352
                        for (int i = 0; i < node.getChildren().size(); i++) {
1353
                                FLayer lyr = getAllSubTree((WMSLayerNode) node.getChildren()
1354
                                                .get(i));
1355
                                if (lyr != null) {
1356 6434 ldiaz
                                        l.addLayer(lyr);
1357
                                }
1358
                        }
1359
                        return l;
1360 6500 jaume
                } else {
1361 6434 ldiaz
                        FLyrWMS layer = new FLyrWMS();
1362
                        try {
1363
                                layer.setHost(new URL(dataSource.getHost()));
1364
                                layer.setFullExtent(getLayersRectangle());
1365
                        } catch (CannotReprojectException e) {
1366
                                e.printStackTrace();
1367
                                return null;
1368
                        } catch (MalformedURLException e) {
1369
                                e.printStackTrace();
1370
                                return null;
1371
                        }
1372
                        layer.setFormat(getFormat());
1373
                        layer.setLayerQuery(node.getName());
1374 6500 jaume
                        layer.setInfoLayerQuery(getQueryableLayerQuery());
1375
                        layer.setSRS(getSRS());
1376
                        layer.setName(node.getTitle());
1377
                        layer.setWmsTransparency(getTransparency());
1378
                        layer.setStyles(getLayerStyle(node.getName()));
1379
                        layer.setDimensions(getDimensions());
1380
                        layer.setDriver(getDriver());
1381
                        layer.setOnlineResources(getOnlineResources());
1382
                        layer.setFixedSize(getFixedSize());
1383
                        layer.setQueryable(dataSource.isQueryable());
1384
                        layer.setVisible(false);
1385
                        return layer;
1386 6434 ldiaz
                }
1387
        }
1388 6500 jaume
1389
        // Gets all the layers available in the WMS Server
1390
        public FLayer getAllLayers() {
1391
                LayerTree layerTree = getLayerStructure();
1392
                return getAllSubTree((WMSLayerNode) layerTree.getModel().getRoot());
1393 6434 ldiaz
        }
1394 6500 jaume
1395
        // changed by Laura:
1396
        // To delegate getLayer to ParamsPanel from WMSWizard and WMSProps
1397
        // public FLayer getLayer() { return null; }
1398
        public FLayer getLayer() {
1399
                if (getDisagregatedLayers()) {
1400 4947 ldiaz
                        return getLayerTree();
1401 6500 jaume
                } else {
1402 4947 ldiaz
                        return getLayerPlain();
1403 6115 jaume
                }
1404 4947 ldiaz
        }
1405 6500 jaume
1406 4947 ldiaz
        /**
1407 6500 jaume
         * If user does not select the chekbox Disagregate layers, will get the
1408
         * layer tree in WMS
1409
         *
1410 4947 ldiaz
         * @return
1411
         */
1412 6500 jaume
        protected FLayer getLayerTree() {
1413
                LayerTree layerTree = getLayerStructure();
1414
                TreePath[] selection = (TreePath[]) getSelectedPaths().toArray(
1415
                                new TreePath[0]);// layerTree.getSelectionPaths();
1416
                if (selection != null) {
1417
                        return getSubTree((WMSLayerNode) layerTree.getModel().getRoot(),
1418
                                        selection);
1419 6115 jaume
                }
1420 4947 ldiaz
                return null;
1421 6500 jaume
        }
1422 6115 jaume
1423 6500 jaume
        protected boolean nodeSelected(TreePath[] selection, WMSLayerNode node) {
1424 6115 jaume
                for (int i = 0; i < selection.length; i++) {
1425 4947 ldiaz
                        Object[] components = selection[i].getPath();
1426 6500 jaume
                        for (int j = 0; j < components.length; j++) {
1427
                                if (components[j] instanceof WMSLayerNode) {
1428
                                        if (((WMSLayerNode) components[j]).getTitle().compareTo(
1429
                                                        node.getTitle()) == 0) {
1430 4947 ldiaz
                                                return true;
1431
                                        }
1432
                                }
1433 6115 jaume
                        }
1434
                }
1435 4947 ldiaz
                return false;
1436 6500 jaume
        }
1437 6115 jaume
1438 6500 jaume
        protected FLayer getSubTree(WMSLayerNode node, TreePath[] selection) {
1439
                if (node.getChildren().size() > 0) {
1440 4947 ldiaz
                        FLayers l = null;
1441 6500 jaume
                        if (this.getMapCtrl() == null) {
1442 9536 jcampos
//                                com.iver.cit.gvsig.project.documents.view.gui.View v = (com.iver.cit.gvsig.project.documents.view.gui.View) PluginServices
1443
//                                                .getMDIManager().getActiveWindow();
1444
                                BaseView v = (BaseView) PluginServices.getMDIManager().getActiveWindow();
1445 4947 ldiaz
                                l = new FLayers(v.getMapControl().getMapContext(), null);
1446 6500 jaume
                        } else {
1447 4947 ldiaz
                                l = new FLayers(this.getMapCtrl().getMapContext(), null);
1448
                        }
1449 6115 jaume
1450 6500 jaume
                        l.setName(node.getTitle());
1451
                        for (int i = 0; i < node.getChildren().size(); i++) {
1452
                                if (nodeSelected(selection, (WMSLayerNode) (node.getChildren()
1453
                                                .get(i)))) {
1454
                                        FLayer lyr = getSubTree((WMSLayerNode) node.getChildren()
1455
                                                        .get(i), selection);
1456
                                        if (lyr != null) {
1457 4947 ldiaz
                                                l.addLayer(lyr);
1458
                                        }
1459
                                }
1460
                        }
1461
                        return l;
1462 6500 jaume
                } else {
1463
                        if (nodeSelected(selection, node)) {
1464 4947 ldiaz
                                FLyrWMS layer = new FLyrWMS();
1465 6500 jaume
                                // layer.setHost(getHost());
1466 4947 ldiaz
                                try {
1467
                                        layer.setHost(new URL(dataSource.getHost()));
1468 6115 jaume
                                        layer.setFullExtent(getLayersRectangle());
1469
                                } catch (CannotReprojectException e) {
1470 4947 ldiaz
                                        e.printStackTrace();
1471
                                        return null;
1472 6115 jaume
                                } catch (MalformedURLException e) {
1473 4947 ldiaz
                                        e.printStackTrace();
1474
                                        return null;
1475 6115 jaume
                                }
1476 4947 ldiaz
                                layer.setFormat(getFormat());
1477
                                layer.setLayerQuery(node.getName());
1478 6500 jaume
                                layer.setInfoLayerQuery(getQueryableLayerQuery());
1479
                                layer.setSRS(getSRS());
1480
                                layer.setName(node.getTitle());
1481
                                layer.setWmsTransparency(getTransparency());
1482
                                layer.setStyles(getLayerStyle(node.getName()));
1483
                                layer.setDimensions(getDimensions());
1484
                                layer.setDriver(getDriver());
1485 8765 jjdelcerro
                                layer.setOnlineResources(getDriver().getOnlineResources());
1486 6500 jaume
                                layer.setFixedSize(getFixedSize());
1487 8765 jjdelcerro
                                layer.setQueryable(node.isQueryable());
1488
                                //layer.setQueryable(dataSource.isQueryable());
1489 6500 jaume
                                return layer;
1490 6115 jaume
1491 6500 jaume
                        } else {
1492 4947 ldiaz
                                return null;
1493 6115 jaume
                        }
1494
                }
1495
        }
1496 3746 jaume
1497 4947 ldiaz
        /**
1498 6500 jaume
         * If user selects the chekbox Disagregate layers, will get the selected
1499
         * layers rendered in one the tree structure in WMS will be lost.
1500
         *
1501 4947 ldiaz
         * @return
1502
         */
1503 6500 jaume
        protected FLayer getLayerPlain() {
1504
                FLyrWMS layer = new FLyrWMS();
1505
                // layer.setHost(getHost());
1506
                try {
1507
                        layer.setFullExtent(getLayersRectangle());
1508
                        layer.setHost(new URL(dataSource.getHost()));
1509
                } catch (CannotReprojectException ex) {
1510
                        ex.printStackTrace();
1511
                        JOptionPane.showMessageDialog((Component) PluginServices
1512
                                        .getMainFrame(), ex.getMessage());
1513
                        return null;
1514
                } catch (MalformedURLException e) {
1515 4947 ldiaz
                        e.printStackTrace();
1516
                        return null;
1517
                }
1518 6500 jaume
                layer.setFormat(getFormat());
1519
                layer.setLayerQuery(getLayersQuery());
1520
                layer.setInfoLayerQuery(getQueryableLayerQuery());
1521
                layer.setSRS(getSRS());
1522
                layer.setName(getLayerName());
1523
                layer.setWmsTransparency(getTransparency());
1524
                layer.setStyles(getStyles());
1525
                layer.setDimensions(getDimensions());
1526
                layer.setDriver(getDriver());
1527 8765 jjdelcerro
                layer.setOnlineResources(getDriver().getOnlineResources());
1528 6500 jaume
                layer.setFixedSize(getFixedSize());
1529 8765 jjdelcerro
                //layer.setQueryable(node.isQueryable());
1530 6500 jaume
                layer.setQueryable(dataSource.isQueryable());
1531
                return layer;
1532
        }
1533 6115 jaume
1534 6500 jaume
        // ---------------------
1535
1536 3746 jaume
        public FMapWMSDriver getDriver() {
1537
                return dataSource.getDriver();
1538
        }
1539
1540 4222 jaume
        public Dimension getFixedSize() {
1541
                return sizeFixed;
1542
        }
1543 3746 jaume
1544 4222 jaume
        /**
1545 6115 jaume
         * This method initializes chkExtendedNames
1546
         *
1547 6122 jaume
         * @return CheckBox
1548 6115 jaume
         */
1549 4222 jaume
        private JCheckBox getChkExtendedNames() {
1550
                if (chkExtendedNames == null) {
1551
                        chkExtendedNames = new JCheckBox();
1552 6500 jaume
                        chkExtendedNames.setText(PluginServices.getText(this,
1553
                                        "show_layer_names"));
1554 6115 jaume
                        chkExtendedNames.addItemListener(new java.awt.event.ItemListener() {
1555 4222 jaume
                                public void itemStateChanged(java.awt.event.ItemEvent e) {
1556
                                        boolean b = chkExtendedNames.isSelected();
1557
                                        getTreeLayers().showLayerNames = b;
1558
                                        getTreeLayers().repaint();
1559
                                        getLstSelectedLayers().showLayerNames = b;
1560
                                        getLstSelectedLayers().repaint();
1561
                                        getStyleTree().showLayerNames = b;
1562
                                }
1563
                        });
1564 6500 jaume
                        chkExtendedNames
1565
                                        .addActionListener(new java.awt.event.ActionListener() {
1566
                                                public void actionPerformed(java.awt.event.ActionEvent e) {
1567
                                                        fPrefs.putBoolean("show_layer_names",
1568
                                                                        chkExtendedNames.isSelected());
1569
                                                }
1570
                                        });
1571 7067 jaume
                        chkExtendedNames.setBounds(19, 300, 212, 20);
1572 6500 jaume
                        chkExtendedNames.setSelected(fPrefs.getBoolean("show_layer_names",
1573
                                        false));
1574 6115 jaume
1575 4222 jaume
                }
1576
                return chkExtendedNames;
1577
        }
1578
1579
        /**
1580 6115 jaume
         * This method initializes btnUp
1581
         *
1582 6122 jaume
         * @return Button
1583 6115 jaume
         */
1584 4222 jaume
        private JButton getBtnUp() {
1585
                if (btnUp == null) {
1586
                        btnUp = new JButton();
1587 6500 jaume
                        btnUp.setBounds(438, 184, 30, 30);
1588 4222 jaume
                        btnUp.setToolTipText(PluginServices.getText(this, "move_layer_up"));
1589 6115 jaume
                        btnUp.addActionListener(new java.awt.event.ActionListener() {
1590 4222 jaume
                                public void actionPerformed(java.awt.event.ActionEvent e) {
1591
                                        LayerList list = getLstSelectedLayers();
1592
                                        int[] selectedIndices = list.getSelectedIndices();
1593
                                        int index = list.getSelectedIndex();
1594 6500 jaume
                                        if (selectedIndices != null && selectedIndices.length == 1
1595
                                                        && index > 0) {
1596 4222 jaume
                                                JDnDListModel m = (JDnDListModel) list.getModel();
1597 6500 jaume
                                                m.itemsMoved(index - 1, new int[] { index });
1598 4222 jaume
                                                list.setSelectedIndex(index - 1);
1599
                                        }
1600
                                }
1601
                        });
1602 6500 jaume
                        btnUp.setIcon(new ImageIcon(getClass().getClassLoader()
1603
                                        .getResource("images/up-arrow.png")));
1604 4222 jaume
                }
1605
                return btnUp;
1606
        }
1607
1608
        /**
1609 6115 jaume
         * This method initializes btnDown
1610
         *
1611 6122 jaume
         * @return Button
1612 6115 jaume
         */
1613 4222 jaume
        private JButton getBtnDown() {
1614
                if (btnDown == null) {
1615
                        btnDown = new JButton();
1616 6500 jaume
                        btnDown.setBounds(438, 215, 30, 30);
1617
                        btnDown.setToolTipText(PluginServices.getText(this,
1618
                                        "move_layer_down"));
1619 6115 jaume
                        btnDown.addActionListener(new java.awt.event.ActionListener() {
1620 4222 jaume
                                public void actionPerformed(java.awt.event.ActionEvent e) {
1621
                                        LayerList list = getLstSelectedLayers();
1622
                                        int[] selectedIndices = list.getSelectedIndices();
1623
                                        int index = list.getSelectedIndex();
1624 6500 jaume
                                        if (selectedIndices != null
1625
                                                        && selectedIndices.length == 1
1626
                                                        && index < getLstSelectedLayers().getModel()
1627
                                                                        .getSize() - 1) {
1628 4222 jaume
                                                JDnDListModel m = (JDnDListModel) list.getModel();
1629 6500 jaume
                                                m.itemsMoved(index + 1, new int[] { index });
1630
                                                list.setSelectedIndex(index + 1);
1631 4222 jaume
                                        }
1632
                                }
1633
                        });
1634 6500 jaume
                        btnDown.setIcon(new ImageIcon(getClass().getClassLoader()
1635
                                        .getResource("images/down-arrow.png")));
1636 4222 jaume
                }
1637
                return btnDown;
1638
        }
1639
1640
        public void setFixedSize(Dimension sz) {
1641
                sizeFixed = sz;
1642
        }
1643 4449 ldiaz
1644 6500 jaume
        public ArrayList getSelectedPaths() {
1645 4473 ldiaz
                return selectedPaths;
1646
        }
1647 6115 jaume
1648 6500 jaume
        public LayerTree getJustTreeLayer() {
1649 4962 ldiaz
                return treeLayers;
1650
        }
1651
1652 4449 ldiaz
        /**
1653 6115 jaume
         * This method initializes chkDisagregate
1654
         *
1655 6122 jaume
         * @return CheckBox
1656 4449 ldiaz
         */
1657
        private JCheckBox getChkDisagregate() {
1658
                if (chkDisagregate == null) {
1659 6115 jaume
1660 4449 ldiaz
                        chkDisagregate = new JCheckBox();
1661 7067 jaume
                        chkDisagregate.setBounds(new java.awt.Rectangle(19,276,269,20));
1662 6500 jaume
                        chkDisagregate.setText(PluginServices.getText(this,
1663
                                        "disagregate_layers"));
1664 7643 jaume
                        chkDisagregate.setSelected(false);
1665 4962 ldiaz
1666 4449 ldiaz
                }
1667
                return chkDisagregate;
1668
        }
1669 6115 jaume
1670 6500 jaume
        public boolean getDisagregatedLayers() {
1671 6115 jaume
                return chkDisagregate.isSelected();
1672 4449 ldiaz
        }
1673 6500 jaume
1674
        public void disableDisagregatedLayers() {
1675 5518 ldiaz
                chkDisagregate.setEnabled(false);
1676
        }
1677 6500 jaume
} // @jve:decl-index=0:visual-constraint="10,10"