Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / view / legend / gui / FPanelLegendLabels.java @ 7659

History | View | Annotate | Download (19.2 KB)

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

    
47
import java.awt.BorderLayout;
48
import java.awt.Dimension;
49
import java.awt.FlowLayout;
50
import java.awt.Font;
51
import java.awt.Graphics;
52
import java.awt.GridLayout;
53
import java.awt.event.ActionEvent;
54
import java.awt.event.ActionListener;
55
import java.sql.Types;
56
import java.util.ArrayList;
57

    
58
import javax.swing.ButtonGroup;
59
import javax.swing.DefaultComboBoxModel;
60
import javax.swing.JCheckBox;
61
import javax.swing.JComboBox;
62
import javax.swing.JLabel;
63
import javax.swing.JPanel;
64
import javax.swing.JRadioButton;
65

    
66
import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
67
import org.gvsig.gui.beans.swing.JButton;
68

    
69
import com.iver.andami.PluginServices;
70
import com.iver.cit.gvsig.fmap.DriverException;
71
import com.iver.cit.gvsig.fmap.core.FShape;
72
import com.iver.cit.gvsig.fmap.core.v02.FConstant;
73
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
74
import com.iver.cit.gvsig.fmap.layers.FLayer;
75
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
76
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
77
import com.iver.cit.gvsig.fmap.layers.layerOperations.ClassifiableVectorial;
78
import com.iver.cit.gvsig.fmap.rendering.Legend;
79
import com.iver.cit.gvsig.fmap.rendering.VectorialLegend;
80
import com.iver.cit.gvsig.gui.panels.ColorChooserPanel;
81
import com.iver.cit.gvsig.gui.utils.FontChooser;
82

    
83
/**
84
 * @author fjp
85
 *
86
 */
87
public class FPanelLegendLabels extends JPanel implements ILegendPanel {
88

    
89
        private static final Font DEFAULT_FONT =
90
                  new Font("SansSerif", Font.PLAIN, 9);
91

    
92
        private VectorialLegend m_Renderer;
93
        private ClassifiableVectorial m_lyr;
94
        private FSymbol m_FSymbol;
95

    
96
        private ColorChooserPanel m_colorChooser = new ColorChooserPanel();
97
        private javax.swing.JCheckBox jCheckBox = null;
98
        private javax.swing.JComboBox jComboBoxTextField = null;
99
        private javax.swing.JComboBox jComboBoxHeightField = null;
100
        private javax.swing.JTextField jTextField = null;
101
        private javax.swing.JRadioButton jRadioButton = null;
102
        private javax.swing.JRadioButton jRadioButton1 = null;
103
        private FPreviewSymbol fPreviewSymbol = null;
104
        private javax.swing.JLabel jLabel3 = null;
105
        private JButton jButton = null;
106

    
107
        private Font labelFont = DEFAULT_FONT;
108
        private javax.swing.JLabel jLabel4 = null;
109
    private JComboBox jComboBoxRotationField = null;
110
    private JCheckBox jCheckBoxTextOnly = null;
111
        private GridBagLayoutPanel gridBagLayoutPanel = null;
112
        private JRadioButton rdBtnUseHeightField;
113
        private JRadioButton rdBtnFixedHeight;
114
        private final String NULL_COMBO_ITEM = "- " +PluginServices.getText(FPanelLegendLabels.class, "none") + " -";
115
        /**
116
         * This is the default constructor
117
         */
118
        public FPanelLegendLabels(JPanel parent) {
119
                super();
120
                initialize();
121
        }
122
        /**
123
         * This method initializes this
124
         *
125
         * @return void
126
         */
127
        private  void initialize() {
128
                this.setLayout(null);
129
                this.setSize(454, 308);
130
                this.add(getJCheckBox(), null);
131
                this.add(getFPreviewSymbol(), null);
132
                this.add(getJLabel3(), null);
133
                this.add(getJButton(), null);
134
                ButtonGroup group = new ButtonGroup();
135
                group.add(getRdBtnUseHeightField());
136
                group.add(getRdBtnFixedHeight());
137
                ButtonGroup jButtonGroup = new ButtonGroup();
138
                jButtonGroup.add(getJRadioButton1());
139
                jButtonGroup.add(getJRadioButton());
140

    
141
                m_colorChooser.setAlpha(255);
142
                m_colorChooser.setBounds(336, 114, 99, 34);
143
                if (getJComboBoxTextField().getSelectedIndex()!=-1)
144
                        m_colorChooser.setEnabled(true);
145
                else
146
                        m_colorChooser.setEnabled(false);
147
                m_colorChooser.addActionListener(new java.awt.event.ActionListener() {
148
                        public void actionPerformed(ActionEvent e) {
149
                                updateControls();
150
                        }
151
                });
152
                this.add(getJLabel4(), null);
153
                this.add(m_colorChooser);
154

    
155
                this.add(getGridBagLayoutPanel(), null);
156
        }
157

    
158
        public void setLayer(FLayer lyr, Legend r)
159
        {
160
                m_lyr = (ClassifiableVectorial) lyr;
161
                m_Renderer = (VectorialLegend)r;
162

    
163
                fillFieldNames();
164
                getJComboBoxTextField().getModel().setSelectedItem(m_Renderer.getLabelField());
165
        getJComboBoxHeightField().getModel().setSelectedItem(m_Renderer.getLabelHeightField());
166
        getJComboBoxRotationField().getModel().setSelectedItem(m_Renderer.getLabelRotationField());
167
                setFSymbol((FSymbol) r.getDefaultSymbol());
168

    
169
                if (m_Renderer.getLabelField() != null)
170
                        getJCheckBox().setSelected(true);
171
                else
172
                        getJCheckBox().setSelected(false);
173
        }
174

    
175
        public void setFSymbol(FSymbol sym)
176
        {
177
                if (sym == null)
178
                {
179
                        m_FSymbol = new FSymbol(FShape.MULTI);
180
                }
181
                else
182
                        m_FSymbol = sym;
183

    
184
                if (m_FSymbol.getFontColor()!=null){
185
                        m_colorChooser.setColor(m_FSymbol.getFontColor());
186
                }
187
                fPreviewSymbol.setSymbol(m_FSymbol);
188

    
189
                getJRadioButton1().setSelected(!m_FSymbol.isFontSizeInPixels());
190
        getJCheckBoxTextOnly().setSelected(!m_FSymbol.isShapeVisible());
191
        double size = m_FSymbol.getFontSize();
192
        // Scale the value of the font size to the value of the height
193
        // and avoid too much decimal numbers
194
        size = ((int) (100*size / FConstant.FONT_HEIGHT_SCALE_FACTOR))/100;
195
                getJTextField().setText(String.valueOf(size));
196

    
197

    
198
        }
199

    
200
        private void updateControls() {
201
                getJComboBoxTextField().setEnabled(getJCheckBox().isSelected());
202
                if (getJComboBoxTextField().getSelectedIndex()!=-1){
203
                        getJComboBoxHeightField().setEnabled(getJCheckBox().isSelected());
204
                        getJComboBoxRotationField().setEnabled(getJCheckBox().isSelected());
205
                }
206
                getJRadioButton().setEnabled(getJCheckBox().isSelected());
207
                getJRadioButton1().setEnabled(getJCheckBox().isSelected());
208
                getRdBtnFixedHeight().setEnabled(getJCheckBox().isSelected());
209
                getRdBtnUseHeightField().setEnabled(getJCheckBox().isSelected());
210
                getJTextField().setEnabled(getJCheckBox().isSelected());
211
                getJCheckBoxTextOnly().setEnabled(getJCheckBox().isSelected());
212
                if (m_colorChooser != null)
213
                        m_colorChooser.setEnabled(getJCheckBox().isSelected());
214
                getJButton().setEnabled(getJCheckBox().isSelected());
215
                if (getJCheckBox().isSelected())
216
                {
217
                        FSymbol sym = m_FSymbol;
218
                        sym.setFont(labelFont);
219
                        sym.setFontColor(m_colorChooser.getColor());
220
                        fPreviewSymbol.setSymbol(sym);
221
                }
222
        }
223

    
224
        public void updateValuesFromControls(VectorialLegend l) {
225
                if (getJCheckBox().isSelected())
226
                {
227
            m_FSymbol = (FSymbol) l.getDefaultSymbol();
228
            m_FSymbol.setFont(labelFont);
229
            String item = (String) getJComboBoxTextField().getSelectedItem();
230
            if (item == null || item.equals(NULL_COMBO_ITEM))
231
                    item = null;
232
                        l.setLabelField(item);
233

    
234
                        item = (String) getJComboBoxHeightField().getSelectedItem();
235
            if (item == null || item.equals(NULL_COMBO_ITEM))
236
                    item = null;
237
                        l.setLabelHeightField(item);
238

    
239
                        item = (String) getJComboBoxRotationField().getSelectedItem();
240
            if (item == null || item.equals(NULL_COMBO_ITEM))
241
                    item = null;
242
            l.setLabelRotationField(item);
243
                        m_FSymbol.setFontColor(m_colorChooser.getColor());
244
                        //m_FSymbol.setSymbolType(m_Renderer.getShapeType());
245
                        float fontSize = Float.parseFloat(getJTextField().getText());
246
                        fontSize *= FConstant.FONT_HEIGHT_SCALE_FACTOR;
247
                        if (!getJRadioButton().isSelected())
248
                        {
249
                                // meters
250
                                /*
251
                                 * Java scales font size by defining the cell diagonal.
252
                                 * To obtain the right height value we need to apply a
253
                                 * factor to the diagonal to get a right value for the
254
                                 * height.
255
                                 */
256
                                m_FSymbol.setFontSize(fontSize); // Para que se pueda crear correctamente al recuperar del proyecto
257
                                m_FSymbol.setFontSizeInPixels(false);
258
                        }
259
                        else
260
                        {
261
                                // pixels
262
                                m_FSymbol.setFont(labelFont);
263
                                m_FSymbol.setFont(labelFont.deriveFont(fontSize));
264
                                m_FSymbol.setFontSize(fontSize);
265
                                m_FSymbol.setFontSizeInPixels(true);
266
                        }
267
            m_FSymbol.setShapeVisible(true);
268
            if (getJCheckBoxTextOnly().isSelected())
269
                m_FSymbol.setShapeVisible(false);
270

    
271
                        l.setDefaultSymbol(m_FSymbol);
272
            // System.out.println("Color punto 3 " + m_FSymbol.getColor().toString());
273
                }
274
                else
275
                {
276
                        // Para que no se dibujen las etiquetas, el campo labelField del Renderer
277
                        // ha de ser null
278
                        l.setLabelField(null);
279
                }
280
        }
281

    
282
        private void fillFieldNames() {
283
                SelectableDataSource rs;
284
                try {
285
                        // rs = ((ProjectExtension) PluginServices.getExtension(ProjectExtension.class)).getProject().getDataSourceByLayer((FLayer) m_lyr);
286
                        rs = ((FLyrVect)m_lyr).getRecordset();
287
                        String[] nomFields;
288
            ArrayList nomNumericFields = new ArrayList();
289

    
290
            // null value
291
            nomNumericFields.add(NULL_COMBO_ITEM);
292
                        nomFields = new String[rs.getFieldCount()];
293
                        for (int i = 0; i < rs.getFieldCount(); i++) {
294
                                nomFields[i] = rs.getFieldName(i).trim();
295
                if ((rs.getFieldType(i) == Types.FLOAT)
296
                   || (rs.getFieldType(i) == Types.BIGINT)
297
                   || (rs.getFieldType(i) == Types.DOUBLE)
298
                   || (rs.getFieldType(i) == Types.INTEGER))
299
                    nomNumericFields.add(nomFields[i]);
300
                        }
301

    
302
                        DefaultComboBoxModel cM_labelField = new DefaultComboBoxModel(nomFields);
303
                        getJComboBoxTextField().setModel(cM_labelField);
304
                        DefaultComboBoxModel cM_HeightField = new DefaultComboBoxModel(nomNumericFields.toArray(new String[0]));
305
                        getJComboBoxHeightField().setModel(cM_HeightField);
306
            DefaultComboBoxModel cM_RotationField = new DefaultComboBoxModel(nomNumericFields.toArray(new String[0]));
307
            getJComboBoxRotationField().setModel(cM_RotationField);
308

    
309
                } catch (DriverException e) {
310
                        e.printStackTrace();
311
                } catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
312
                        e.printStackTrace();
313
                }
314
        }
315

    
316
        /**
317
         * This method initializes jCheckBox
318
         *
319
         * @return javax.swing.JCheckBox
320
         */
321
        private javax.swing.JCheckBox getJCheckBox() {
322
                if (jCheckBox == null) {
323
                        jCheckBox = new javax.swing.JCheckBox();
324
                        jCheckBox.setText(PluginServices.getText(this,"Habilitar_etiquetado"));
325
                        jCheckBox.setBounds(2, 3, 152, 23);
326
                        jCheckBox.addItemListener(new java.awt.event.ItemListener() {
327

    
328
                                public void itemStateChanged(java.awt.event.ItemEvent e) {
329
                                        updateControls();
330

    
331
                                }
332
                        });
333

    
334
                }
335
                return jCheckBox;
336
        }
337

    
338
        /**
339
         * This method initializes jComboBox
340
         *
341
         * @return javax.swing.JComboBox
342
         */
343
        private javax.swing.JComboBox getJComboBoxTextField() {
344
                if (jComboBoxTextField == null) {
345
                        jComboBoxTextField = new javax.swing.JComboBox();
346
                        jComboBoxTextField.setEnabled(false);
347
                        jComboBoxTextField.addItemListener(new java.awt.event.ItemListener() {
348
                                public void itemStateChanged(java.awt.event.ItemEvent e) {
349
                                        if (jComboBoxTextField.getSelectedIndex()!=-1){
350
                                                getJComboBoxHeightField().setEnabled(true);
351
                                                getJComboBoxRotationField().setEnabled(true);
352
                                        }else{
353
                                                getJComboBoxHeightField().setEnabled(false);
354
                                                getJComboBoxRotationField().setEnabled(false);
355
                                        }
356
                                }
357
                        });
358
                }
359
                return jComboBoxTextField;
360
        }
361

    
362
        /**
363
         * This method initializes jComboBox1
364
         *
365
         * @return javax.swing.JComboBox
366
         */
367
        private javax.swing.JComboBox getJComboBoxHeightField() {
368
                if (jComboBoxHeightField == null) {
369
                        jComboBoxHeightField = new javax.swing.JComboBox();
370
                        jComboBoxHeightField.setVisible(true);
371
                        if (getJComboBoxTextField().getSelectedIndex()!=-1){
372
                                jComboBoxHeightField.setEnabled(true);
373
                        }else{
374
                                jComboBoxHeightField.setEnabled(false);
375
                        }
376

    
377
                }
378
                return jComboBoxHeightField;
379
        }
380

    
381
        /**
382
         * This method initializes jTextField
383
         *
384
         * @return javax.swing.JTextField
385
         */
386
        private javax.swing.JTextField getJTextField() {
387
                if (jTextField == null) {
388
                        jTextField = new javax.swing.JTextField();
389
                        jTextField.setPreferredSize(new Dimension(76, 21));
390
                        jTextField.setBounds(26, 32, 76, 21);
391
                        if (getJComboBoxTextField().getSelectedIndex()!=-1){
392
                                jTextField.setEnabled(true);
393
                        }else{
394
                                jTextField.setEnabled(false);
395
                        }
396
                        jTextField.setEnabled(false);
397
                        jTextField.setText("10");
398
                }
399
                return jTextField;
400
        }
401

    
402
        /**
403
         * This method initializes jRadioButton
404
         *
405
         * @return javax.swing.JRadioButton
406
         */
407
        private javax.swing.JRadioButton getJRadioButton() {
408
                if (jRadioButton == null) {
409
                        jRadioButton = new javax.swing.JRadioButton();
410
                        jRadioButton.setText(PluginServices.getText(this,"En_pixels"));
411
                        jRadioButton.setBounds(145, 44, 100, 23);
412
                        if (getJComboBoxTextField().getSelectedIndex()!=-1){
413
                                jRadioButton.setEnabled(true);
414
                        }else{
415
                                jRadioButton.setEnabled(false);
416
                        }
417
                        jRadioButton.setEnabled(false);
418
                        jRadioButton.setSelected(true);
419
                }
420
                return jRadioButton;
421
        }
422

    
423
        /**
424
         * This method initializes jRadioButton1
425
         *
426
         * @return javax.swing.JRadioButton
427
         */
428
        private javax.swing.JRadioButton getJRadioButton1() {
429
                if (jRadioButton1 == null) {
430
                        jRadioButton1 = new javax.swing.JRadioButton();
431
                        jRadioButton1.setText(PluginServices.getText(this,"En_metros"));
432
                        jRadioButton1.setBounds(145, 16, 100, 23);
433
                        if (getJComboBoxTextField().getSelectedIndex()!=-1){
434
                                jRadioButton1.setEnabled(true);
435
                        }else{
436
                                jRadioButton1.setEnabled(false);
437
                        }
438
                        jRadioButton1.setEnabled(false);
439
                }
440
                return jRadioButton1;
441
        }
442

    
443
        /**
444
         * This method initializes fPreviewSymbol
445
         *
446
         * @return com.iver.cit.opensig.gui.Panels.FPreviewSymbol
447
         */
448
        public FPreviewSymbol getFPreviewSymbol() {
449
                if (fPreviewSymbol == null) {
450
                        fPreviewSymbol = new FPreviewSymbol();
451
                        fPreviewSymbol.setBounds(311, 53, 134, 77);
452
                }
453
                return fPreviewSymbol;
454
        }
455

    
456
        /**
457
         * This method initializes jLabel3
458
         *
459
         * @return javax.swing.JLabel
460
         */
461
        private javax.swing.JLabel getJLabel3() {
462
                if (jLabel3 == null) {
463
                        jLabel3 = new javax.swing.JLabel();
464
                        jLabel3.setBounds(336, 27, 100, 18);
465
                        jLabel3.setText(PluginServices.getText(this,"Previsualizacion"));
466
                        jLabel3.setVisible(false);
467
                }
468
                return jLabel3;
469
        }
470

    
471
        /**
472
         * This method initializes jButton
473
         *
474
         * @return javax.swing.JButton
475
         */
476
        private JButton getJButton() {
477
                if (jButton == null) {
478
                        jButton = new JButton();
479
                        jButton.setBounds(338, 53, 111, 29);
480
                        if (getJComboBoxTextField().getSelectedIndex()!=-1)
481
                                jButton.setEnabled(true);
482
                        else
483
                                jButton.setEnabled(false);
484
                        jButton.setText(PluginServices.getText(this,"fuente")+"...");
485
                        jButton.addActionListener(new java.awt.event.ActionListener() {
486

    
487
                                public void actionPerformed(java.awt.event.ActionEvent e) {
488
                                        //JButton origen = (JButton) e.getSource();
489
                                        Font newFont;
490

    
491
                                        newFont = FontChooser.showDialog("Choose Font", labelFont);
492

    
493
                                if (newFont == null) {
494
                                    return;
495
                                }
496

    
497
                                labelFont = newFont;
498
                                updateControls();
499

    
500

    
501
                                }
502
                        });
503

    
504
                }
505
                return jButton;
506
        }
507

    
508
        /**
509
         * This method initializes jLabel4
510
         *
511
         * @return javax.swing.JLabel
512
         */
513
        private javax.swing.JLabel getJLabel4() {
514
                if (jLabel4 == null) {
515
                        jLabel4 = new javax.swing.JLabel();
516
                        jLabel4.setBounds(335, 87, 115, 23);
517
                        jLabel4.setText(PluginServices.getText(this,"color_texto"));
518
                }
519
                return jLabel4;
520
        }
521

    
522
        public Legend getLegend() {
523
                updateValuesFromControls(m_Renderer);
524
                return m_Renderer;
525
        }
526
    /**
527
     * This method initializes jComboBox1
528
     *
529
     * @return javax.swing.JComboBox
530
     */
531
    private JComboBox getJComboBoxRotationField() {
532
            if (jComboBoxRotationField == null) {
533
                    jComboBoxRotationField = new JComboBox();
534
                    if (getJComboBoxTextField().getSelectedIndex()!=-1)
535
                                jComboBoxRotationField.setEnabled(true);
536
                        else
537
                                jComboBoxRotationField.setEnabled(false);
538
            }
539
            return jComboBoxRotationField;
540
    }
541

    
542
    /**
543
     * This method initializes jCheckBox1
544
     *
545
     * @return javax.swing.JCheckBox
546
     */
547
    private JCheckBox getJCheckBoxTextOnly() {
548
            if (jCheckBoxTextOnly == null) {
549
                    jCheckBoxTextOnly = new JCheckBox();
550
                    jCheckBoxTextOnly.setBounds(315, 171, 133, 22);
551
                    if (getJComboBoxTextField().getSelectedIndex()!=-1){
552
                                jCheckBoxTextOnly.setEnabled(true);
553
                        }else{
554
                                jCheckBoxTextOnly.setEnabled(false);
555
                        }
556
                    jCheckBoxTextOnly.setText(PluginServices.getText(this, "draw_text_only"));
557
            }
558
            return jCheckBoxTextOnly;
559
    }
560
        /**
561
         * This method initializes gridBagLayoutPanel
562
         *
563
         * @return org.gvsig.gui.beans.swing.GridBagLayoutPanel
564
         */
565
        private GridBagLayoutPanel getGridBagLayoutPanel() {
566
                if (gridBagLayoutPanel == null) {
567
                        gridBagLayoutPanel = new GridBagLayoutPanel();
568
                        gridBagLayoutPanel.setBounds(new java.awt.Rectangle(14,8,263,274));
569
                        gridBagLayoutPanel.addComponent(new JLabel(PluginServices.getText(this,"Campo_de_etiquetado")));
570
                        gridBagLayoutPanel.addComponent("", getJComboBoxTextField());
571
                        gridBagLayoutPanel.addComponent(new JLabel(PluginServices.getText(this, "rotation_field")));
572
                        gridBagLayoutPanel.addComponent("", getJComboBoxRotationField());
573

    
574
                        gridBagLayoutPanel.addComponent(getRdBtnUseHeightField());
575
                        gridBagLayoutPanel.addComponent("", getJComboBoxHeightField());
576

    
577
                        JPanel aux = new JPanel(new BorderLayout(0, 0));
578
                        JPanel aux1 = new JPanel(new FlowLayout(FlowLayout.LEADING));
579
                        aux1.add(getJTextField(), BorderLayout.CENTER);
580
                        JPanel aux2 = new JPanel(new GridLayout(2,1));
581
                        aux2.add(getJRadioButton());
582
                        aux2.add(getJRadioButton1());
583
                        aux.add(aux1, BorderLayout.WEST);
584
                        aux.add(aux2, BorderLayout.CENTER);
585
                        gridBagLayoutPanel.addComponent(getRdBtnFixedHeight());
586
                        gridBagLayoutPanel.addComponent("", aux);
587
                        gridBagLayoutPanel.addComponent("", getJCheckBoxTextOnly());
588

    
589
                }
590
                return gridBagLayoutPanel;
591
        }
592

    
593
        private JRadioButton getRdBtnUseHeightField() {
594
                if (rdBtnUseHeightField == null) {
595
                        rdBtnUseHeightField = new JRadioButton(PluginServices.getText(this,"campo_altura_texto"));
596
                        rdBtnUseHeightField.addActionListener(new ActionListener() {
597
                                public void actionPerformed(ActionEvent e) {
598
                                        boolean b = rdBtnUseHeightField.isSelected();
599
                                        getJTextField().setEnabled(!b);
600
                                        getJComboBoxHeightField().setEnabled(b);
601
                                        getJRadioButton().setEnabled(!b);
602
                                        getJRadioButton1().setEnabled(!b);
603
                                }
604
                        });
605
                }
606
                return rdBtnUseHeightField;
607
        }
608
        private JRadioButton getRdBtnFixedHeight() {
609
                if (rdBtnFixedHeight == null) {
610
                        rdBtnFixedHeight = new JRadioButton(PluginServices.getText(this,"Altura_fija_de_texto")+":");
611
                        rdBtnFixedHeight.setSelected(true);
612
                        rdBtnFixedHeight.addActionListener(new ActionListener() {
613

    
614
                                public void actionPerformed(ActionEvent e) {
615
                                        boolean b = rdBtnFixedHeight.isSelected();
616
                                        getJTextField().setEnabled(b);
617
                                        getJComboBoxHeightField().setEnabled(!b);
618
                                        getJRadioButton().setEnabled(b);
619
                                        getJRadioButton1().setEnabled(b);
620
                                }
621

    
622
                        });
623
                }
624
                return rdBtnFixedHeight;
625
        }
626

    
627
        public void repaint() {
628
                updateControls();
629
                super.repaint();
630
        }
631
}