Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / view / legend / gui / FPanelLegendLabels.java @ 8354

History | View | Annotate | Download (19.3 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.GridLayout;
52
import java.awt.event.ActionEvent;
53
import java.awt.event.ActionListener;
54
import java.sql.Types;
55
import java.util.ArrayList;
56

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

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

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

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

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

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

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

    
106
        private Font labelFont = DEFAULT_FONT;
107
        private javax.swing.JLabel jLabel4 = null;
108
    private JComboBox jComboBoxRotationField = null;
109
    private JCheckBox jCheckBoxTextOnly = null;
110
        private GridBagLayoutPanel gridBagLayoutPanel = null;
111
        private JRadioButton rdBtnUseHeightField;
112
        private JRadioButton rdBtnFixedHeight;
113
        private final String NULL_COMBO_ITEM = "- " +PluginServices.getText(FPanelLegendLabels.class, "none") + " -";
114
        /**
115
         * This is the default constructor
116
         */
117
        public FPanelLegendLabels(JPanel parent) {
118
                super();
119
                initialize();
120
        }
121
        /**
122
         * This method initializes this
123
         *
124
         * @return void
125
         */
126
        private  void initialize() {
127
                this.setLayout(null);
128
                this.setSize(454, 308);
129
                this.add(getJCheckBox(), null);
130
                this.add(getJCheckBoxTextOnly(),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
                        String s=getJTextField().getText().replace(',','.');
246
                        float fontSize = Float.parseFloat(s);
247
                        fontSize *= FConstant.FONT_HEIGHT_SCALE_FACTOR;
248
                        if (!getJRadioButton().isSelected())
249
                        {
250
                                // meters
251
                                /*
252
                                 * Java scales font size by defining the cell diagonal.
253
                                 * To obtain the right height value we need to apply a
254
                                 * factor to the diagonal to get a right value for the
255
                                 * height.
256
                                 */
257
                                m_FSymbol.setFontSize(fontSize); // Para que se pueda crear correctamente al recuperar del proyecto
258
                                m_FSymbol.setFontSizeInPixels(false);
259
                        }
260
                        else
261
                        {
262
                                // pixels
263
                                m_FSymbol.setFont(labelFont);
264
                                m_FSymbol.setFont(labelFont.deriveFont(fontSize));
265
                                m_FSymbol.setFontSize(fontSize);
266
                                m_FSymbol.setFontSizeInPixels(true);
267
                        }
268
            m_FSymbol.setShapeVisible(true);
269
            if (getJCheckBoxTextOnly().isSelected())
270
                m_FSymbol.setShapeVisible(false);
271

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

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

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

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

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

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

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

    
332
                                }
333
                        });
334

    
335
                }
336
                return jCheckBox;
337
        }
338

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

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

    
378
                }
379
                return jComboBoxHeightField;
380
        }
381

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

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

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

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

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

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

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

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

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

    
498
                                labelFont = newFont;
499
                                updateControls();
500

    
501

    
502
                                }
503
                        });
504

    
505
                }
506
                return jButton;
507
        }
508

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

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

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

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

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

    
590
                }
591
                return gridBagLayoutPanel;
592
        }
593

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

    
610
        private JRadioButton getRdBtnFixedHeight() {
611
                if (rdBtnFixedHeight == null) {
612
                        rdBtnFixedHeight = new JRadioButton(PluginServices.getText(this,"Altura_fija_de_texto")+":");
613
                        rdBtnFixedHeight.setSelected(true);
614
                        rdBtnFixedHeight.addActionListener(new ActionListener() {
615

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

    
624
                        });
625
                }
626
                return rdBtnFixedHeight;
627
        }
628

    
629
        public void repaint() {
630
                updateControls();
631
                super.repaint();
632
        }
633
}