Statistics
| Revision:

gvsig-raster / org.gvsig.raster.app / trunk / org.gvsig.raster.app / org.gvsig.raster.app.wmtsclient / src / main / java / org / gvsig / raster / app / extension / wmtsclient / gui / panel / WMTSParamsPanel.java @ 218

History | View | Annotate | Download (37.1 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22
 
23
package org.gvsig.raster.app.extension.wmtsclient.gui.panel;
24

    
25
import java.awt.Dimension;
26
import java.awt.event.FocusAdapter;
27
import java.awt.event.FocusEvent;
28
import java.awt.event.FocusListener;
29
import java.awt.event.MouseAdapter;
30
import java.awt.event.MouseEvent;
31
import java.util.ArrayList;
32
import java.util.TreeSet;
33
import java.util.Vector;
34
import java.util.prefs.Preferences;
35

    
36
import javax.swing.JButton;
37
import javax.swing.JCheckBox;
38
import javax.swing.JList;
39
import javax.swing.JPanel;
40
import javax.swing.JScrollPane;
41
import javax.swing.JTabbedPane;
42
import javax.swing.JTextField;
43
import javax.swing.tree.TreePath;
44

    
45
import org.gvsig.andami.PluginServices;
46
import org.gvsig.app.gui.WizardPanel;
47
import org.gvsig.app.gui.wizards.WizardListenerSupport;
48
import org.gvsig.fmap.dal.DataStoreParameters;
49
import org.gvsig.fmap.dal.coverage.explorer.WMTSServerExplorer;
50
import org.gvsig.gui.beans.controls.dnd.JDnDListModel;
51
import org.gvsig.gui.beans.listeners.BeanListener;
52
import org.gvsig.raster.app.extension.wmtsclient.gui.wizard.LayerTreeModel;
53
import org.gvsig.raster.app.extension.wmtsclient.gui.wizard.SRSListModel;
54
import org.gvsig.remoteclient.wmts.struct.WMTSTheme;
55

    
56

    
57
/**
58
 * This class implements the map option panel.
59
 *
60
 * It includes a set of Listeners that implement some control rules which
61
 * refresh the component values that depends on those selected in the other
62
 * components to avoid to choose an invalid set of options. It also includes a
63
 * method (isCorrectlyConfigured()) that checks if the current set of values is
64
 * enough to correctly launch a GetMap request.
65
 *
66
 * The information is obtained from a WMSWizardDataSource object.
67
 *
68
 * @author Nacho Brodin (nachobrodin@gmail.com)
69
 */
70
@SuppressWarnings("unchecked")
71
public class WMTSParamsPanel extends WizardPanel {
72
        private static final long      serialVersionUID           = 1L;
73
        private JScrollPane            jScrollTreeLayers          = null;
74
        private JScrollPane            jScrollLstSrs              = null;
75
        private JScrollPane            jScrollLstSelectedLayers   = null;
76
        private JButton                btnAdd                     = null;
77
        private JButton                btnDel                     = null;
78
        private JPanel                 jPanel2                    = null;
79
        private JPanel                 tabFormats                 = null;
80
        private JPanel                 jPanel4                    = null;
81
        private JTextField             jTxtNomCapa                = null;
82
        private ArrayList<TreePath>    selectedPaths              = new ArrayList<TreePath>();
83
        private JList                  lstSRSs                    = null;
84
        private JScrollPane            jScrollImageFormats        = null;
85
        private JList                  lstImageFormats            = null;
86
        private JScrollPane            jScrollInfoFormats         = null;
87
        private JList                  lstInfoFormats             = null;
88
        private WizardListenerSupport  listenerSupport            = null;
89
        private JTabbedPane            jTabbedPane                = null;
90
        private JPanel                 tabLayers                  = null;
91
        private JPanel                 jPanelImageFormats         = null;
92
        private JPanel                 jPanelInfoFormats          = null;
93
        private JPanel                 jPanelLstSrs               = null;
94
        private StylesPanel            tabStyle                   = null;
95
        private JCheckBox              chkTransparency            = null;
96
        private InfoPanel              tabInfo                    = null;
97
        private int                    dimensionTabIndex;
98
        private int                    stylesTabIndex;
99
        private String                 oldSRS                     = null;
100
        private Dimension              sizeFixed                  = null;
101
        private JCheckBox              chkExtendedNames           = null;
102
        private JButton                btnUp                      = null;
103
        private JButton                btnDown                    = null;
104
        private LayerTree              treeLayers                 = null;
105
        private LayerList              lstSelectedLayers          = null;
106
        protected WMTSServerExplorer   explorer                   = null;
107
        public static Preferences      fPrefs                     = Preferences.userRoot().node("gvsig.wmts-wizard");
108
        private JCheckBox              chkDisagregate             = null;
109

    
110
        public WMTSParamsPanel() {
111
                super();
112
                initialize();
113
        }
114

    
115
        // TODO: crear nuevo constructor para a?adir los panels que quieras...
116
        public WMTSParamsPanel(WMTSServerExplorer data) {
117
                super();
118
                setWizardData(data);
119
                this.setLayout(null);
120
                this.setVisible(false);
121
                if (jTabbedPane == null) {
122
                        jTabbedPane = new JTabbedPane();
123
                        jTabbedPane.setBounds(4, 4, 502, 415);
124
                        StylesPanel sp = getTabStyle();
125

    
126
                        jTabbedPane.addTab(PluginServices.getText(this, "capas"), null, getTabLayers(), null);
127
                        jTabbedPane.addTab(PluginServices.getText(this, "estilos"), null, sp, null);
128
                        stylesTabIndex = jTabbedPane.getTabCount() - 1;
129
                        dimensionTabIndex = jTabbedPane.getTabCount() - 1;
130
                        jTabbedPane.addTab(PluginServices.getText(this, "formatos"), null, getTabFormats(), null);
131
                        jTabbedPane.setEnabledAt(dimensionTabIndex, false);
132
                        jTabbedPane.setEnabledAt(stylesTabIndex, false);
133
                }
134
                this.add(jTabbedPane, null);
135

    
136
                setListenerSupport(new WizardListenerSupport());
137
        }
138

    
139
        /**
140
         * This method initializes panelPage2
141
         *
142
         * @return Panel
143
         */
144
        private void initialize() {
145
                this.setLayout(null);
146
                this.setVisible(false);
147
                this.setBounds(0, 0, 510, 427);
148
                this.add(getJTabbedPane(), null);
149
        }
150

    
151
        /**
152
         * This method initializes jPanel2
153
         *
154
         * @return Panel
155
         */
156
        private JPanel getJPanel2() {
157
                if (jPanel2 == null) {
158
                        jPanel2 = new JPanel();
159
                        jPanel2.setLayout(null);
160
                        jPanel2.setBounds(5, 59, 485, 328);
161
                        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(
162
                                        null, PluginServices.getText(this, "select_layers"),
163
                                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
164
                                        javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
165
                                        null));
166
                        jPanel2.add(getChkExtendedNames(), null);
167

    
168
                        jPanel2.add(getJScrollTreeLayers(), null);
169
                        jPanel2.add(getBtnDel(), null);
170
                        jPanel2.add(getBtnAdd(), null);
171
                        jPanel2.add(getJScrollLstSelectedLayers(), null);
172
                        jPanel2.add(getBtnUp(), null);
173
                        jPanel2.add(getBtnDown(), null);
174
                        jPanel2.add(getChkDisagregate(), null);
175
                }
176

    
177
                return jPanel2;
178
        }
179

    
180
        /**
181
         * This method initializes jPanel4
182
         *
183
         * @return Panel
184
         */
185
        private JPanel getJPanel4() {
186
                if (jPanel4 == null) {
187
                        jPanel4 = new JPanel();
188
                        jPanel4.setLayout(null);
189
                        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(
190
                                        null, PluginServices.getText(this, "layer_name"),
191
                                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
192
                                        javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
193
                                        null));
194
                        jPanel4.setBounds(5, 8, 485, 49);
195
                        jPanel4.add(getJTxtNomCapa(), null);
196
                }
197

    
198
                return jPanel4;
199
        }
200

    
201
        /**
202
         * This method initializes jPanel3
203
         *
204
         * @return Panel
205
         */
206
        private JPanel getTabFormats() {
207
                if (tabFormats == null) {
208
                        tabFormats = new JPanel();
209
                        tabFormats.setLayout(null);
210
                        tabFormats.add(getJPanelImageFormats(), null);
211
                        tabFormats.add(getJPanelLstSrs(), null);
212
                        tabFormats.add(getJPanelInfoFormats(), null);
213
                }
214

    
215
                return tabFormats;
216
        }
217

    
218
        /**
219
         * This method initializes jScrollPane1
220
         *
221
         * @return ScrollPane
222
         */
223
        private JScrollPane getJScrollTreeLayers() {
224
                if (jScrollTreeLayers == null) {
225
                        jScrollTreeLayers = new JScrollPane();
226
                        jScrollTreeLayers.setBounds(11, 22, 460, 123);
227
                        jScrollTreeLayers.setViewportView(getTreeLayers());
228
                        jScrollTreeLayers.setPreferredSize(new java.awt.Dimension(205, 75));
229
                }
230

    
231
                return jScrollTreeLayers;
232
        }
233

    
234
        /**
235
         * This method initializes btnDel
236
         *
237
         * @return Button
238
         */
239
        private JButton getBtnDel() {
240
                if (btnDel == null) {
241
                        btnDel = new JButton();
242
                        // btnDel.setPreferredSize(new java.awt.Dimension(23, 23));
243
                        btnDel.setText(PluginServices.getText(this, "remove"));
244
                        btnDel.setMargin(new java.awt.Insets(2, 0, 2, 0));
245
                        btnDel.setBounds(339, 300, 101, 20);
246
                        btnDel.setEnabled(false);
247
                        btnDel.addActionListener(new java.awt.event.ActionListener() {
248
                                public void actionPerformed(java.awt.event.ActionEvent e) {
249
                                        delLayer();
250
                                }
251
                        });
252
                }
253
                return btnDel;
254
        }
255

    
256
        /**
257
         * This method initializes btnAdd
258
         *
259
         * @return Button
260
         */
261
        private JButton getBtnAdd() {
262
                if (btnAdd == null) {
263
                        btnAdd = new JButton();
264
                        // btnAdd.setPreferredSize(new java.awt.Dimension(23, 23));
265
                        btnAdd.setText(PluginServices.getText(this, "add"));
266
                        btnAdd.setMargin(new java.awt.Insets(2, 0, 2, 0));
267
                        btnAdd.setBounds(236, 300, 101, 20);
268
                        btnAdd.setEnabled(false);
269
                        btnAdd.addActionListener(new java.awt.event.ActionListener() {
270
                                public void actionPerformed(java.awt.event.ActionEvent e) {
271
                                        addLayer();
272
                                }
273
                        });
274
                }
275
                return btnAdd;
276
        }
277

    
278
        /**
279
         * This method initializes jScrollPane5
280
         *
281
         * @return ScrollPane
282
         */
283
        private JScrollPane getJScrollLstSelectedLayers() {
284
                if (jScrollLstSelectedLayers == null) {
285
                        jScrollLstSelectedLayers = new JScrollPane();
286
                        jScrollLstSelectedLayers.setBounds(11, 155, 422, 120);
287
                        jScrollLstSelectedLayers.setViewportView(getLstSelectedLayers());
288
                        jScrollLstSelectedLayers.setPreferredSize(new java.awt.Dimension(205, 75));
289
                }
290

    
291
                return jScrollLstSelectedLayers;
292
        }
293

    
294
        /**
295
         * This method initializes jTextField
296
         *
297
         * @return TextField
298
         */
299
        private JTextField getJTxtNomCapa() {
300
                if (jTxtNomCapa == null) {
301
                        jTxtNomCapa = new JTextField();
302
                        jTxtNomCapa.setBounds(10, 19, 460, 20);
303
                        jTxtNomCapa.setText(PluginServices.getText(this, "WMTSLayer"));
304
                        jTxtNomCapa.addKeyListener(new java.awt.event.KeyAdapter() {
305
                                public void keyTyped(java.awt.event.KeyEvent e) {
306
                                        fireWizardComplete(isCorrectlyConfigured());
307
                                }
308
                        });
309
                }
310

    
311
                return jTxtNomCapa;
312
        }
313
        
314
        /**
315
         * This method initializes jScrollPane6
316
         * @return ScrollPane
317
         */
318
        private JScrollPane getJScrollInfoFormats() {
319
                if (jScrollInfoFormats == null) {
320
                        jScrollInfoFormats = new JScrollPane();
321
                        jScrollInfoFormats.setBounds(5, 23, 470, 90);
322
                        jScrollInfoFormats.setViewportView(getLstInfoFormats());
323
                        jScrollInfoFormats.setPreferredSize(new java.awt.Dimension(250, 90));
324
                }
325

    
326
                return jScrollInfoFormats;
327
        }
328

    
329
        /**
330
         * This method initializes jScrollImageFormats
331
         * @return ScrollPane
332
         */
333
        private JScrollPane getJScrollImageFormats() {
334
                if (jScrollImageFormats == null) {
335
                        jScrollImageFormats = new JScrollPane();
336
                        jScrollImageFormats.setBounds(5, 23, 470, 90);
337
                        jScrollImageFormats.setViewportView(getLstImageFormats());
338
                        jScrollImageFormats.setPreferredSize(new java.awt.Dimension(250, 90));
339
                }
340

    
341
                return jScrollImageFormats;
342
        }
343

    
344
        /**
345
         * This method initializes jScrollLstSrs
346
         * @return ScrollPane
347
         */
348
        private JScrollPane getJScrollLstSrs() {
349
                if (jScrollLstSrs == null) {
350
                        jScrollLstSrs = new JScrollPane();
351
                        jScrollLstSrs.setBounds(5, 23, 470, 90);
352
                        jScrollLstSrs.setViewportView(getLstSRSs());
353
                        jScrollLstSrs.setPreferredSize(new java.awt.Dimension(100, 90));
354
                }
355

    
356
                return jScrollLstSrs;
357
        }
358

    
359
        /**
360
         * Gets the available layers in WMS maintaining the tree structure
361
         *
362
         * @return
363
         */
364
        public LayerTree getLayerStructure() {
365
                return treeLayers;
366
        }
367

    
368
        /**
369
         * This method initializes treeLayers
370
         *
371
         * @return Tree
372
         */
373
        private LayerTree getTreeLayers() {
374
                if (treeLayers == null) {
375
                        treeLayers = new LayerTree();
376
                        treeLayers.setRootVisible(true);
377
                        
378
                        //Cuando se hace doble click sobre una capa se a?ade a la list
379
                        treeLayers.addMouseListener(new java.awt.event.MouseAdapter() {
380
                                public void mouseClicked(java.awt.event.MouseEvent e) {
381
                                        if (e.getClickCount() == 2) {
382
                                                addLayer();
383
                                        }
384
                                }
385
                        });
386
                        
387
                        //Cuando se selecciona una capa se activa el bot?n de a?adir
388
                        treeLayers.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
389
                                public void valueChanged(javax.swing.event.TreeSelectionEvent e) {
390
                                        boolean isGetMapable = false;
391
                                        TreePath[] selecciones = getTreeLayers().getSelectionPaths();
392

    
393
                                        if (selecciones != null) {
394
                                                for (int i = 0; i < selecciones.length && !isGetMapable; i++) {
395
                                                        if(selecciones[i].getLastPathComponent() instanceof WMTSTheme) {
396
                                                                WMTSTheme layer = ((WMTSTheme) selecciones[i].getLastPathComponent());
397
                                                                isGetMapable = layer.getChildCount() == 0 || layer.getTitle() != null;
398
                                                        }
399
                                                }
400

    
401
                                        }
402
                                        getBtnAdd().setEnabled(isGetMapable);
403
                                        fireWizardComplete(isCorrectlyConfigured());
404
                                }
405
                        });
406
                }
407

    
408
                return treeLayers;
409
        }
410

    
411
        /**
412
         * This method checks for the options selected within the configuration
413
         * dialog are correct and enough to perform a GetMap request.
414
         *
415
         * @return true if you're done, false if not.
416
         */
417
        public boolean isCorrectlyConfigured() {
418

    
419
                boolean b;
420
                this.repaint();
421
                if ((getLstSRSs().getSelectedIndex() != -1)
422
                                && (getLstImageFormats().getSelectedIndex() != -1)
423
                                && (getLstSelectedLayers().getModel().getSize() > 0)) {
424
                        b = true;
425
                } else {
426
                        b = false;
427
                }
428

    
429
                // Enable or disable del button.
430
                int[] selectedIndices = getLstSelectedLayers().getSelectedIndices();
431

    
432
                getBtnDel().setEnabled(
433
                                selectedIndices != null && selectedIndices.length > 0);
434

    
435
                return b;
436
        }
437

    
438
        public WMTSTheme[] selectedLayersToArray() {
439
                JDnDListModel modelo = ((JDnDListModel) lstSelectedLayers.getModel());
440
                ArrayList elements = modelo.getElements();
441
                WMTSTheme[] layers = (WMTSTheme[]) elements.toArray(new WMTSTheme[0]);
442
                return layers;
443
        }
444

    
445
        /**
446
         * DOCUMENT ME!
447
         */
448
        private void delLayer() {
449
                int[] indices = lstSelectedLayers.getSelectedIndices();
450

    
451
                try {
452
                        ArrayList removeList = new ArrayList();
453
                        WMTSTheme[] infos = selectedLayersToArray();
454
                        JDnDListModel modelo = ((JDnDListModel) lstSelectedLayers
455
                                        .getModel());
456
                        for (int i = 0; i < indices.length; i++) {
457
                                removeList.add(infos[indices[i]]);
458
                        }
459
                        modelo.delIndices(indices);
460
                        lstSelectedLayers.clearSelection();
461
                        fireWizardComplete(isCorrectlyConfigured());
462

    
463
                        // delete from selectedPaths as well
464
                        WMTSTheme elemento = null;
465
                        WMTSTheme last = null;
466
                        TreePath path = null;
467
                        for (int i = removeList.size() - 1; i >= 0; i--) {
468
                                elemento = (WMTSTheme) removeList.get(i);
469
                                for (int j = 0; j < selectedPaths.size(); j++) {
470
                                        path = (TreePath) selectedPaths.get(j);
471
                                        last = (WMTSTheme) path.getLastPathComponent();
472
                                        if (last.getTitle().compareTo(elemento.getTitle()) == 0) {
473
                                                selectedPaths.remove(path);
474
                                        }
475
                                }
476
                        }
477

    
478
                        refreshData();
479
                        refreshInfo();
480
                } catch (ArrayIndexOutOfBoundsException ex) {
481
                        // if you reach this, please, tell me how you did it.
482
                        ex.printStackTrace();
483
                }
484
        }
485

    
486
        /**
487
         * Fires a notification to this wizard listeners telling them if the
488
         * configuration is fair enough to send a GetMap request.
489
         *
490
         * @param b
491
         */
492
        private void fireWizardComplete(boolean b) {
493
                listenerSupport.callStateChanged(b);
494
                callStateChanged(b);
495
        }
496

    
497
        /**
498
         * Refreshes the content shown by this.
499
         */
500
        public void refreshData() {
501
                refreshSRS();
502
                refreshImageFormats();
503
                refreshInfoFormats();
504
                getLstSelectedLayers().repaint();
505
                //refreshStyleTree();
506
        }
507

    
508
        /**
509
         * Refreshes the info tab
510
         *
511
         */
512
        public void refreshInfo() {
513
                getTabInfo().refresh(explorer, selectedLayersVector(),
514
                                getStyleTitles(), getImageFormat(), getSRS());
515
        }
516

    
517
        /**
518
         * Gets the currently shown style tree.
519
         *
520
         * @return
521
         */
522
        private StyleTree getStyleTree() {
523
                return getTabStyle().getStyleTree();
524
        }
525

    
526
        /**
527
         * Method called when pressing the Add layer button or when double-clicking
528
         * on a layer from the server's layer tree.
529
         */
530
        public void addLayer() {
531
                boolean alguno = false;
532

    
533
                TreePath[] selecciones = getTreeLayers().getSelectionPaths();
534
                if (selecciones == null) {
535
                        return;
536
                }
537
                for (int i = 0; i < selecciones.length; i++) {
538
                        if(!(selecciones[i].getLastPathComponent() instanceof WMTSTheme))
539
                                continue;
540
                        selectedPaths.add(selecciones[i]);
541
                        WMTSTheme nodo = (WMTSTheme) selecciones[i].getLastPathComponent();
542
                        
543
                        if (nodo.getTitle() == null || nodo.getTitle().equals("")) {
544
                                continue;
545
                        }
546
        
547
                        JDnDListModel modelo = (JDnDListModel) lstSelectedLayers.getModel();
548

    
549
                        if (modelo.addElement(0, nodo)) {
550
                                alguno = true;
551
                        }
552
                }
553

    
554
                if (alguno) {
555
                        refreshData();
556
                }
557
                refreshInfo();
558
        }
559

    
560
        /**
561
         * This method initializes lstSelectedLayers
562
         *
563
         * @return List
564
         */
565
        public LayerList getLstSelectedLayers() {
566
                if (lstSelectedLayers == null) {
567
                        lstSelectedLayers = new LayerList();
568
                        lstSelectedLayers.setModel(new JDnDListModel());
569
                        lstSelectedLayers
570
                                        .setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
571
                        lstSelectedLayers
572
                                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
573
                                                public void valueChanged(
574
                                                                javax.swing.event.ListSelectionEvent e) {
575
                                                        fireWizardComplete(isCorrectlyConfigured());
576
                                                }
577
                                        });
578
                        lstSelectedLayers.addMouseListener(new MouseAdapter() {
579
                                public void mouseReleased(MouseEvent e) {
580
                                        refreshData();
581
                                }
582
                        });
583
                }
584

    
585
                return lstSelectedLayers;
586
        }
587

    
588
        /**
589
         * This method initializes lstSRSs
590
         *
591
         * @return JList
592
         */
593
        public JList getLstSRSs() {
594
                if (lstSRSs == null) {
595
                        lstSRSs = new JList();
596
                        lstSRSs.setModel(new SRSListModel());
597
                        lstSRSs.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
598
                        lstSRSs.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
599
                                public void valueChanged(javax.swing.event.ListSelectionEvent e) {
600
                                        int i = lstSRSs.getSelectedIndex();
601
                                        if (i != -1) {
602
                                                oldSRS = (String) lstSRSs.getModel().getElementAt(i);
603
                                        }
604
                                        fireWizardComplete(isCorrectlyConfigured());
605
                                }
606
                        });
607
                }
608

    
609
                return lstSRSs;
610
        }
611

    
612
        /**
613
         * This method initializes lstFormats
614
         * @return List
615
         */
616
        public JList getLstImageFormats() {
617
                if (lstImageFormats == null) {
618
                        lstImageFormats = new JList();
619
                        lstImageFormats.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
620
                        lstImageFormats.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
621
                                public void valueChanged(
622
                                                javax.swing.event.ListSelectionEvent e) {
623
                                        fireWizardComplete(isCorrectlyConfigured());
624
                                }
625
                        });
626
                }
627
                return lstImageFormats;
628
        }
629
        
630
        /**
631
         * This method initializes lstFormats
632
         * @return List
633
         */
634
        public JList getLstInfoFormats() {
635
                if (lstInfoFormats == null) {
636
                        lstInfoFormats = new JList();
637
                        lstInfoFormats.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
638
                        lstInfoFormats.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
639
                                public void valueChanged(javax.swing.event.ListSelectionEvent e) {
640
                                        fireWizardComplete(isCorrectlyConfigured());
641
                                }
642
                        });
643
                }
644
                return lstInfoFormats;
645
        }
646
        
647
        /**
648
         * Refreshes the Information formats list
649
         */
650
        private void refreshInfoFormats() {
651
                Object[] selectedValues = lstSelectedLayers.getSelectedValues();
652
                if(selectedValues != null && selectedValues.length == 1) {
653
                        
654
                }
655
        }
656
        
657
        /**
658
         * Refreshes the Image formats list
659
         */
660
        private void refreshImageFormats() {
661
                Object[] selectedValues = lstSelectedLayers.getSelectedValues();
662
                if(selectedValues != null && selectedValues.length == 1) {
663
                        
664
                }
665
        }
666
        
667
        /**
668
         * Refreshes the SRS list
669
         */
670
        private void refreshSRS() {
671
                Object[] selectedValues = lstSelectedLayers.getSelectedValues();
672
                if(selectedValues != null && selectedValues.length == 1) {
673
                        
674
                }
675
        }
676

    
677
        /**
678
         * Refreshes the SRS list
679
         */
680
        /*private void refreshSRS() {
681
                ArrayList elements = ((JDnDListModel) lstSelectedLayers.getModel()).getElements();
682
                WMTSTheme[] theme = (WMTSTheme[]) elements.toArray(new WMTSTheme[0]);
683

684
                SRSListModel model = new SRSListModel();
685

686
                if (theme.length == 0) {
687
                        lstSRSs.setModel(model);// new DefaultListModel());
688
                        sizeFixed = null;
689
                } else {
690
                        TreeSet srsSet = new TreeSet();
691
                        srsSet.addAll(theme[0].getLayer().getSrsList());
692
                        model.setAll(srsSet);
693
                        for (int i = 1; i < theme.length; i++) {
694
                                model.setAll(model.intersect(theme[i].getLayer().getSrsList()));
695
                        }
696
                        lstSRSs.setModel(model);
697
                }
698
                int srsIndex = getSRSIndex(oldSRS);
699
                if (srsIndex != -1) {
700
                        getLstSRSs().setSelectedIndex(srsIndex);
701
                }
702

703
        }*/
704

    
705
        public void setListenerSupport(WizardListenerSupport support) {
706
                listenerSupport = support;
707
        }
708

    
709
        public void setWizardData(WMTSServerExplorer data) {
710
                explorer = data;
711
                ((JDnDListModel) getLstSelectedLayers().getModel()).clear();
712
                getLstSelectedLayers().repaint();
713

    
714
                /*getLstFormats().setModel(
715
                                new FormatListModel(explorer.getFormats()));*/
716
                getTreeLayers().setModel(new LayerTreeModel(explorer.getThemes()));
717
                refreshInfo();
718
        }
719

    
720
        private Vector getStyleTitles() {
721
                return getTabStyle().getStyleTree().getStyleSelectionTitles();
722
        }
723

    
724
        private Vector selectedLayersVector() {
725
                JDnDListModel mod = (JDnDListModel) getLstSelectedLayers().getModel();
726
                Vector lyrs = new Vector();
727
                for (int i = 0; i < mod.getSize(); i++) {
728
                        lyrs.add(mod.getElementAt(i));
729
                }
730
                return lyrs;
731
        }
732

    
733
        public String getImageFormat() {
734
                return (String) getLstImageFormats().getSelectedValue();
735
        }
736
        
737
        public String getInfoFormat() {
738
                return (String) getLstInfoFormats().getSelectedValue();
739
        }
740

    
741
        public String getLayersQuery() {
742
                ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel()).getElements();
743
                WMTSTheme[] layers = (WMTSTheme[]) elements.toArray(new WMTSTheme[0]);
744

    
745
                // Nombre separado por comas de las capas
746
                String layersQuery = layers[layers.length - 1].getTitle();
747

    
748
                for (int i = layers.length - 2; i >= 0; i--) {
749
                        layersQuery += ("," + layers[i].getTitle());
750
                }
751

    
752
                return layersQuery;
753
        }
754

    
755
        /**
756
         * Returns the current selected SRS.
757
         *
758
         * @return
759
         */
760
        public String getSRS() {
761
                return (String) getLstSRSs().getSelectedValue();
762
        }
763

    
764
        /**
765
         * Returns the name of the layer that the user has typed-in
766
         *
767
         * @return
768
         */
769
        public String getLayerName() {
770
                return getJTxtNomCapa().getText();
771
        }
772

    
773
        public void setLayerName(String name) {
774
                getJTxtNomCapa().setText(name);
775
        }
776

    
777
        public TreePath[] getSelectedLayers() {
778
                return getTreeLayers().getSelectionPaths();
779
        }
780

    
781
        /**
782
         * Returns the index of the CRS within the CRS list.
783
         *
784
         * Devuelve la posicion que ocupa el CRS en la lista de CRS
785
         *
786
         * @param crs
787
         * @return The CRS's index if it exists, -1 if it not exists.
788
         */
789
        public int getSRSIndex(String crs) {
790
                for (int i = 0; i < getLstSRSs().getModel().getSize(); i++) {
791
                        if (crs != null
792
                                        && crs.equals(getLstSRSs().getModel().getElementAt(i))) {
793
                                return i;
794
                        }
795
                }
796
                return -1;
797
        }
798

    
799
        /**
800
         * Returns the index of the format within the formats list.
801
         *
802
         * Devuelve la posicion que ocupa el formato en la lista de formatos
803
         *
804
         * @param format
805
         *
806
         * @return The format's index if it exists, -1 if it not exists.
807
         */
808
        public int getFormatIndex(String format) {
809
                for (int i = 0; i < getLstImageFormats().getModel().getSize(); i++) {
810
                        if (format != null && 
811
                                format.equals(getLstImageFormats().getModel().getElementAt(i))) {
812
                                return i;
813
                        }
814
                }
815
                return -1;
816
        }
817

    
818
        /**
819
         * This method initializes jTabbedPane
820
         *
821
         * @return TabbedPane
822
         */
823
        public JTabbedPane getJTabbedPane() {
824
                if (jTabbedPane == null) {
825
                        jTabbedPane = new JTabbedPane();
826
                        jTabbedPane.setBounds(4, 4, 502, 415);
827
                        InfoPanel ip = getTabInfo();
828
                        ip.addFocusListener(new FocusListener() {
829
                                public void focusGained(FocusEvent e) {
830
                                        refreshInfo();
831
                                }
832

    
833
                                public void focusLost(FocusEvent e) {
834
                                }
835
                        });
836

    
837
                        StylesPanel sp = getTabStyle();
838

    
839
                        jTabbedPane.addTab(PluginServices.getText(this, "info"), null, ip, null);
840
                        jTabbedPane.addTab(PluginServices.getText(this, "capas"), null, getTabLayers(), null);
841
                        jTabbedPane.addTab(PluginServices.getText(this, "estilos"), null, sp, null);
842
                        stylesTabIndex = jTabbedPane.getTabCount() - 1;
843
                        jTabbedPane.addTab(PluginServices.getText(this, "formatos"), null,getTabFormats(), null);
844
                        jTabbedPane.setEnabledAt(stylesTabIndex, false);
845
                }
846
                return jTabbedPane;
847
        }
848

    
849
        /**
850
         * This method initializes jPanel
851
         *
852
         * @return Panel
853
         */
854
        private JPanel getTabLayers() {
855
                if (tabLayers == null) {
856
                        tabLayers = new JPanel();
857
                        tabLayers.setLayout(null);
858
                        tabLayers.add(getJPanel4(), null);
859
                        tabLayers.add(getJPanel2(), null);
860
                }
861
                return tabLayers;
862
        }
863
        
864
        /**
865
         * This method initializes jPanelImageFormats
866
         * @return Panel
867
         */
868
        private JPanel getJPanelInfoFormats() {
869
                if (jPanelInfoFormats == null) {
870
                        jPanelInfoFormats = new JPanel();
871
                        jPanelInfoFormats.setLayout(null);
872
                        jPanelInfoFormats.setBorder(javax.swing.BorderFactory.createTitledBorder(
873
                                        null, PluginServices.getText(this, "select_info_formats"),
874
                                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
875
                                        javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
876
                                        null));
877
                        jPanelInfoFormats.setBounds(5, 261, 485, 122);
878
                        jPanelInfoFormats.add(getJScrollInfoFormats(), null);
879
                        jPanelInfoFormats.add(getChkTransparency(), null);
880
                }
881
                return jPanelInfoFormats;
882
        }
883

    
884
        /**
885
         * This method initializes jPanelImageFormats
886
         * @return Panel
887
         */
888
        private JPanel getJPanelImageFormats() {
889
                if (jPanelImageFormats == null) {
890
                        jPanelImageFormats = new JPanel();
891
                        jPanelImageFormats.setLayout(null);
892
                        jPanelImageFormats.setBorder(javax.swing.BorderFactory.createTitledBorder(
893
                                        null, PluginServices.getText(this, "select_formats"),
894
                                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
895
                                        javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
896
                                        null));
897
                        jPanelImageFormats.setBounds(5, 10, 485, 122);
898
                        jPanelImageFormats.add(getJScrollImageFormats(), null);
899
                        jPanelImageFormats.add(getChkTransparency(), null);
900
                }
901
                return jPanelImageFormats;
902
        }
903

    
904
        /**
905
         * This method initializes jPanel5
906
         *
907
         * @return Panel
908
         */
909
        private JPanel getJPanelLstSrs() {
910
                if (jPanelLstSrs == null) {
911
                        jPanelLstSrs = new JPanel();
912
                        jPanelLstSrs.setLayout(null);
913
                        jPanelLstSrs.setBorder(javax.swing.BorderFactory.createTitledBorder(
914
                                        null, PluginServices.getText(this, "seleccionar_srs"),
915
                                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
916
                                        javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
917
                                        null));
918
                        jPanelLstSrs.setBounds(5, 133, 485, 122);
919
                        jPanelLstSrs.add(getJScrollLstSrs(), null);
920
                }
921
                return jPanelLstSrs;
922
        }
923

    
924
        /**
925
         * This method initializes jPanel6
926
         *
927
         * @return Panel
928
         */
929
        private StylesPanel getTabStyle() {
930
                if (tabStyle == null) {
931
                        tabStyle = new StylesPanel();
932
                        tabStyle.setEnabled(false);
933
                        tabStyle.addListener(new BeanListener() {
934
                                public void beanValueChanged(Object value) {
935
                                        fireWizardComplete(isCorrectlyConfigured());
936
                                };
937
                        });
938
                        tabStyle.addFocusListener(new FocusAdapter() {
939
                                public void focusGained(FocusEvent e) {
940
                                        //refreshStyleTree();
941
                                }
942
                        });
943
                }
944
                return tabStyle;
945
        }
946

    
947
        /**
948
         * Sets the focus to the tab next to the current one.
949
         *
950
         * Enfoca a la solapa siguiente a la actualmente enfocada del TabbedPane
951
         *
952
         */
953
        public void avanzaTab() {
954
                int currentPage = currentPage();
955
                int nPages = getNumTabs();
956
                if (nPages - 1 > currentPage) {
957
                        getJTabbedPane().setSelectedIndex(nextEnabledPage());
958
                }
959
        }
960

    
961
        /**
962
         * Sets the focus to the tab previous to the current one.
963
         *
964
         * Enfoca a la solapa anterior a la actualmente enfocada del TabbedPane
965
         *
966
         */
967
        public void retrocedeTab() {
968
                this.getJTabbedPane().setSelectedIndex(previousEnabledPage());
969

    
970
        }
971

    
972
        /**
973
         * Returns the index of the current tab.
974
         *
975
         * Devuelve el ?ndice de la p?gina actual del wizard.
976
         *
977
         * @return
978
         */
979
        public int currentPage() {
980
                return getJTabbedPane().getSelectedIndex();
981
        }
982

    
983
        /**
984
         * Returns the tab amount that the WMSParamsPanel currently have
985
         *
986
         * Devuelve el n?mero de solapas que tiene actualmente el WMSParamsPanel
987
         *
988
         * @return int
989
         */
990
        public int getNumTabs() {
991
                return getJTabbedPane().getTabCount();
992
        }
993

    
994
        /**
995
         * <p>
996
         * Returns the index of the previous enabled tab.
997
         * </p>
998
         * <p>
999
         * Devuelve el ?ndice de la anterior p?gina habilitada del wizard o -1
1000
         * si no hay ninguna.
1001
         * </p>
1002
         *
1003
         * @return The index, or -1 if there is no one.
1004
         */
1005
        public int previousEnabledPage() {
1006
                int currentPage = currentPage();
1007
                int j = 0;
1008
                if (currentPage == 0) {
1009
                        j = -1;
1010
                }
1011
                for (int i = currentPage - 1; i > -1; i--) {
1012
                        if (getJTabbedPane().isEnabledAt(i)) {
1013
                                j = i;
1014
                                break;
1015
                        }
1016
                }
1017
                return j;
1018
        }
1019

    
1020
        /**
1021
         * <p>
1022
         * Returns the previous of the previous enabled tab.
1023
         * </p>
1024
         * <p>
1025
         * Devuelve el ?ndice de la siguiente p?gina habilitada del wizard o -1
1026
         * si no hay ninguna.
1027
         * </p>
1028
         *
1029
         * @return The index, or -1 if there is no one.
1030
         */
1031
        public int nextEnabledPage() {
1032
                int currentPage = currentPage();
1033
                int nPages = getNumTabs();
1034
                if (currentPage == nPages) {
1035
                        return -1;
1036
                }
1037
                for (int i = currentPage + 1; i < nPages; i++) {
1038
                        if (getJTabbedPane().isEnabledAt(i)) {
1039
                                return i;
1040
                        }
1041
                }
1042
                return -1;
1043
        }
1044

    
1045
        /**
1046
         * Selects/deselects the transparency checkbox.
1047
         *
1048
         * @param b
1049
         */
1050
        public void setTransparent(boolean b) {
1051
                getChkTransparency().setSelected(b);
1052
        }
1053

    
1054
        /**
1055
         * This method initializes chkTrasparency
1056
         *
1057
         * @return CheckBox
1058
         */
1059
        private JCheckBox getChkTransparency() {
1060
                if (chkTransparency == null) {
1061
                        chkTransparency = new JCheckBox();
1062
                        chkTransparency.setText(PluginServices.getText(this,
1063
                                        "wms_transparency"));
1064
                        chkTransparency.setSelected(true);
1065
                        chkTransparency.addItemListener(new java.awt.event.ItemListener() {
1066
                                public void itemStateChanged(java.awt.event.ItemEvent e) {
1067
                                        fireWizardComplete(isCorrectlyConfigured());
1068
                                }
1069
                        });
1070
                        chkTransparency.setBounds(5, 168, 441, 21);
1071

    
1072
                }
1073
                return chkTransparency;
1074
        }
1075

    
1076
        /**
1077
         * Returns a vector of strings containing the styles selected for the
1078
         * layers. A blank style is correct and means that default style will be
1079
         * used.
1080
         *
1081
         * @return Vector
1082
         */
1083
        /*public Vector<RemoteStyle> getStyles() {
1084
                Vector<RemoteStyle> v = new Vector<RemoteStyle>();
1085
                RemoteLayerNode[] layers = selectedLayersToArray();
1086
                for (int i = 0; i < layers.length; i++) {
1087
                        RemoteStyle sty = layers[i].getSelectedStyle();
1088
                        if(sty != null)
1089
                                v.add(0, sty);
1090
                }
1091
                return v;
1092
        }
1093

1094
        public Vector<RemoteStyle> getLayerStyle(String layerName) {
1095
                Vector<WMTSStyle> v = new Vector<WMTSStyle>();
1096
                WMTSTheme[] layers = selectedLayersToArray();
1097
                for (int i = 0; i < layers.length; i++) {
1098
                        if (layers[i].getTitle().equalsIgnoreCase(layerName)) {
1099
                                RemoteStyle sty = layers[i].get
1100
                                v.add(sty);
1101
                                return v;
1102
                        }
1103
                }
1104
                return v;
1105
        }*/
1106
        
1107
        /**
1108
         * The piece of the GetMap request that has the layer names.
1109
         *
1110
         * @return
1111
         */
1112
        /*@SuppressWarnings("unchecked")
1113
        public String getQueryableLayerQuery() {
1114
                ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel()).getElements();
1115
                WMTSTheme[] layers = (WMTSTheme[]) elements.toArray(new WMTSTheme[0]);
1116
                
1117
                // Nombre separado por comas de las capas
1118
                String layersQuery = "";
1119
                int i;
1120

1121
                for (i = 0; i < layers.length; i++) {
1122
                        if (layers[i].isQueryable()) {
1123
                                layersQuery = layers[i].getTitle();
1124

1125
                                break;
1126
                        }
1127
                }
1128

1129
                for (int j = i + 1; j < layers.length; j++) {
1130
                        if (layers[j].isQueryable()) {
1131
                                layersQuery += ("," + layers[j].getTitle());
1132
                        }
1133
                }
1134

1135
                return layersQuery;
1136
        }
1137
        
1138
        private void refreshStyleTree() {
1139

1140
                int size = getLstSelectedLayers().getModel().getSize();
1141
                RemoteLayerNode styleRoot = RasterLocator.getManager().getDataStructFactory().createWMSLayerNode();
1142
                styleRoot.setTitle(PluginServices.getText(this, "selected_layers"));
1143

1144
                StyleTreeModel model = new StyleTreeModel(styleRoot);
1145
                jTabbedPane.setEnabledAt(stylesTabIndex, false);
1146
                for (int i = 0; i < size; i++) {
1147
                        RemoteLayerNode node = (RemoteLayerNode) getLstSelectedLayers()
1148
                                        .getModel().getElementAt(i);
1149
                        // If any of the layers defines styles, the tab will be enabled.
1150
                        if (model.addLayerBranch(node)) {
1151
                                jTabbedPane.setEnabledAt(stylesTabIndex, true);
1152
                        }
1153
                }
1154

1155
                getStyleTree().setModel(model);
1156
                getStyleTree().expandAll();
1157
                getStyleTree().repaint();
1158
        }
1159
        */
1160
        
1161
        /**
1162
         * Takes the array of selected layers and a vector containing the style
1163
         * names and set them as selected in the styles panel
1164
         *
1165
         * @param selectedLayers
1166
         * @param styles
1167
         */
1168
        /*public void setStyleSelections(Vector<RemoteStyle> styles) {
1169

1170
                RemoteLayerNode[] layers = selectedLayersToArray();
1171
                int length = layers.length;
1172
                for (int i = 0; i < length; i++) {
1173
                        String styleName = styles.get(i).getName();
1174
                        layers[length - i - 1].setSelectedStyleByName(styleName);
1175
                }
1176
        }*/
1177

    
1178
        /**
1179
         * This method initializes tabInfo
1180
         *
1181
         * @return Panel
1182
         */
1183
        private InfoPanel getTabInfo() {
1184
                if (tabInfo == null) {
1185
                        tabInfo = new InfoPanel();
1186

    
1187
                }
1188
                return tabInfo;
1189
        }
1190

    
1191
        /**
1192
         * @return
1193
         */
1194
        public boolean getTransparency() {
1195
                return getChkTransparency().isSelected();
1196
        }
1197

    
1198
        public void initWizard() {
1199
        }
1200

    
1201
        public void execute() {
1202
        }
1203

    
1204
        protected boolean nodeSelected(TreePath[] selection, WMTSTheme node) {
1205
                for (int i = 0; i < selection.length; i++) {
1206
                        Object[] components = selection[i].getPath();
1207
                        for (int j = 0; j < components.length; j++) {
1208
                                if (components[j] instanceof WMTSTheme) {
1209
                                        if (((WMTSTheme) components[j]).getTitle().compareTo(
1210
                                                        node.getTitle()) == 0) {
1211
                                                return true;
1212
                                        }
1213
                                }
1214
                        }
1215
                }
1216
                return false;
1217
        }
1218

    
1219
        public Dimension getFixedSize() {
1220
                return sizeFixed;
1221
        }
1222

    
1223
        /**
1224
         * This method initializes chkExtendedNames
1225
         *
1226
         * @return CheckBox
1227
         */
1228
        private JCheckBox getChkExtendedNames() {
1229
                if (chkExtendedNames == null) {
1230
                        chkExtendedNames = new JCheckBox();
1231
                        chkExtendedNames.setText(PluginServices.getText(this,
1232
                                        "show_layer_names"));
1233
                        chkExtendedNames.addItemListener(new java.awt.event.ItemListener() {
1234
                                public void itemStateChanged(java.awt.event.ItemEvent e) {
1235
                                        boolean b = chkExtendedNames.isSelected();
1236
                                        getTreeLayers().showLayerNames = b;
1237
                                        getTreeLayers().repaint();
1238
                                        getLstSelectedLayers().showLayerNames = b;
1239
                                        getLstSelectedLayers().repaint();
1240
                                        getStyleTree().showLayerNames = b;
1241
                                }
1242
                        });
1243
                        chkExtendedNames
1244
                                        .addActionListener(new java.awt.event.ActionListener() {
1245
                                                public void actionPerformed(java.awt.event.ActionEvent e) {
1246
                                                        fPrefs.putBoolean("show_layer_names",
1247
                                                                        chkExtendedNames.isSelected());
1248
                                                }
1249
                                        });
1250
                        chkExtendedNames.setBounds(19, 300, 212, 20);
1251
                        chkExtendedNames.setSelected(fPrefs.getBoolean("show_layer_names",
1252
                                        false));
1253

    
1254
                }
1255
                return chkExtendedNames;
1256
        }
1257

    
1258
        /**
1259
         * This method initializes btnUp
1260
         *
1261
         * @return Button
1262
         */
1263
        private JButton getBtnUp() {
1264
                if (btnUp == null) {
1265
                        btnUp = new JButton();
1266
                        btnUp.setBounds(438, 184, 30, 30);
1267
                        btnUp.setToolTipText(PluginServices.getText(this, "move_layer_up"));
1268
                        btnUp.addActionListener(new java.awt.event.ActionListener() {
1269
                                public void actionPerformed(java.awt.event.ActionEvent e) {
1270
                                        LayerList list = getLstSelectedLayers();
1271
                                        int[] selectedIndices = list.getSelectedIndices();
1272
                                        int index = list.getSelectedIndex();
1273
                                        if (selectedIndices != null && selectedIndices.length == 1
1274
                                                        && index > 0) {
1275
                                                JDnDListModel m = (JDnDListModel) list.getModel();
1276
                                                m.itemsMoved(index - 1, new int[] { index });
1277
                                                list.setSelectedIndex(index - 1);
1278
                                        }
1279
                                }
1280
                        });
1281
                        btnUp.setIcon(PluginServices.getIconTheme().get("aplication-preferences-uparrow"));
1282
                }
1283
                return btnUp;
1284
        }
1285

    
1286
        /**
1287
         * This method initializes btnDown
1288
         *
1289
         * @return Button
1290
         */
1291
        private JButton getBtnDown() {
1292
                if (btnDown == null) {
1293
                        btnDown = new JButton();
1294
                        btnDown.setBounds(438, 215, 30, 30);
1295
                        btnDown.setToolTipText(PluginServices.getText(this, "move_layer_down"));
1296
                        btnDown.addActionListener(new java.awt.event.ActionListener() {
1297
                                public void actionPerformed(java.awt.event.ActionEvent e) {
1298
                                        LayerList list = getLstSelectedLayers();
1299
                                        int[] selectedIndices = list.getSelectedIndices();
1300
                                        int index = list.getSelectedIndex();
1301
                                        if (selectedIndices != null
1302
                                                        && selectedIndices.length == 1
1303
                                                        && index < getLstSelectedLayers().getModel().getSize() - 1) {
1304
                                                JDnDListModel m = (JDnDListModel) list.getModel();
1305
                                                m.itemsMoved(index + 1, new int[] { index });
1306
                                                list.setSelectedIndex(index + 1);
1307
                                        }
1308
                                }
1309
                        });
1310
                        btnDown.setIcon(PluginServices.getIconTheme().get("aplication-preferences-downarrow"));
1311
                }
1312
                return btnDown;
1313
        }
1314

    
1315
        public void setFixedSize(Dimension sz) {
1316
                sizeFixed = sz;
1317
        }
1318

    
1319
        public ArrayList getSelectedPaths() {
1320
                return selectedPaths;
1321
        }
1322

    
1323
        public LayerTree getJustTreeLayer() {
1324
                return treeLayers;
1325
        }
1326

    
1327
        /**
1328
         * This method initializes chkDisagregate
1329
         *
1330
         * @return CheckBox
1331
         */
1332
        private JCheckBox getChkDisagregate() {
1333
                if (chkDisagregate == null) {
1334
                        chkDisagregate = new JCheckBox();
1335
                        chkDisagregate.setBounds(new java.awt.Rectangle(19,276,269,20));
1336
                        chkDisagregate.setText(PluginServices.getText(this, "disagregate_layers"));
1337
                        chkDisagregate.setSelected(false);
1338
                }
1339
                return chkDisagregate;
1340
        }
1341

    
1342
        public boolean getDisagregatedLayers() {
1343
                return chkDisagregate.isSelected();
1344
        }
1345

    
1346
        public void disableDisagregatedLayers() {
1347
                chkDisagregate.setEnabled(false);
1348
        }
1349

    
1350
        @Override
1351
        public DataStoreParameters[] getParameters() {
1352
                return null;
1353
        }
1354

    
1355
        @Override
1356
        public void close() {
1357
        }
1358
        
1359
        public WMTSServerExplorer getExplorer() {
1360
                return explorer;
1361
        }
1362
} // @jve:decl-index=0:visual-constraint="10,10"