Statistics
| Revision:

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

History | View | Annotate | Download (19.5 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

    
168
        if (r.getDefaultSymbol() instanceof FSymbol)
169
                setFSymbol((FSymbol) r.getDefaultSymbol());
170

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

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

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

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

    
199

    
200
        }
201

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

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

    
238
                        item = (String) getJComboBoxHeightField().getSelectedItem();
239
            if (item == null || item.equals(NULL_COMBO_ITEM))
240
                    item = null;
241
                        l.setLabelHeightField(item);
242

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

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

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

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

    
307
                        DefaultComboBoxModel cM_labelField = new DefaultComboBoxModel(nomFields);
308
                        getJComboBoxTextField().setModel(cM_labelField);
309
                        DefaultComboBoxModel cM_HeightField = new DefaultComboBoxModel(nomNumericFields.toArray(new String[0]));
310
                        getJComboBoxHeightField().setModel(cM_HeightField);
311
            DefaultComboBoxModel cM_RotationField = new DefaultComboBoxModel(nomNumericFields.toArray(new String[0]));
312
            getJComboBoxRotationField().setModel(cM_RotationField);
313

    
314
                } catch (DriverException e) {
315
                        e.printStackTrace();
316
                } catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
317
                        e.printStackTrace();
318
                }
319
        }
320

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

    
333
                                public void itemStateChanged(java.awt.event.ItemEvent e) {
334
                                        updateControls();
335

    
336
                                }
337
                        });
338

    
339
                }
340
                return jCheckBox;
341
        }
342

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

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

    
382
                }
383
                return jComboBoxHeightField;
384
        }
385

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

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

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

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

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

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

    
492
                                public void actionPerformed(java.awt.event.ActionEvent e) {
493
                                        //JButton origen = (JButton) e.getSource();
494
                                        Font newFont;
495

    
496
                                        newFont = FontChooser.showDialog("Choose Font", labelFont);
497

    
498
                                if (newFont == null) {
499
                                    return;
500
                                }
501

    
502
                                labelFont = newFont;
503
                                updateControls();
504

    
505

    
506
                                }
507
                        });
508

    
509
                }
510
                return jButton;
511
        }
512

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

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

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

    
579
                        gridBagLayoutPanel.addComponent(getRdBtnUseHeightField());
580
                        gridBagLayoutPanel.addComponent("", getJComboBoxHeightField());
581

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

    
594
                }
595
                return gridBagLayoutPanel;
596
        }
597

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

    
614
        private JRadioButton getRdBtnFixedHeight() {
615
                if (rdBtnFixedHeight == null) {
616
                        rdBtnFixedHeight = new JRadioButton(PluginServices.getText(this,"Altura_fija_de_texto")+":");
617
                        rdBtnFixedHeight.setSelected(true);
618
                        rdBtnFixedHeight.addActionListener(new ActionListener() {
619

    
620
                                public void actionPerformed(ActionEvent e) {
621
                                        boolean b = rdBtnFixedHeight.isSelected();
622
                                        getJTextField().setEnabled(b);
623
                                        getJComboBoxHeightField().setEnabled(!b);
624
                                        getJRadioButton().setEnabled(b);
625
                                        getJRadioButton1().setEnabled(b);
626
                                        getJComboBoxHeightField().setSelectedItem(NULL_COMBO_ITEM);
627
                                }
628

    
629
                        });
630
                }
631
                return rdBtnFixedHeight;
632
        }
633

    
634
        public void repaint() {
635
                updateControls();
636
                super.repaint();
637
        }
638
}