Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extWMS / src / com / iver / cit / gvsig / gui / panels / WMSParamsPanel.java @ 3746

History | View | Annotate | Download (43.5 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
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
package com.iver.cit.gvsig.gui.panels;
42

    
43

    
44
import java.awt.event.FocusEvent;
45
import java.awt.event.FocusListener;
46
import java.awt.geom.Rectangle2D;
47
import java.util.ArrayList;
48
import java.util.ConcurrentModificationException;
49
import java.util.HashSet;
50
import java.util.Iterator;
51
import java.util.TreeSet;
52
import java.util.Vector;
53

    
54
import javax.swing.DefaultListModel;
55
import javax.swing.JCheckBox;
56
import javax.swing.JEditorPane;
57
import javax.swing.JPanel;
58
import javax.swing.JScrollPane;
59
import javax.swing.JTabbedPane;
60
import javax.swing.JTextField;
61
import javax.swing.tree.TreePath;
62

    
63
import com.iver.andami.PluginServices;
64
import com.iver.cit.gvsig.fmap.drivers.wms.FMapWMSDriver;
65
import com.iver.cit.gvsig.fmap.layers.FLayer;
66
import com.iver.cit.gvsig.fmap.layers.IFMapWMSDimension;
67
import com.iver.cit.gvsig.fmap.layers.WMSLayerNode;
68
import com.iver.cit.gvsig.fmap.layers.WMSLayerNode.FMapWMSStyle;
69
import com.iver.cit.gvsig.gui.WizardPanel;
70
import com.iver.cit.gvsig.gui.beans.controls.dnd.JDnDList;
71
import com.iver.cit.gvsig.gui.beans.controls.dnd.JDnDListModel;
72
import com.iver.cit.gvsig.gui.wizards.FormatListModel;
73
import com.iver.cit.gvsig.gui.wizards.LayerTreeModel;
74
import com.iver.cit.gvsig.gui.wizards.SRSListModel;
75
import com.iver.cit.gvsig.gui.wizards.WMSWizardData;
76
import com.iver.cit.gvsig.gui.wizards.WizardListenerSupport;
77
/**
78
 * This class implements the map option panel.
79
 * 
80
 * It includes a set of Listeners that implement some control rules which
81
 * refresh the component values that depends on those selected in the other
82
 * components to avoid to choose an invalid set of options. It also includes a
83
 * method (isCorrectlyConfigured()) that checks if the current set of values is enough to
84
 * correctly launch a GetMap request.
85
 * 
86
 * The information is obtained from a WMSWizardDataSource object.
87
 * 
88
 * 
89
 * Esta clase implementa el panel de opciones disponibles sobre la cobertura.
90
 * 
91
 * Incluye una serie de Listeners que implementan unas reglas de control que
92
 * refrescan los valores de componentes cuyos valores dependen de aqu?llos 
93
 * seleccionados en otros componentes para evitar que se escoja una combinaci?n
94
 * de opciones err?nea as? como una funci?n (isCorrectlyConfigured()) que
95
 * comprueba si la combinaci?n escogida actualmente es suficiente para lanzar
96
 * una operaci?n GetMap correctamente.
97
 * 
98
 * La informaci?n obtiene a partir de un objeto WMSWizardDataSource.
99
 * 
100
 * @author jaume - jaume dominguez faus
101
 *
102
 */
103
public class WMSParamsPanel extends WizardPanel {
104
        private javax.swing.JScrollPane jScrollPane1 = null;
105
        private javax.swing.JScrollPane jScrollPane2 = null;
106
        private javax.swing.JScrollPane jScrollPane5 = null;
107
        private javax.swing.JButton btnAdd = null;
108
        private javax.swing.JButton btnDel = null;
109
        private javax.swing.JScrollPane jScrollPane6 = null;
110
        private javax.swing.JPanel jPanel2 = null;
111
        private javax.swing.JPanel tabFormats = null;
112
        private JPanel jPanel4 = null;
113
        private JTextField jTxtNomCapa = null;
114
        private JDnDList lstSelectedLayers = null;
115
        private javax.swing.JList lstSRSs = null;
116
        private LayerTree treeLayers = null;
117
        private javax.swing.JList lstFormats = null;
118
        private JDnDListModel selectedLayersModel = new JDnDListModel();
119
        private WizardListenerSupport listenerSupport;
120
        private WMSWizardData dataSource;
121
        private JTabbedPane jTabbedPane = null;
122
        private JPanel tabLayers = null;
123
        private JPanel jPanel1 = null;
124
        private JPanel jPanel5 = null;
125
        private StylesPanel tabStyle = null;
126
        private JCheckBox chkTransparency = null;
127
    private InfoPanel tabInfo = null;
128
    private DimensionPanel1 tabDimensions = null;
129
    private int dimensionTabIndex;
130
    private int stylesTabIndex;
131
   
132
    
133
    public WMSParamsPanel(){
134
                super();
135
                initialize();
136
        }
137
        
138
        /**
139
         * This method initializes panelPage2
140
         *
141
         * @return javax.swing.JPanel
142
         */
143
        private void initialize() {
144
                this.setLayout(null);
145
                this.setVisible(false);
146
                this.setBounds(10, 5, 481, 427);
147
                this.add(getJTabbedPane(), null);
148
        }
149
        /**
150
         * This method initializes jPanel2
151
         *
152
         * @return javax.swing.JPanel
153
         */
154
        private javax.swing.JPanel getJPanel2() {
155
                if (jPanel2 == null) {
156
                        jPanel2 = new javax.swing.JPanel();
157
                        jPanel2.setLayout(null);
158
                        jPanel2.setBounds(4, 59, 454, 328);
159
                        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(
160
                                        null, PluginServices.getText(this, "seleccionar_capas"),
161
                                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
162
                                        javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
163
                        jPanel2.add(getJScrollPane1(), null);
164
                        jPanel2.add(getBtnDel(), null);
165
                        jPanel2.add(getBtnAdd(), null);
166
                        jPanel2.add(getJScrollPane5(), null);
167
                }
168

    
169
                return jPanel2;
170
        }
171
        
172
        /**
173
         * This method initializes jPanel4
174
         *
175
         * @return javax.swing.JPanel
176
         */
177
        private JPanel getJPanel4() {
178
                if (jPanel4 == null) {
179
                        jPanel4 = new JPanel();
180
                        jPanel4.setLayout(null);
181
                        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(
182
                                        null, PluginServices.getText(this, "nombre_capa"),
183
                                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
184
                                        javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
185
                        jPanel4.setBounds(4, 8, 457, 49);
186
                        jPanel4.add(getJTxtNomCapa(), null);
187
                }
188

    
189
                return jPanel4;
190
        }
191
        
192
        /**
193
         * This method initializes jPanel3
194
         *
195
         * @return javax.swing.JPanel
196
         */
197
        private javax.swing.JPanel getTabFormats() {
198
                if (tabFormats == null) {
199
                        tabFormats = new javax.swing.JPanel();
200
                        tabFormats.setLayout(null);
201
                        tabFormats.add(getJPanel1(), null);
202
                        tabFormats.add(getJPanel5(), null);
203
                }
204

    
205
                return tabFormats;
206
        }
207
        /**
208
         * This method initializes jScrollPane1
209
         *
210
         * @return javax.swing.JScrollPane
211
         */
212
        private javax.swing.JScrollPane getJScrollPane1() {
213
                if (jScrollPane1 == null) {
214
                        jScrollPane1 = new javax.swing.JScrollPane();
215
                        jScrollPane1.setBounds(11, 22, 430, 124);
216
                        jScrollPane1.setViewportView(getTreeLayers());
217
                        jScrollPane1.setPreferredSize(new java.awt.Dimension(205, 75));
218
                }
219

    
220
                return jScrollPane1;
221
        }
222
        
223
        /**
224
         * This method initializes btnDel
225
         *
226
         * @return javax.swing.JButton
227
         */
228
        private javax.swing.JButton getBtnDel() {
229
                if (btnDel == null) {
230
                        btnDel = new javax.swing.JButton();
231
                        btnDel.setPreferredSize(new java.awt.Dimension(23, 23));
232
                        btnDel.setText(PluginServices.getText(this, "quitar"));
233
                        btnDel.setMargin(new java.awt.Insets(2, 0, 2, 0));
234
                        btnDel.setBounds(246, 158, 101, 23);
235
                        btnDel.setEnabled(false);
236
                        btnDel.addActionListener(new java.awt.event.ActionListener() {
237
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
238
                                                delLayer();
239
                                        }
240
                                });
241
                }
242
                return btnDel;
243
        }
244
        
245
        /**
246
         * This method initializes btnAdd
247
         *
248
         * @return javax.swing.JButton
249
         */
250
        private javax.swing.JButton getBtnAdd() {
251
                if (btnAdd == null) {
252
                        btnAdd = new javax.swing.JButton();
253
                        btnAdd.setPreferredSize(new java.awt.Dimension(23, 23));
254
                        btnAdd.setText(PluginServices.getText(this, "anadir"));
255
                        btnAdd.setMargin(new java.awt.Insets(2, 0, 2, 0));
256
                        btnAdd.setBounds(133, 158, 101, 23);
257
                        btnAdd.setEnabled(false);
258
                        btnAdd.addActionListener(new java.awt.event.ActionListener() {
259
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
260
                                                addLayer();
261
                                        }
262
                                });
263
                }
264

    
265
                return btnAdd;
266
        }
267
        
268
        /**
269
         * This method initializes jScrollPane5
270
         *
271
         * @return javax.swing.JScrollPane
272
         */
273
        private javax.swing.JScrollPane getJScrollPane5() {
274
                if (jScrollPane5 == null) {
275
                        jScrollPane5 = new javax.swing.JScrollPane();
276
                        jScrollPane5.setBounds(11, 190, 431, 130);
277
                        jScrollPane5.setViewportView(getLstSelectedLayers());
278
                        jScrollPane5.setPreferredSize(new java.awt.Dimension(205, 75));
279
                }
280

    
281
                return jScrollPane5;
282
        }
283
        
284
        /**
285
         * This method initializes jTextField
286
         *
287
         * @return javax.swing.JTextField
288
         */
289
        private JTextField getJTxtNomCapa() {
290
                if (jTxtNomCapa == null) {
291
                        jTxtNomCapa = new JTextField();
292
                        jTxtNomCapa.setBounds(10, 19, 437, 20);
293
                        jTxtNomCapa.setText(PluginServices.getText(this, "capaWMS"));
294
                }
295

    
296
                return jTxtNomCapa;
297
        }
298

    
299

    
300
        /**
301
         * This method initializes jScrollPane6
302
         *
303
         * @return javax.swing.JScrollPane
304
         */
305
        private javax.swing.JScrollPane getJScrollPane6() {
306
                if (jScrollPane6 == null) {
307
                        jScrollPane6 = new javax.swing.JScrollPane();
308
                        jScrollPane6.setBounds(5, 23, 442, 140);
309
                        jScrollPane6.setViewportView(getLstFormats());
310
                        jScrollPane6.setPreferredSize(new java.awt.Dimension(250, 200));
311
                }
312

    
313
                return jScrollPane6;
314
        }
315
        
316
        /**
317
         * This method initializes jScrollPane2
318
         *
319
         * @return javax.swing.JScrollPane
320
         */
321
        private javax.swing.JScrollPane getJScrollPane2() {
322
                if (jScrollPane2 == null) {
323
                        jScrollPane2 = new javax.swing.JScrollPane();
324
                        jScrollPane2.setBounds(5, 23, 442, 141);
325
                        jScrollPane2.setViewportView(getLstSRSs());
326
                        jScrollPane2.setPreferredSize(new java.awt.Dimension(100, 200));
327
                }
328

    
329
                return jScrollPane2;
330
        }
331
        
332
        /**
333
         * This method initializes treeLayers
334
         *
335
         * @return javax.swing.JTree
336
         */
337
        private LayerTree getTreeLayers() {
338
                if (treeLayers == null) {
339
                        treeLayers = new LayerTree();
340
                        treeLayers.setRootVisible(true);
341
                        treeLayers.addMouseListener(new java.awt.event.MouseAdapter() { 
342
                                public void mouseClicked(java.awt.event.MouseEvent e) {    
343
                                        if (e.getClickCount() == 2){
344
                        addLayer();
345
                    }
346
                                }
347
                        });
348
                        treeLayers.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
349
                                        public void valueChanged(
350
                                                javax.swing.event.TreeSelectionEvent e) {
351
                                                
352
                        boolean isGetMapable = false; // pffff, jajaja
353
                        TreePath[] selecciones = getTreeLayers().getSelectionPaths();
354
                        if (selecciones!=null) // no entenc perqu? peta ac? i li arriba null a voltes...
355
                        {
356
                                for (int i = 0; i < selecciones.length && !isGetMapable; i++) {
357
                                        isGetMapable = ((WMSLayerNode) selecciones[i].getLastPathComponent()).getChildren().size()==0;
358
                                }
359
                                
360
                        }
361
                        getBtnAdd().setEnabled(isGetMapable);
362
                            fireWizardComplete(isCorrectlyConfigured());
363
                                        }
364
                                });
365
                }
366

    
367
                return treeLayers;
368
        }
369
        
370

    
371
    /**
372
         * This method checks for the options selected within the configuration dialog are 
373
         * correct and enough to perform a GetMap request.
374
         * @return true if you're done, false if not.
375
         */
376
        public boolean isCorrectlyConfigured() {
377
        
378
                boolean b;
379
        this.repaint();
380
                if ((getLstSRSs().getSelectedIndex() != -1) &&
381
                                (getLstFormats().getSelectedIndex() != -1) &&
382
                                (getLstSelectedLayers().getModel().getSize() > 0)) {
383
                        b = true;
384
                } else {
385
                        b = false;
386
                }
387
        
388
        // Enable or disable the delete layer button.
389
        getBtnDel().setEnabled(
390
                getLstSelectedLayers().getSelectedIndices()!=null 
391
                && getLstSelectedLayers().getSelectedIndices().length>0
392
                );
393
        return b;
394
        }
395

    
396
        /**
397
         * DOCUMENT ME!
398
         */
399
        private void delLayer() {
400
                int[] indices = lstSelectedLayers.getSelectedIndices();
401

    
402
                ArrayList removeList = new ArrayList();
403
        JDnDListModel modelo = ((JDnDListModel) lstSelectedLayers.getModel()); 
404
        ArrayList elements = modelo.getElements();
405
        WMSLayerNode[] infos = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]);
406
        
407
                for (int i = 0; i < indices.length; i++) {
408
                        removeList.add(infos[indices[i]]);
409
                }
410

    
411
                modelo.delIndices(indices);
412
                lstSelectedLayers.clearSelection();
413
                fireWizardComplete(isCorrectlyConfigured());
414
                
415
                refresh();
416
        
417
        }
418
        
419
        /**
420
         * Fires a notification to this wizard listeners telling them if the
421
         * configuration is fair enough to send a GetMap request.
422
         * @param b
423
         */
424
        private void fireWizardComplete(boolean b){
425
                listenerSupport.callStateChanged(b);
426
                callStateChanged(b);
427
        }
428
        
429
        /**
430
     * Refreshes the content shown by this.
431
     */
432
    public void refresh() {
433
        refreshSRS();
434
        getLstSelectedLayers().repaint();
435
        refreshStyleTree();
436
        refreshDimensions();
437
        getTabInfo().refresh(dataSource, 
438
                             selectedLayersVector(),
439
                             getStyleTitles(),
440
                             getFormat(),
441
                             getSRS(),
442
                             getDimensions());
443
        
444
    }
445

    
446
    private void refreshDimensions() {
447
            int size = getLstSelectedLayers().getModel().getSize();
448
            boolean enable = false;
449
            for (int i=0; i<size; i++) {
450
                    WMSLayerNode node = (WMSLayerNode) getLstSelectedLayers().getModel().getElementAt(i);
451
                    if (node.getDimensions()==null)
452
                        continue;
453

    
454
            for (int j = 0; j < node.getDimensions().size(); j++) {
455
                    IFMapWMSDimension dim = (IFMapWMSDimension) node.getDimensions().get(j);
456
                    getTabDimensions().addDimension(dim);
457
                    enable = true;
458
            }
459
        }
460
            jTabbedPane.setEnabledAt(dimensionTabIndex, enable);
461
            
462
    }
463

    
464
    private void refreshDimensionTree() {
465
            int size = getLstSelectedLayers().getModel().getSize();
466
            
467
            WMSLayerNode dimensionRoot = new WMSLayerNode();
468
            dimensionRoot.setTitle(PluginServices.getText(this, "selected_themes"));
469
            
470
            DimensionTreeModel model = new DimensionTreeModel(dimensionRoot);
471
        jTabbedPane.setEnabledAt(dimensionTabIndex, false);
472
            for (int i=0; i<size; i++) {
473
                    WMSLayerNode node = (WMSLayerNode) getLstSelectedLayers().getModel().getElementAt(i);
474
                    WMSLayerNode myNode = new WMSLayerNode();
475
            myNode.setName(node.getName());
476
            myNode.setTitle(node.getTitle());
477
            if (node.getDimensions()==null)
478
                        continue;
479

    
480
            for (int j = 0; j < node.getDimensions().size(); j++) {
481
                    IFMapWMSDimension dim = (IFMapWMSDimension) node.getDimensions().get(j);
482
                myNode.addDimension(dim.getName(), dim.getUnit(), dim.getUnitSymbol(), dim.getExpression());
483
            }
484
            // If any of the layers defines dimensions, the tab will be enabled.
485
            if (model.addLayerBranch(myNode))
486
                jTabbedPane.setEnabledAt(dimensionTabIndex, true);
487
            }
488
//            getDimensionTree().setModel(model);
489
//        getDimensionTree().repaint();
490
    }
491

    
492
    /**
493
     * 
494
     */
495
    private void refreshStyleTree() {
496
        int size = getLstSelectedLayers().getModel().getSize();
497
        
498
        WMSLayerNode styleRoot = new WMSLayerNode();
499
        styleRoot.setTitle(PluginServices.getText(this, "selected_themes"));
500
        
501
        StylesTreeModel model = new StylesTreeModel(styleRoot);
502
        jTabbedPane.setEnabledAt(stylesTabIndex, false);
503
        for (int i=0; i<size; i++){
504
            WMSLayerNode node = (WMSLayerNode)getLstSelectedLayers().getModel().getElementAt(i);
505
            WMSLayerNode myNode = new WMSLayerNode();
506
            myNode.setName(node.getName());
507
            myNode.setTitle(node.getTitle());
508

    
509
            if (node.getStyles()==null)
510
                continue;
511

    
512
            for (int j = 0; j < node.getStyles().size(); j++) {
513
                FMapWMSStyle sty = (FMapWMSStyle) node.getStyles().get(j);
514
                myNode.addStyle(sty.name, sty.title, sty.styleAbstract);
515
            }
516

    
517
            // If any of the layers defines styles, the tab will be enabled.
518
            if (model.addLayerBranch(myNode)){
519
                jTabbedPane.setEnabledAt(stylesTabIndex, true);
520
            }
521
        }
522
        getStyleTree().setModel(model);
523
        getStyleTree().expandAll();
524
        getStyleTree().repaint();
525
    }
526
    
527
    public void setStyleSelections(Vector styles) {
528
            getStyleTree().setSelections(styles);
529
    }
530
    /**
531
     * Gets the currently shown style tree.
532
     * @return
533
     */
534
    private StyleTree getStyleTree() {
535
        return getTabStyle().getStyleTree();
536
    }
537
    
538
    /**
539
     * Gets the currently shown style tree.
540
     * @return
541
     */
542
    public DimensionTree getDimensionTree() {
543
        return null; //getTabDimensions().getDimensionTree();
544
            // TODO
545
            //return new DimensionTree();
546
    }
547

    
548
    /**
549
         * DOCUMENT ME!
550
         */
551
        private void addLayer() {
552
                boolean alguno = false;
553

    
554
                TreePath[] selecciones = getTreeLayers().getSelectionPaths();
555

    
556
                for (int i = 0; i < selecciones.length; i++) {
557
                        WMSLayerNode nodo = (WMSLayerNode) selecciones[i].getLastPathComponent();
558
                        if (nodo.getChildren().size()>0)
559
                // no es un nodo hijo
560
                continue;
561
                        //Se a?ade a la lista de layers seleccionados
562
                        JDnDListModel modelo = (JDnDListModel) lstSelectedLayers.getModel();
563

    
564
                        if (modelo.addElement(0, nodo.clone())) {
565
                                alguno = true;
566
                        }
567
            
568
                }
569

    
570
                if (alguno) {
571
                        refresh();
572
                }
573
        
574
        }
575
        
576
        /**
577
         * This method initializes lstSelectedLayers
578
         *
579
         * @return javax.swing.JList
580
         */
581
        public javax.swing.JList getLstSelectedLayers() {
582
                if (lstSelectedLayers == null) {
583
            lstSelectedLayers = new JDnDList();
584
                        lstSelectedLayers.setModel(selectedLayersModel);
585
                        lstSelectedLayers.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
586
                        lstSelectedLayers.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
587
                            public void valueChanged(javax.swing.event.ListSelectionEvent e) {
588
                                fireWizardComplete(isCorrectlyConfigured());
589
                            }
590
                        });
591
                }
592

    
593
                return lstSelectedLayers;
594
        }
595
    
596
        /**
597
         * This method initializes lstSRSs
598
         *
599
         * @return javax.swing.JList
600
         */
601
        public javax.swing.JList getLstSRSs() {
602
                if (lstSRSs == null) {
603
                        lstSRSs = new javax.swing.JList();
604
                        lstSRSs.setModel(new SRSListModel());
605
                        lstSRSs.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
606
                        lstSRSs.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
607
                                public void valueChanged(
608
                                                javax.swing.event.ListSelectionEvent e) {
609
                                        fireWizardComplete(isCorrectlyConfigured());
610
                                }
611
                        });
612
                }
613

    
614
                return lstSRSs;
615
        }
616

    
617
        /**
618
         * This method initializes lstFormats1
619
         *
620
         * @return javax.swing.JList
621
         */
622
        public javax.swing.JList getLstFormats() {
623
                if (lstFormats == null) {
624
                        lstFormats = new javax.swing.JList();
625
                        lstFormats.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
626
                        lstFormats.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
627
                                public void valueChanged(javax.swing.event.ListSelectionEvent e) {
628
                                        fireWizardComplete(isCorrectlyConfigured());
629
                                }
630
                        });
631
                }
632

    
633
                return lstFormats;
634
        }
635

    
636
        /**
637
         * DOCUMENT ME!
638
         */
639
        private void refreshSRS() {
640
        String oldSrs = (String) getLstSRSs().getSelectedValue();
641
        ArrayList elements = ((JDnDListModel) lstSelectedLayers.getModel()).getElements();
642
        WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]);
643
                
644

    
645
                if (layers.length == 0) {
646
                        lstSRSs.setModel(new DefaultListModel());
647
                } else {
648
                        TreeSet srsSet = new TreeSet();
649
                        srsSet.addAll(layers[0].getAllSrs());
650
            
651
            // I'm adding the layer specific SRS
652
            for (int i = 1; i < layers.length; i++) {
653
                                HashSet nuevo = new HashSet(layers[i].getAllSrs());
654
                try{
655
                    Iterator it = srsSet.iterator();
656
                                    while (it.hasNext()) {
657
                                        String srs = (String) it.next();
658
                                        
659
                                        if (!nuevo.contains(srs)) {
660
                                            srsSet.remove(srs);
661
                                        }
662
                                    }
663
                                } catch (ConcurrentModificationException e){
664
                    // just ignore it and wait the user for do something.
665
                    // this is tipically caused by a fast dialog manipulation.
666
                                }
667
                        }
668
            // And now, I'm adding the service SRS
669
            srsSet.addAll(((WMSLayerNode)getTreeLayers().getModel().getRoot()).getAllSrs());
670
            
671
                        DefaultListModel model = new DefaultListModel();
672
                        String[] array = (String[]) srsSet.toArray(new String[0]);
673

    
674
                        for (int i = 0; i < array.length; i++) {
675
                                model.addElement(array[i]);
676
                        }
677

    
678
                        lstSRSs.setModel(model);
679
                }
680
        int srsIndex = getSRSIndex( oldSrs );
681
        if (srsIndex!=-1)
682
            getLstSRSs().setSelectedIndex(srsIndex);
683
        
684
        }
685

    
686
        public void setListenerSupport(WizardListenerSupport support) {
687
                listenerSupport = support;
688
        }
689

    
690
        public void setWizardData(WMSWizardData data) {
691
                this.dataSource = data;
692
                ((JDnDListModel) getLstSelectedLayers().getModel()).clear();
693
                getLstSelectedLayers().repaint();
694
        
695
                getLstFormats().setModel(new FormatListModel(this.dataSource.getFormats()));
696
                getTreeLayers().setModel(new LayerTreeModel(this.dataSource.getLayer()));
697
        
698
        getTabInfo().refresh(dataSource, 
699
                             selectedLayersVector(),
700
                             getStyleTitles(),
701
                             getFormat(),
702
                             getSRS(),
703
                             getDimensions());
704
        }
705

    
706
        
707
    private Vector getStyleTitles() {
708
        return getTabStyle().getStyleTree().getStyleSelectionTitles();
709
    }
710

    
711
    /**
712
     * @return
713
     */
714
    private Vector selectedLayersVector() {
715
        JDnDListModel mod = (JDnDListModel) getLstSelectedLayers().getModel();
716
        Vector lyrs = new Vector();
717
        for (int i = 0; i < mod.getSize(); i++) {
718
            lyrs.add(mod.getElementAt(i));
719
        }
720
        return lyrs;
721
    }
722

    
723
    public String getFormat() {
724
                return (String) getLstFormats().getSelectedValue();
725
        }
726

    
727
        public String getLayersQuery() {
728
        ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel()).getElements();
729
        WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]);
730
        
731
                //Nombre separado por comas de las capas
732
                String layersQuery = layers[0].getName();
733

    
734
                for (int i = 1; i < layers.length; i++) {
735
                        layersQuery += ("," + layers[i].getName());
736
                }
737

    
738
                return layersQuery;
739
                
740
        }
741

    
742
        public String getSRS() {
743
                return (String) getLstSRSs().getSelectedValue();
744
        }
745

    
746
        public String getLayerName() {
747
                return getJTxtNomCapa().getText();        
748
        }
749
        
750
    public Rectangle2D getLayersRectangle(){
751
        ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel()).getElements();
752
        WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]);
753
        String[] layerNames = new String[layers.length];
754
        for (int i = 0; i < layerNames.length; i++) {
755
            layerNames[i] = layers[i].getName();
756
        }
757
        //Boundingbox de todas las capas
758
        ArrayList rectangulos = new ArrayList();
759
        
760
        Rectangle2D rect;
761
        
762
        for (int i = 0; i < layers.length; i++) {
763
            rect = dataSource.getBoundingBox(layerNames, getSRS());
764
            
765
            if (rect != null) {
766
                rectangulos.add(rect);
767
            }
768
        }
769
        
770
        rect = getRectangle((Rectangle2D.Double[]) rectangulos.toArray(
771
                new Rectangle2D.Double[0]));
772
        
773
        return rect;
774
    }
775
    
776
        public TreePath[] getSelectedLayers() {
777
                return getTreeLayers().getSelectionPaths();
778
        }
779
        
780
        /**
781
         * Obtiene el rect?ngulo que contiene a todos los otros
782
         *
783
         * @param rects rectangulos
784
         *
785
         * @return Rectangulo que contiene a todos los demas
786
         */
787
        private Rectangle2D getRectangle(Rectangle2D[] rects) {
788
                Rectangle2D ret = rects[0];
789

    
790
                for (int i = 1; i < rects.length; i++) {
791
                        ret.add(rects[i]);
792
                }
793

    
794
                return ret;
795
        }
796

    
797
    /**
798
     * The piece of the GetMap request that has the layer names.
799
     * @return
800
     */
801
        public String getQueryableLayerQuery() {
802
        ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel()).getElements();
803
        WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]);
804
        //Nombre separado por comas de las capas
805
                String layersQuery = "";
806
                int i;
807

    
808
                for (i = 0; i < layers.length; i++) {
809
                        if (layers[i].isQueryable()) {
810
                                layersQuery = layers[i].getName();
811

    
812
                                break;
813
                        }
814
                }
815

    
816
                for (int j = i + 1; j < layers.length; j++) {
817
                        if (layers[j].isQueryable()) {
818
                                layersQuery += ("," + layers[j].getName());
819
                        }
820
                }
821

    
822
                return layersQuery;
823
        }
824

    
825
        /**
826
         * Returns the index of the CRS within the CRS list.
827
         * 
828
         * Devuelve la posicion que ocupa el CRS en la lista de CRS
829
         * 
830
         * @param crs
831
         * @return The CRS's index if it exists, -1 if it not exists.
832
         */
833
        public int getSRSIndex(String crs) {
834
                for (int i=0; i<getLstSRSs().getModel().getSize(); i++){
835
                        if (crs!=null && crs.equals(getLstSRSs().getModel().getElementAt(i)))
836
                                return i;
837
                }
838
                return -1;
839
        }
840
        
841
        /**
842
         * Returns the index of the format within the formats list.
843
         * 
844
         * Devuelve la posicion que ocupa el formato en la lista de formatos
845
         * @param format
846
         * 
847
         * @return The format's index if it exists, -1 if it not exists.
848
         */
849
        public int getFormatIndex(String format) {
850
                for (int i=0; i<getLstFormats().getModel().getSize(); i++){
851
                        if (format!=null && format.equals(getLstFormats().getModel().getElementAt(i)))
852
                                return i;
853
                }
854
                return -1;
855
        }
856

    
857
        /**
858
         * This method initializes jTabbedPane        
859
         *         
860
         * @return javax.swing.JTabbedPane        
861
         */    
862
        public JTabbedPane getJTabbedPane() {
863
                if (jTabbedPane == null) {
864
                        jTabbedPane = new JTabbedPane();
865
                        jTabbedPane.setBounds(3, 3, 475, 415);
866
            InfoPanel ip = getTabInfo();
867
            ip.addFocusListener(new FocusListener(){
868
                public void focusGained(FocusEvent e) {
869
                    getTabInfo().refresh(dataSource, 
870
                                         selectedLayersVector(),
871
                                         getStyleTitles(),
872
                                         getFormat(),
873
                                         getSRS(),
874
                                         getDimensions());
875
                }
876
                public void focusLost(FocusEvent e) {
877
                }
878
            });
879
            
880
            StylesPanel sp = getTabStyle();
881
            DimensionPanel1 dp = getTabDimensions();
882
            
883
            
884
                        jTabbedPane.addTab(PluginServices.getText(this, "info"), null, ip, null);
885
                        jTabbedPane.addTab(PluginServices.getText(this, "capas"), null, getTabLayers(), null);
886
                        jTabbedPane.addTab(PluginServices.getText(this, "estilos"), null, sp, null);
887
            stylesTabIndex = jTabbedPane.getTabCount()-1;
888
            jTabbedPane.addTab(PluginServices.getText(this, "dimensiones"), null, dp, null);
889
            dimensionTabIndex = jTabbedPane.getTabCount()-1;
890
            jTabbedPane.addTab(PluginServices.getText(this, "formatos"), null, getTabFormats(), null);
891
            jTabbedPane.setEnabledAt(dimensionTabIndex, false);
892
            jTabbedPane.setEnabledAt(stylesTabIndex, false);
893
                }
894
                return jTabbedPane;
895
        }
896

    
897
        /**
898
         * This method initializes jPanel        
899
         *         
900
         * @return javax.swing.JPanel        
901
         */    
902
        private JPanel getTabLayers() {
903
                if (tabLayers == null) {
904
                        tabLayers = new JPanel();
905
                        tabLayers.setLayout(null);
906
                        tabLayers.add(getJPanel4(), null);
907
                        tabLayers.add(getJPanel2(), null);
908
                }
909
                return tabLayers;
910
        }
911

    
912
        /**
913
         * This method initializes jPanel1        
914
         *         
915
         * @return javax.swing.JPanel        
916
         */    
917
        private JPanel getJPanel1() {
918
                if (jPanel1 == null) {
919
                        jPanel1 = new JPanel();
920
                        jPanel1.setLayout(null);
921
            jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(
922
                    null, PluginServices.getText(this, "seleccionar_formato"),
923
                    javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
924
                    javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
925
                        jPanel1.setBounds(7, 10, 453, 194);
926
                        jPanel1.add(getJScrollPane6(), null);
927
                        jPanel1.add(getChkTransparency(), null);
928
                }
929
                return jPanel1;
930
        }
931

    
932
        /**
933
         * This method initializes jPanel5        
934
         *         
935
         * @return javax.swing.JPanel        
936
         */    
937
        private JPanel getJPanel5() {
938
                if (jPanel5 == null) {
939
                        jPanel5 = new JPanel();
940
                        jPanel5.setLayout(null);
941
            jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(
942
                    null, PluginServices.getText(this, "seleccionar_srs"),
943
                    javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
944
                    javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
945
                        jPanel5.setBounds(7, 210, 453, 168);
946
                        jPanel5.add(getJScrollPane2(), null);
947
                }
948
                return jPanel5;
949
        }
950

    
951
        /**
952
         * This method initializes jPanel6        
953
         *         
954
         * @return javax.swing.JPanel        
955
         */    
956
        private StylesPanel getTabStyle() {
957
                if (tabStyle == null) {
958
                        tabStyle = new StylesPanel();
959
            tabStyle.setEnabled(false);
960
                }
961
                return tabStyle;
962
        }
963
                
964
        /**
965
         * Sets the focus to the tab next to the current one.
966
         * 
967
         * Enfoca a la solapa siguiente a la actualmente enfocada del TabbedPane
968
         *
969
         */
970
        public void avanzaTab(){
971
                int currentPage = currentPage();
972
                int nPages = getNumTabs();
973
                if (nPages -1 > currentPage){
974
                        getJTabbedPane().setSelectedIndex(nextEnabledPage());
975
                }
976
        }
977
        
978
        /**
979
         * Sets the focus to the tab previous to the current one. 
980
         * 
981
         * Enfoca a la solapa anterior a la actualmente enfocada del TabbedPane
982
         * 
983
         */
984
        public void retrocedeTab(){
985
                this.getJTabbedPane().setSelectedIndex(previousEnabledPage());
986
                
987
        }
988
    /**
989
     * Returns the index of the current tab.
990
     * 
991
     * Devuelve el ?ndice de la p?gina actual del wizard.
992
     * 
993
     * @return
994
     */
995
    public int currentPage(){
996
        return getJTabbedPane().getSelectedIndex();
997
    }
998
    
999
        /**
1000
         * Returns the tab amount that the WMSParamsPanel currently have
1001
         * 
1002
         * Devuelve el n?mero de solapas que tiene actualmente el WMSParamsPanel
1003
         * 
1004
         * @return int
1005
         */
1006
        public int getNumTabs(){
1007
                return getJTabbedPane().getTabCount();
1008
        }
1009
        
1010
    
1011
        /**
1012
     * <p>
1013
     * Returns the index of the previous enabled tab.
1014
     * </p>
1015
     * <p>
1016
     * Devuelve el ?ndice de la anterior p?gina habilitada del wizard o -1 si no hay
1017
     * ninguna.
1018
     * </p>
1019
    * @return The index, or -1 if there is no one.
1020
     */
1021
    public int previousEnabledPage(){
1022
        int currentPage = currentPage();
1023
        int j=0;
1024
        if (currentPage == 0)
1025
            j= -1;
1026
        for (int i = currentPage-1; i>-1; i--){
1027
            if (getJTabbedPane().isEnabledAt(i)){
1028
                j= i;
1029
                    break;
1030
            }
1031
        }
1032
        return j;
1033
    }
1034
    
1035
    /**
1036
     * <p>
1037
     * Returns the previous of the previous enabled tab.
1038
     * </p>
1039
     * <p>
1040
     * Devuelve el ?ndice de la siguiente p?gina habilitada del wizard o -1 si no hay
1041
     * ninguna.
1042
     * </p>
1043
     * @return The index, or -1 if there is no one.
1044
     */
1045
    public int nextEnabledPage() {
1046
        int currentPage = currentPage();
1047
        int nPages = getNumTabs();
1048
        if (currentPage == nPages)
1049
                return -1;
1050
        for (int i=currentPage+1; i<nPages; i++){
1051
            if (getJTabbedPane().isEnabledAt(i)){
1052
                return i;
1053
            }
1054
        }
1055
        return -1;
1056
    }
1057
    
1058
    /**
1059
     * Selects/deselects the transparency checkbox.
1060
     * @param b
1061
     */
1062
    public void setTransparent(boolean b) {
1063
            getChkTransparency().setEnabled(b);
1064
    }
1065
    /**
1066
     * This method initializes chkTrasparency        
1067
     *         
1068
     * @return javax.swing.JCheckBox        
1069
     */    
1070
    private JCheckBox getChkTransparency() {
1071
            if (chkTransparency == null) {
1072
                    chkTransparency = new JCheckBox();
1073
            chkTransparency.setText(PluginServices.getText(this, "wms_transparency"));
1074
            chkTransparency.setSelected(true);
1075
                    chkTransparency.setBounds(5, 168, 441, 21);
1076
            }
1077
            return chkTransparency;
1078
    }
1079

    
1080
    
1081
    /**
1082
     * Returns a vector of strings containing the styles selected for the
1083
     * layers. A blank style is correct and means that default style will 
1084
     * be used.
1085
     * 
1086
     * @return Vector
1087
     */
1088
    public Vector getStyles() {
1089
        return getTabStyle().getStyleTree().getStylesSelection();
1090
    }
1091

    
1092
    /**
1093
     * This method initializes tabInfo        
1094
     *         
1095
     * @return javax.swing.JPanel        
1096
     */    
1097
    private InfoPanel getTabInfo() {
1098
            if (tabInfo == null) {
1099
                    tabInfo = new InfoPanel();
1100
                    
1101
            }
1102
            return tabInfo;
1103
    }
1104

    
1105

    
1106
    public void setDimensions(Vector dimensions) {
1107
            for (int i = 0; i < dimensions.size(); i++) {
1108
                        String[] s = ((String) dimensions.get(i)).split("=");
1109
                        getTabDimensions().setDimensionValue(s[0], s[1]);
1110
                }
1111
            
1112
    }
1113

    
1114

    
1115
    /**
1116
     * This method initializes tabDimension        
1117
     *         
1118
     * @return javax.swing.JPanel        
1119
     */    
1120
    private DimensionPanel1 getTabDimensions() {
1121
            if (tabDimensions == null) {
1122
                    tabDimensions = new DimensionPanel1();
1123
            tabDimensions.setEnabled(false);
1124
            
1125
            }
1126
            return tabDimensions;
1127
    }
1128

    
1129
    
1130

    
1131
    /**
1132
     * @return
1133
     */
1134
    public boolean getTransparency() {
1135
        return getChkTransparency().isSelected();
1136
    }
1137

    
1138
    /**
1139
     * @return
1140
     */
1141
    public Vector getDimensions() {
1142
        return getTabDimensions().getDimensions();
1143
    }
1144

    
1145
        public void initWizard() {}
1146
        public void execute() {        }
1147
        public FLayer getLayer() {        return null; }
1148

    
1149
        public FMapWMSDriver getDriver() {
1150
                return dataSource.getDriver();
1151
        }
1152
}  //  @jve:decl-index=0:visual-constraint="10,10"
1153

    
1154

    
1155
/**
1156
 * Panel de informaci?n del Service
1157
 */
1158

    
1159
class InfoPanel extends JPanel {
1160
    private final String bgColor0 = "\"#FEEDD6\""; // light salmon
1161
    private final String bgColor1 = "\"#EAEAEA\""; // light grey
1162
    private final String bgColor2 = "\"#F2FEFF\""; // light blue
1163
    private final String bgColor3 = "\"#FBFFE1\""; // light yellow
1164
    
1165
    private final String service_title       = PluginServices.getText(this, "service_info");
1166
    private final String server              = PluginServices.getText(this, "server");
1167
    private final String server_type         = PluginServices.getText(this, "server_type");
1168
    private final String server_abstract     = PluginServices.getText(this, "server_abstract");
1169
    private final String server_title        = PluginServices.getText(this, "server_title");
1170
    private final String layers_title        = PluginServices.getText(this, "selected_layers");
1171
    private final String layer_title         = PluginServices.getText(this, "layer_title");
1172
    private final String layer_abstract      = PluginServices.getText(this, "layer_abstract");
1173
    private final String selected_dimensions = PluginServices.getText(this, "selected_dimensions");
1174
    private final String style               = PluginServices.getText(this, "style");
1175
    private final String format_title        = PluginServices.getText(this, "format");
1176
    private final String srs_title           = "SRS";
1177
        private JEditorPane editor = null;
1178
    
1179
    
1180
    
1181
        public InfoPanel() {
1182
                super();
1183
        setLayout(null);
1184
        JScrollPane src = new JScrollPane();
1185
        src.setBounds(5, 5, 455, 375);
1186
        add(src, null);
1187
        src.setViewportView(getEditor());
1188
        }
1189

    
1190
    /**
1191
     * This method initializes tblInfo  
1192
     *  
1193
     * @return javax.swing.JTable   
1194
     */    
1195
    private JEditorPane getEditor() {
1196
        if (editor == null) {
1197
            editor = new JEditorPane();
1198
            editor.setEditable(false);
1199
        }
1200
        return editor;
1201
    }
1202

    
1203
    
1204
    /**
1205
     * Rellena la tabla de datos de informaci?n del servicio.
1206
     * @param dataSource
1207
     */
1208
    
1209
    public void refresh(WMSWizardData dataSource, Vector layers, Vector styles, String format, String srs, Vector dimensions) {
1210
        
1211
        String server_text = dataSource.getHost();
1212
        String server_type_text = dataSource.getServerType();
1213
        String server_title_text = dataSource.getTitle(); 
1214
        String server_abstract_text = dataSource.getAbstract();
1215
        String font = "Arial";
1216
        
1217
        if (server_text == null) 
1218
            server_text = "-";
1219
        if (server_type_text == null)
1220
            server_type_text = "-";
1221
        if (server_title_text == null)
1222
            server_title_text = "-";
1223
        if (server_abstract_text == null)
1224
            server_abstract_text = "-";
1225
        
1226
        if (format == null)
1227
            format = PluginServices.getText(this, "none_selected");
1228
        if (srs == null)
1229
            srs = PluginServices.getText(this, "none_selected");
1230
        
1231
        String layers_html = "";
1232
        for (int i = 0; i < layers.size(); i++) {
1233
            WMSLayerNode layer = (WMSLayerNode) layers.get(i);
1234
            String style_title = (styles==null) ? PluginServices.getText(this, "not_available") : (String) styles.get(i);//((FMapWMSStyle) selectedStyles.get(i)).title;
1235
            String layer_abstract_text = layer.getAbstract();
1236
            String layer_title_text = layer.getTitle();
1237
            String layer_html =
1238
                "  <tr valign=\"top\">" +
1239
                "     <td width=\"119\" height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\"><b>"+layer_title+"</b></font></td>" +
1240
                "     <td width=\"322\" height=\"18\" bgcolor="+bgColor1+"><font face=\"Arial\" size=\"3\">"+layer_title_text+"</font></td>" +
1241
                "  </tr>" +
1242
                "  <tr valign=\"top\">" +
1243
                "     <td bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\" align=\"right\"><b>"+layer_abstract+"</b></font></td>" +
1244
                "     <td bgcolor="+bgColor0+"><font face=\"Arial\" size=\"3\">"+layer_abstract_text+"</font></td>" +
1245
                "  </tr>" +
1246
                "  <tr valign=\"top\">" +
1247
                "     <td bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\" align=\"right\"><b>"+style+"</b></font></td>" +
1248
                "     <td bgcolor="+bgColor2+"><font face=\"Arial\" size=\"3\">"+style_title+"</font></td>" +
1249
                "  </tr>" +
1250
                "  <tr>" +
1251
                "  </tr>";
1252
            layers_html += layer_html;
1253
        }
1254
        if (!layers_html.equals(""))
1255
            layers_html =
1256
                "  <tr valign=\"top\" bgcolor=\"#FFFFFF\">" +
1257
                "    <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+layers_title+"</font></b></td>" +
1258
                "  </tr>" + layers_html;
1259
        String dimension_html = "";
1260
        if (dimensions!=null) {
1261
                boolean swap = false;
1262
                for (int i = 0; i < dimensions.size(); i++) {
1263
                        String color = swap ? bgColor0 : bgColor1;
1264
                        String[] dimension = ((String) dimensions.get(i)).split("=");
1265
                        dimension_html +=
1266
                                "  <tr valign=\"top\" bgcolor="+color+">" +
1267
                                "    <td width=\"120\" height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><b>"+dimension[0]+"</b></td>" +
1268
                                "    <td width=\"322\" height=\"18\">"+dimension[1]+"</td>" +
1269
                                "  </tr>";
1270
                        swap = !swap;
1271
                }
1272
        }        
1273
        if (!dimension_html.equals(""))
1274
                dimension_html = 
1275
                        "  <tr valign=\"top\">" +
1276
                        "    <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+selected_dimensions+"</font></b></td>" +
1277
                        "  </tr>" + dimension_html;
1278
        
1279
        String html = 
1280

    
1281
            "<html>" +
1282
            "<body>" +
1283
            "<table align=\"center\" width=\"437\" height=\"156\" border=\"0\" cellpadding=\"4\" cellspacing=\"4\">" +
1284
            "  <tr valign=\"top\" bgcolor=\"#FFFFFF\">" +
1285
            "    <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+service_title+"</font></b></td>" +
1286
            "  </tr>" +
1287
            "  <tr valign=\"top\" bgcolor="+bgColor0+">" +
1288
            "    <td width=\"92\" height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server+"</font></b></td>" +
1289
            "    <td width=\"268\"><font face=\""+font+"\" size=\"3\">"+server_text+"</font></td>" +
1290
            "  </tr>" +
1291
            "  <tr valign=\"top\" bgcolor="+bgColor1+">" +
1292
            "    <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server_type+"</b></font></td>" +
1293
            "    <td><font face=\""+font+"\" size=\"3\">"+server_type_text+"</font></td>" +
1294
            "  </tr>" +
1295
            "  <tr valign=\"top\" bgcolor="+bgColor0+">" +
1296
            "    <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server_title+"</b></font></td>" +
1297
            "    <td><font face=\""+font+"\" size=\"3\"><font face=\""+font+"\" size=\"3\">"+server_title_text+"</font></td>" +
1298
            "  </tr>" +
1299
            "  <tr valign=\"top\" bgcolor="+bgColor1+">" +
1300
            "    <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server_abstract+"</font></b></td>" +
1301
            "    <td><font face=\""+font+"\" size=\"3\">"+server_abstract_text+"</font></td>" +
1302
            "  </tr>" +
1303
            "  <tr valign=\"top\" bgcolor="+bgColor0+">" +
1304
            "    <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+format_title+"</b></font></td>" +
1305
            "    <td><font face=\""+font+"\" size=\"3\"><font face=\""+font+"\" size=\"3\">"+format+"</font></td>" +
1306
            "  </tr>" +
1307
            "  <tr valign=\"top\" bgcolor="+bgColor1+">" +
1308
            "    <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+srs_title+"</font></b></td>" +
1309
            "    <td><font face=\""+font+"\" size=\"3\">"+srs+"</font></td>" +
1310
            "  </tr>" +
1311
            
1312
            "  <tr>" +
1313
            "  </tr>" +
1314
            layers_html +
1315
            dimension_html +
1316
            "</table>" +
1317
            "</body>" +
1318
            "</html>";
1319
        
1320
        getEditor().setContentType("text/html");
1321
        getEditor().setText(html);
1322
    }
1323
}
1324

    
1325
class StylesPanel extends JPanel{
1326
    private JScrollPane jScrollPane = null;
1327
    private StyleTree treeStyles = null;
1328
    public StylesPanel(){
1329
        super();
1330
        setLayout(null);
1331
        add(getJScrollPane(), null);
1332
    }
1333
    /**
1334
     * This method initializes jScrollPane3 
1335
     *  
1336
     * @return javax.swing.JScrollPane  
1337
     */    
1338
    private JScrollPane getJScrollPane() {
1339
        if (jScrollPane == null) {
1340
            jScrollPane = new JScrollPane();
1341
            jScrollPane.setBounds(7, 50, 455, 327);
1342
            jScrollPane.setViewportView(getStyleTree());
1343
        }
1344
        return jScrollPane;
1345
    }
1346
    
1347
    /**
1348
     * This method initializes treeStyles   
1349
     *  
1350
     * @return javax.swing.JTree    
1351
     */    
1352
    public StyleTree getStyleTree() {
1353
        if (treeStyles == null) {
1354
            treeStyles = new StyleTree();
1355
        }
1356
        return treeStyles;
1357
    }
1358
}
1359

    
1360
class DimensionPanel extends JPanel {
1361
    
1362
    private JScrollPane jScrollPane;
1363
    private DimensionTree tree;
1364

    
1365
    public DimensionPanel(){
1366
        super();
1367
        setLayout(null);
1368
        setLayout(null);
1369
        add(getJScrollPane(), null);
1370
        
1371
    }
1372
    /**
1373
     * This method initializes jScrollPane3 
1374
     *  
1375
     * @return javax.swing.JScrollPane  
1376
     */    
1377
    private JScrollPane getJScrollPane() {
1378
        if (jScrollPane == null) {
1379
            jScrollPane = new JScrollPane();
1380
            jScrollPane.setBounds(7, 50, 455, 327);
1381
            jScrollPane.setViewportView(getDimensionTree());
1382
        }
1383
        return jScrollPane;
1384
    }
1385
    
1386
    /**
1387
     * This method initializes treeStyles   
1388
     *  
1389
     * @return javax.swing.JTree    
1390
     */    
1391
    public DimensionTree getDimensionTree() {
1392
        if (tree == null) {
1393
            tree = new DimensionTree();
1394
        }
1395
        return tree;
1396
    }
1397
}
1398

    
1399