Statistics
| Revision:

root / branches / piloto3d / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / view / legend / scale / gui / FPanelScaleManager.java @ 9529

History | View | Annotate | Download (25.3 KB)

1
/*
2
 * Created on 31-ene-2005
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib??ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
package com.iver.cit.gvsig.project.documents.view.legend.scale.gui;
45

    
46
import java.awt.BorderLayout;
47
import java.text.NumberFormat;
48

    
49
import javax.swing.ButtonGroup;
50
import javax.swing.DefaultComboBoxModel;
51
import javax.swing.JCheckBox;
52
import javax.swing.JComboBox;
53
import javax.swing.JLabel;
54
import javax.swing.JPanel;
55
import javax.swing.JRadioButton;
56
import javax.swing.JScrollPane;
57
import javax.swing.JTextArea;
58
import javax.swing.JTextField;
59

    
60
import org.apache.log4j.Logger;
61

    
62
import com.hardcode.gdbms.engine.data.DataSource;
63
import com.iver.andami.PluginServices;
64
import com.iver.andami.messages.NotificationManager;
65
import com.iver.cit.gvsig.fmap.DriverException;
66
import com.iver.cit.gvsig.fmap.MapContext;
67
import com.iver.cit.gvsig.fmap.drivers.DBLayerDefinition;
68
import com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter;
69
import com.iver.cit.gvsig.fmap.layers.FLayer;
70
import com.iver.cit.gvsig.fmap.layers.FLyrDefault;
71
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
72
import com.iver.cit.gvsig.fmap.layers.ReadableVectorial;
73
import com.iver.cit.gvsig.fmap.layers.VectorialAdapter;
74
import com.iver.cit.gvsig.fmap.layers.VectorialDBAdapter;
75
import com.iver.cit.gvsig.fmap.layers.VectorialFileAdapter;
76
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData;
77
import com.iver.cit.gvsig.fmap.rendering.Legend;
78
import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend;
79
import com.iver.cit.gvsig.project.documents.view.IProjectView;
80
import com.iver.cit.gvsig.project.documents.view.legend.gui.AbstractPanel;
81
import com.iver.cit.gvsig.project.documents.view.legend.gui.FPanelLegendValues;
82
/**
83
 * @author jmorell
84
 *
85
 * TODO To change the template for this generated type comment go to
86
 * Window - Preferences - Java - Code Style - Code Templates
87
 */
88
public class FPanelScaleManager extends AbstractPanel {
89

    
90
        private static final long serialVersionUID = 1L;
91
    private static Logger logger = Logger.getLogger(FPanelLegendValues.class.getName());
92
        private FLayer layer;
93
    //private ComandosListener actionListener = new ComandosListener(this);
94
        private IProjectView view;
95
        private NumberFormat nf = NumberFormat.getInstance();
96

    
97
        private JPanel jPanel = null;
98
        private JPanel jPanel1 = null;
99
        private JPanel jPanel2 = null;
100
        private JPanel jPanel4 = null;
101
        private JPanel jPanel5 = null;
102
        private JLabel jLabel = null;
103
        private JTextField txtLayerName = null;
104
        private JLabel jLabel1 = null;
105
        private JTextField jTextField1 = null;
106
        private JLabel jLabel2 = null;
107
        private JTextArea jTextArea = null;
108
        private JScrollPane jScrollPane = null;
109
        private ButtonGroup buttonGroup = null;
110
        private JRadioButton jRadioButton = null;
111
        private JRadioButton jRadioButton1 = null;
112
        private JLabel jLabel3 = null;
113
        private JTextField jTextField2 = null;
114
        private JLabel jLabel4 = null;
115
        private JPanel jPanel3 = null;
116
    private JPanel jPanel6 = null;
117
    private JPanel jPanel7 = null;
118
    private JPanel jPanel8 = null;
119
    private JLabel jLabel5 = null;
120
    private JComboBox jComboBox = null;
121
    private JLabel jLabel6 = null;
122
    private JTextField jTextField = null;
123
    private JLabel jLabel7 = null;
124
    private JComboBox jComboBox1 = null;
125
    private JCheckBox jCheckBoxSpatialIndex = null;
126
    /**
127
         * This is the default constructor
128
         */
129
        public FPanelScaleManager() {
130
                super();
131
                initialize();
132
        }
133
        /**
134
         * This method initializes this
135
         *
136
         * @return void
137
         */
138
        private  void initialize() {
139
                //setView();
140
                this.setLayout(null);
141
                //this.setLayer(null);
142
                this.setBounds(0, 0, 635, 352);
143
                this.add(getJCheckBoxSpatialIndex(), null);
144
                this.add(getJPanel(), null);
145
                this.add(getJPanel1(), null);
146
                this.add(getJPanel2(), null);
147
                this.add(getJPanel3(), null);
148
        }
149

    
150

    
151
    /**
152
     * Inicializa el ProjectView view. Es necesario para implementar el control de
153
     * escalas y para hiperenlazar documentos.
154
     * @return
155
     */
156
    /*private void setView() {
157
                View vista = (View) PluginServices.getMDIManager().getActiveView();
158
            view = vista.getModel();
159
    }*/
160

    
161
    /**
162
     * En esta funci?n se coge el primer tema activo del TOC y se usa su
163
     * renderer para inicializar. Hay que llamarla SIEMPRE que se abra el
164
     * cuadro de di?logo, en el  openLegendManager() de la vista.
165
     *
166
     * @param mapContext TOC que abre este cuadro de di?logo.
167
     * @throws DriverException
168
     */
169
    public void setMapContext(MapContext mapContext) throws DriverException {
170
        layer = getFirstActiveLayerVect(mapContext.getLayers());
171
               /*try {
172
                                ClassifiableVectorial aux = (ClassifiableVectorial) layer;
173
                                renderer = (Legend) aux.getLegend().cloneLegend();
174
                        } catch (XMLException e) {
175
                                // TODO Auto-generated catch block
176
                                e.printStackTrace();
177
                        }*/
178
        actualizar();
179
    }
180

    
181
    /**
182
     * DOCUMENT ME!
183
     */
184
    private void actualizar() {
185
            // Avisar si no es Vectorial
186
            //FLayer lyrSelected = getFirstActiveLayerVect(mapContext.getLayers());
187

    
188
        /*m_defaultLegendPanel.setLayer(lyrSelected, renderer);
189
        m_valuesLegendPanel.setLayer(lyrSelected, renderer);
190
        m_breaksLegendPanel.setLayer(lyrSelected, renderer);
191
        m_labelsLegendPanel.setLayer(lyrSelected, renderer);*/
192

    
193
        /*CardLayout cl = (CardLayout)(cards.getLayout());
194
        if (renderer instanceof SingleSymbolLegend) {
195
                //organizador.setSelectedIndex(0);
196
            cl.show(cards, "symbol");
197
        }
198
        if (renderer instanceof UniqueValueLegend) {
199
                //organizador.setSelectedIndex(1);
200
            cl.show(cards, "values");
201
        }
202
        if (renderer instanceof IntervalLegend) {
203
                //organizador.setSelectedIndex(2);
204
            cl.show(cards, "intervals");
205
        }*/
206

    
207
        /* switch (m_Renderer.getLegendType()) {
208
        case FConstant.LEGEND_TYPE_DEFAULT:
209
            organizador.setSelectedIndex(0);
210

211
            break;
212

213
        case FConstant.LEGEND_TYPE_VALUE:
214
            organizador.setSelectedIndex(1);
215

216
            break;
217

218
        case FConstant.LEGEND_TYPE_BREAK:
219
            organizador.setSelectedIndex(2);
220

221
            break;
222
        } */
223
    }
224

    
225
        private void fillFieldNames() {
226
                DataSource rs;
227
                try {
228
                        rs = ((AlphanumericData)layer).getRecordset();
229
                        logger.debug("rs.start()");
230
                        rs.start();
231
                        String[] nomFields = new String[rs.getFieldCount()];
232
                        for (int i = 0; i < rs.getFieldCount(); i++) {
233
                                nomFields[i] = rs.getFieldName(i).trim();
234
                        }
235
                        rs.stop();
236
                // fieldsListValor.setSelectedIndex(0);
237
                } catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
238
                        // TODO Auto-generated catch block
239
                        e.printStackTrace();
240
                } catch (DriverException e) {
241
                        e.printStackTrace();
242
                }
243
        }
244

    
245
        public void setLayer(FLayer lyr, Legend r) {
246
        if (lyr instanceof FLyrVect)
247
        {
248
            FLyrVect lyrVect = (FLyrVect) lyr;
249
//            if (lyrVect.getSpatialIndex() == null)//azabala
250
            if(lyrVect.getISpatialIndex() == null)
251
            {
252
                getJCheckBoxSpatialIndex().setSelected(false);
253
            }
254
            else
255
            {
256
                getJCheckBoxSpatialIndex().setSelected(true);
257
            }
258
        }
259
                if (layer.getMinScale() != -1)
260
                    getJTextField1().setText(nf.format(layer.getMinScale()));
261
                if (layer.getMaxScale() != -1)
262
                    getJTextField2().setText(nf.format(layer.getMaxScale()));
263
                if (layer.getMinScale() == -1 && layer.getMaxScale() == -1) {
264
                        getJRadioButton().setSelected(true);
265
                        jLabel1.setEnabled(false);
266
                        jTextField1.setEnabled(false);
267
                        jLabel2.setEnabled(false);
268
                        jLabel3.setEnabled(false);
269
                        jTextField2.setEnabled(false);
270
                        jLabel4.setEnabled(false);
271
                } else {
272
                        getJRadioButton1().setSelected(true);
273
                        jLabel1.setEnabled(true);
274
                        jTextField1.setEnabled(true);
275
                        jLabel2.setEnabled(true);
276
                        jLabel3.setEnabled(true);
277
                        jTextField2.setEnabled(true);
278
                        jLabel4.setEnabled(true);
279
                }
280
                fillFieldNames();
281
                //getJComboBox().getModel().setSelectedItem(renderer.getFieldName());
282
                layer = lyr;
283
                txtLayerName.setText(layer.getName());
284
                showLayerInfo();
285
                /*
286
                try {
287
                        getJTextArea().setText(PluginServices.getText(this,"Extent") + "\n\t" + PluginServices.getText(this,"Superior") + ":\t" + layer.getFullExtent().getMaxY() + "\n\t" + PluginServices.getText(this,"Inferior") + ":\t" + layer.getFullExtent().getMinY() + "\n\t" + PluginServices.getText(this,"Izquierda") + ":\t" + layer.getFullExtent().getMinX() + "\n\t" + PluginServices.getText(this,"Derecha") + ":\t" + layer.getFullExtent().getMaxX() + "\n\n" + PluginServices.getText(this,"Origen_de_datos") + ": " + layer.getName());
288
                } catch (DriverException e) {
289
                        // TODO Auto-generated catch block
290
                        e.printStackTrace();
291
                }
292
                */
293

    
294
        // Me parece que es aqu? donde hay que montar el jComboBox ...
295
                if (PluginServices.getMainFrame() != null)
296
                if  (PluginServices.getMDIManager().getActiveWindow() instanceof com.iver.cit.gvsig.project.documents.view.gui.BaseView ){
297
                    com.iver.cit.gvsig.project.documents.view.gui.BaseView theView = (com.iver.cit.gvsig.project.documents.view.gui.BaseView)PluginServices.getMDIManager().getActiveWindow();
298
                    view = theView.getModel();
299
            try {
300
                if (layer instanceof AlphanumericData) {
301
                    AlphanumericData ad = (AlphanumericData) layer;
302
                    DataSource ds;
303
                    ds = ad.getRecordset();
304
                    String[] names = new String[ds.getFieldCount()];
305
                    for (int i = 0; i < ds.getFieldCount(); i++) {
306
                        names[i] = ds.getFieldName(i);
307
                    }
308
                    //jComboBox = new javax.swing.JComboBox(names);
309
                    DefaultComboBoxModel defaultModel = new DefaultComboBoxModel(names);
310
                    jComboBox.setModel(defaultModel);
311
                    if (view.getSelectedField() != null) {
312
                        jComboBox.setSelectedItem(view.getSelectedField());
313
                    }
314
                }else{
315
                    jComboBox = new javax.swing.JComboBox();
316
                }
317
            } catch (DriverException e) {
318
                NotificationManager.addError("No se pudo obtener la tabla", e);
319
            } catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
320
                NotificationManager.addError("No se pudo obtener la tabla", e);
321
            }
322
            //
323

    
324
            // y aqu? el jTextField ...
325
            if (view.getSelectedField() != null) {
326
                getJTextField().setText(view.getExtLink());
327
            }
328
            //
329

    
330
            // y aqu? el jComboBox1 ...
331
            //jComboBox1 = new javax.swing.JComboBox();
332
            getJComboBox1().addItem(PluginServices.getText(this,
333
                    "Enlazar_a_ficheros_de_imagen"));
334
            getJComboBox1().addItem(PluginServices.getText(this,
335
            "Enlazar_a_fichero_de_texto"));
336
            if (view.getSelectedField() != null) {
337
                getJComboBox1().setSelectedIndex(view.getTypeLink());
338
            }
339
            //
340
        }
341
                // Si es de valor ?nico, rellenamos la tabla
342
                // y seleccionamos el campo que estamos usando
343
                //m_symbolTable.removeAllItems();
344
                if (r instanceof VectorialUniqueValueLegend)
345
                {
346
                        //renderer = (VectorialUniqueValueLegend) r;
347
                        //m_cboFields.getModel().setSelectedItem(m_Renderer.getFieldName());
348
                        //m_symbolTable.fillTableFromSymbolList(m_Renderer.getSymbols(),
349
                                        //m_Renderer.getValues(), m_Renderer.getDescriptions());
350
                }
351
                /*else
352
                {
353
                        try {
354
                                // Si la capa viene con otro tipo de leyenda, creamos
355
                                // una nueva del tipo que maneja este panel
356
                                renderer = new VectorialUniqueValueLegend(layer.getShapeType());
357
                        } catch (com.iver.cit.gvsig.fmap.DriverException e) {
358
                                // TODO Auto-generated catch block
359
                                e.printStackTrace();
360
                        }
361
                }*/
362
        }
363

    
364
        /*public void setLayerName(String layerName)
365
        {
366
                this.layerName = layerName;
367
        }*/
368

    
369
        /**
370
         * This method initializes jPanel
371
         *
372
         * @return javax.swing.JPanel
373
         */
374
        private JPanel getJPanel() {
375
                if (jPanel == null) {
376
                        jLabel = new JLabel();
377
                        jPanel = new JPanel();
378
                        jPanel.setLayout(null);
379
                        jLabel.setText(PluginServices.getText(this,"Nombre") + ":");
380
                        jLabel.setComponentOrientation(java.awt.ComponentOrientation.UNKNOWN);
381
                        jLabel.setBounds(0, 3, 78, 15);
382
                        jPanel.setComponentOrientation(java.awt.ComponentOrientation.UNKNOWN);
383
                        jPanel.setLocation(5, 6);
384
                        jPanel.setSize(357, 20);
385
                        jPanel.add(jLabel, null);
386
                        jPanel.add(getTxtLayerName(), null);
387
                }
388
                return jPanel;
389
        }
390
        /**
391
         * This method initializes jPanel1
392
         *
393
         * @return javax.swing.JPanel
394
         */
395
        private JPanel getJPanel1() {
396
                if (jPanel1 == null) {
397
                        jPanel1 = new JPanel();
398
                        jPanel1.setLayout(null);
399
                        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this,"rango_de_escalas"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
400
                        jPanel1.setBounds(5, 61, 432, 137);
401
                        jPanel1.add(getJPanel4(), null);
402
                        jPanel1.add(getJPanel5(), null);
403
                }
404
                return jPanel1;
405
        }
406
        /**
407
         * This method initializes jPanel2
408
         *
409
         * @return javax.swing.JPanel
410
         */
411
        private JPanel getJPanel2() {
412
                if (jPanel2 == null) {
413
                        jPanel2 = new JPanel();
414
                        jPanel2.setLayout(null);
415
                        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this,"propiedades"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
416
                        jPanel2.setBounds(5, 196, 303, 155);
417
                        jPanel2.add(getJScrollPane(), null);
418
                }
419
                return jPanel2;
420
        }
421
        /**
422
         * This method initializes jPanel4
423
         *
424
         * @return javax.swing.JPanel
425
         */
426
        private JPanel getJPanel4() {
427
                if (jPanel4 == null) {
428
                        jPanel4 = new JPanel();
429
                        jPanel4.setLayout(null);
430
                        jPanel4.setBounds(6, 21, 398, 46);
431
                        jPanel4.add(getJRadioButton(), null);
432
                        jPanel4.add(getJRadioButton1(), null);
433
                        buttonGroup = new ButtonGroup();
434
                        buttonGroup.add(getJRadioButton());
435
                        buttonGroup.add(getJRadioButton1());
436
                }
437
                return jPanel4;
438
        }
439
        /**
440
         * This method initializes jPanel5
441
         *
442
         * @return javax.swing.JPanel
443
         */
444
        private JPanel getJPanel5() {
445
                if (jPanel5 == null) {
446
                        jLabel4 = new JLabel();
447
                        jLabel3 = new JLabel();
448
                        jLabel2 = new JLabel();
449
                        jLabel1 = new JLabel();
450
                        jPanel5 = new JPanel();
451
                        jPanel5.setLayout(null);
452
                        jLabel1.setText(PluginServices.getText(this,"este_por_debajo_de_"));
453
                        jLabel1.setBounds(6, 6, 138, 20);
454
                        jLabel1.setEnabled(false);
455
                        jLabel2.setText("(" + PluginServices.getText(this,"escala_minima") + ")");
456
                        jLabel2.setBounds(302, 6, 111, 20);
457
                        jLabel2.setEnabled(false);
458
                        jPanel5.setBounds(15, 69, 414, 53);
459
                        jLabel3.setBounds(6, 31, 138, 20);
460
                        jLabel3.setText(PluginServices.getText(this,"este_por_encima_de"));
461
                        jLabel3.setEnabled(false);
462
                        jLabel4.setBounds(302, 31, 111, 20);
463
                        jLabel4.setText("(" + PluginServices.getText(this,"escala_maxima") + ")");
464
                        jLabel4.setEnabled(false);
465
                        jPanel5.add(jLabel1, null);
466
                        jPanel5.add(getJTextField1(), null);
467
                        jPanel5.add(jLabel2, null);
468
                        jPanel5.add(jLabel3, null);
469
                        jPanel5.add(getJTextField2(), null);
470
                        jPanel5.add(jLabel4, null);
471
                }
472
                return jPanel5;
473
        }
474
        /**
475
         * This method initializes jTextField
476
         *
477
         * @return javax.swing.JTextField
478
         */
479
        private JTextField getTxtLayerName() {
480
                if (txtLayerName == null) {
481
                        //System.out.println("getJTestField(): layer = " + layer);
482
                        //layerName = layer.getName();
483
                        txtLayerName = new JTextField();
484
                        //jTextField.setText(layerName);
485
                        txtLayerName.setEditable(true);
486
                        txtLayerName.setBounds(80, 0, 229, 20);
487
                }
488
                return txtLayerName;
489
        }
490
        /**
491
         * This method initializes jTextField1
492
         *
493
         * @return javax.swing.JTextField
494
         */
495
        public JTextField getJTextField1() {
496
                if (jTextField1 == null) {
497
                        jTextField1 = new JTextField();
498
                        jTextField1.setBounds(147, 6, 152, 20);
499
                        jTextField1.setEnabled(false);
500
                }
501
                return jTextField1;
502
        }
503
        /**
504
         * This method initializes jTextArea
505
         *
506
         * @return javax.swing.JTextArea
507
         */
508
        private JTextArea getJTextArea() {
509
                if (jTextArea == null) {
510
                        jTextArea = new JTextArea();
511
                        jTextArea.setEditable(false);
512
                        jTextArea.setBackground(java.awt.SystemColor.control);
513
                        //jTextArea.setText("Extent\n\tSuperior\n\tInferior\n\tIzquierda\n\tDerecha\n\nOrigen de datos\n\n... y movidas ...");
514
                }
515
                return jTextArea;
516
        }
517

    
518
        /*public void setLayer(FLayer layer) {
519
                this.layer = layer;
520
        }*/
521
        /**
522
         * This method initializes jScrollPane
523
         *
524
         * @return javax.swing.JScrollPane
525
         */
526
        private JScrollPane getJScrollPane() {
527
                if (jScrollPane == null) {
528
                        jScrollPane = new JScrollPane();
529
                        jScrollPane.setViewportView(getJTextArea());
530
                        jScrollPane.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
531
                        jScrollPane.setPreferredSize(new java.awt.Dimension(100,100));
532
                        jScrollPane.setBounds(6, 21, 283, 120);
533
                }
534
                return jScrollPane;
535
        }
536
        /**
537
         * This method initializes jRadioButton
538
         *
539
         * @return javax.swing.JRadioButton
540
         */
541
        public JRadioButton getJRadioButton() {
542
                if (jRadioButton == null) {
543
                        jRadioButton = new JRadioButton();
544
                        jRadioButton.setText(PluginServices.getText(this,"Mostrar_siempre"));
545
                        jRadioButton.setBounds(0, 0, 301, 23);
546
                        jRadioButton.setSelected(true);
547
                        jRadioButton.addActionListener(new java.awt.event.ActionListener() {
548
                                public void actionPerformed(java.awt.event.ActionEvent e) {
549
                                        //jPanel5.setEnabled(false);
550
                                        jLabel1.setEnabled(false);
551
                                        jTextField1.setEnabled(false);
552
                                        jLabel2.setEnabled(false);
553
                                        jLabel3.setEnabled(false);
554
                                        jTextField2.setEnabled(false);
555
                                        jLabel4.setEnabled(false);
556
                                }
557
                        });
558
                }
559
                return jRadioButton;
560
        }
561
        /**
562
         * This method initializes jRadioButton1
563
         *
564
         * @return javax.swing.JRadioButton
565
         */
566
        public JRadioButton getJRadioButton1() {
567
                if (jRadioButton1 == null) {
568
                        jRadioButton1 = new JRadioButton();
569
                        jRadioButton1.setText(PluginServices.getText(this,"No_mostrar_la_capa_cuando_la_escala"));
570
                        jRadioButton1.setBounds(0, 23, 301, 23);
571
                        jRadioButton1.addActionListener(new java.awt.event.ActionListener() {
572
                                public void actionPerformed(java.awt.event.ActionEvent e) {
573
                                        //jPanel5.setEnabled(true);
574
                                        jLabel1.setEnabled(true);
575
                                        jTextField1.setEnabled(true);
576
                                        jLabel2.setEnabled(true);
577
                                        jLabel3.setEnabled(true);
578
                                        jTextField2.setEnabled(true);
579
                                        jLabel4.setEnabled(true);
580
                                }
581
                        });
582
                }
583
                return jRadioButton1;
584
        }
585
        /**
586
         * This method initializes jTextField2
587
         *
588
         * @return javax.swing.JTextField
589
         */
590
        public JTextField getJTextField2() {
591
                if (jTextField2 == null) {
592
                        jTextField2 = new JTextField();
593
                        jTextField2.setBounds(147, 31, 152, 20);
594
                        jTextField2.setEnabled(false);
595
                }
596
                return jTextField2;
597
        }
598
        public String getLayerName(){
599
                return txtLayerName.getText().toString();
600
        }
601
    /**
602
     * This method initializes jPanel3
603
     *
604
     * @return javax.swing.JPanel
605
     */
606
    private JPanel getJPanel3() {
607
            if (jPanel3 == null) {
608
                    jPanel3 = new JPanel();
609
                    jPanel3.setLayout(null);
610
                    jPanel3.setBounds(315, 195, 313, 154);
611
                    jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED), PluginServices.getText(this, "Hiperenlace"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
612
                    jPanel3.add(getJPanel6(), null);
613
            }
614
            return jPanel3;
615
    }
616
    /**
617
     * This method initializes jPanel6
618
     *
619
     * @return javax.swing.JPanel
620
     */
621
    private JPanel getJPanel6() {
622
            if (jPanel6 == null) {
623
                    jPanel6 = new JPanel();
624
                    jPanel6.setLayout(new BorderLayout());
625
                    jPanel6.setBounds(7, 22, 298, 119);
626
                    jPanel6.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
627
                    jPanel6.add(getJPanel7(), java.awt.BorderLayout.NORTH);
628
                    jPanel6.add(getJPanel8(), java.awt.BorderLayout.CENTER);
629
            }
630
            return jPanel6;
631
    }
632
    /**
633
     * This method initializes jPanel7
634
     *
635
     * @return javax.swing.JPanel
636
     */
637
    private JPanel getJPanel7() {
638
            if (jPanel7 == null) {
639
                    jLabel6 = new JLabel();
640
                    jLabel6.setText(PluginServices.getText(this,"extension"));
641
                    jLabel5 = new JLabel();
642
                    jLabel5.setText(PluginServices.getText(this, "Campo") + "   ");
643
                    jPanel7 = new JPanel();
644
                    jPanel7.add(jLabel5, null);
645
                    jPanel7.add(getJComboBox(), null);
646
                    jPanel7.add(jLabel6, null);
647
                    jPanel7.add(getJTextField(), null);
648
            }
649
            return jPanel7;
650
    }
651
    /**
652
     * This method initializes jPanel8
653
     *
654
     * @return javax.swing.JPanel
655
     */
656
    private JPanel getJPanel8() {
657
            if (jPanel8 == null) {
658
                    jLabel7 = new JLabel();
659
                    jLabel7.setText(PluginServices.getText(this, "Accion_Predefinida") + "  ");
660
                    jPanel8 = new JPanel();
661
                    jPanel8.add(jLabel7, null);
662
                    jPanel8.add(getJComboBox1(), null);
663
            }
664
            return jPanel8;
665
    }
666
    /**
667
     * This method initializes jComboBox
668
     *
669
     * @return javax.swing.JComboBox
670
     */
671
    private JComboBox getJComboBox() {
672
            if (jComboBox == null) {
673
            jComboBox = new JComboBox();
674
            }
675
            return jComboBox;
676
    }
677
    /**
678
     * This method initializes jTextField
679
     *
680
     * @return javax.swing.JTextField
681
     */
682
    private JTextField getJTextField() {
683
            if (jTextField == null) {
684
                    jTextField = new JTextField();
685
            jTextField.setPreferredSize(new java.awt.Dimension(40,20));
686
            }
687
            return jTextField;
688
    }
689
    /**
690
     * This method initializes jComboBox1
691
     *
692
     * @return javax.swing.JComboBox
693
     */
694
    private JComboBox getJComboBox1() {
695
            if (jComboBox1 == null) {
696
                    jComboBox1 = new JComboBox();
697
            }
698
            return jComboBox1;
699
    }
700
    /**
701
     * @return Returns the view.
702
     */
703
    public IProjectView getView() {
704
        return view;
705
    }
706
    /**
707
     * This method initializes jCheckBox
708
     *
709
     * @return javax.swing.JCheckBox
710
     */
711
    private JCheckBox getJCheckBoxSpatialIndex() {
712
            if (jCheckBoxSpatialIndex == null) {
713
                    jCheckBoxSpatialIndex = new JCheckBox();
714
                    jCheckBoxSpatialIndex.setBounds(2, 33, 242, 23);
715
                    jCheckBoxSpatialIndex.setText(PluginServices.getText(this,"Usar_indice_espacial"));
716
            }
717
            return jCheckBoxSpatialIndex;
718
    }
719

    
720
    public int getLinkType()
721
    {
722
        return getJComboBox1().getSelectedIndex();
723
    }
724
    public String getSelectedLinkField()
725
    {
726
        return (String) getJComboBox().getSelectedItem();
727
    }
728

    
729
    public String getExtensionLink()
730
    {
731
        return getJTextField().getText();
732
    }
733

    
734
    public boolean isSpatialIndexSelected()
735
    {
736
        return getJCheckBoxSpatialIndex().isSelected();
737
    }
738

    
739
    private void showLayerInfo() {
740
                try {
741
                        String info = ((FLyrDefault)layer).getInfoString();
742
                        if (info == null) {
743
                                info = PluginServices.getText(this,"Extent") + "\n\t" +
744
                                PluginServices.getText(this,"Superior") + ":\t" + layer.getFullExtent().getMaxY() + "\n\t" +
745
                                PluginServices.getText(this,"Inferior") + ":\t" + layer.getFullExtent().getMinY() + "\n\t" +
746
                                PluginServices.getText(this,"Izquierda") + ":\t" + layer.getFullExtent().getMinX() + "\n\t" +
747
                                PluginServices.getText(this,"Derecha") + ":\t" + layer.getFullExtent().getMaxX() + "\n\n";
748

    
749
                                if (layer instanceof FLyrVect) {
750
                                        ReadableVectorial rv=((FLyrVect)layer).getSource();
751
                                        if (rv instanceof VectorialEditableAdapter) {
752
                                                rv=((VectorialEditableAdapter) ((FLyrVect)layer).getSource()).getOriginalAdapter();
753
                                        }
754

    
755
                                        info = info + PluginServices.getText(this,"Origen_de_datos") + ": ";
756
                                        if (rv instanceof VectorialFileAdapter) {
757
                                                info = info + "\n" + rv.getDriver().getName() + "\n" +
758
                                                PluginServices.getText(this,"fichero") +": " + ((VectorialFileAdapter)rv).getFile();
759

    
760
                                        } else if (rv instanceof VectorialDBAdapter) {
761
                                                DBLayerDefinition dbdef = ((VectorialDBAdapter) rv).getLyrDef();
762
                                                info = info + "\n" + rv.getDriver().getName() + "\n";
763

    
764
                                                try {
765
                                                        info = info +
766
                                                        PluginServices.getText(this,"url") +": " + dbdef.getConnection().getMetaData().getURL() + "\n";
767
                                                } catch (Exception e) {
768
                                                        //TODO: Que hacer aqui?
769
                                                        e.printStackTrace();
770
                                                }
771

    
772
                                                info = info +
773
                                                PluginServices.getText(this,"Tabla") +": " + dbdef.getTableName() + "\n";
774
                                        } else if (rv instanceof VectorialAdapter){
775
                                                info = info + "\n" + rv.getDriver().getName() + "\n";
776
                                        }
777

    
778

    
779

    
780
                                } else {
781
                                        info = info + PluginServices.getText(this,"Origen_de_datos") + ": " + layer.getName();
782
                                }
783

    
784
                        }
785
                        getJTextArea().setText(info);
786

    
787
                } catch (DriverException e) {
788
                        // TODO Auto-generated catch block
789
                        e.printStackTrace();
790
                }
791

    
792
    }
793
}  //  @jve:decl-index=0:visual-constraint="10,10"
794