Statistics
| Revision:

root / trunk / libraries / libUIComponent / src-test-ui / org / gvsig / gui / beans / panelGroup / samples / SamplePanelGroupLabelRepeated.java @ 17543

History | View | Annotate | Download (4.45 KB)

1 15734 vcaballero
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
20
package org.gvsig.gui.beans.panelGroup.samples;
21
22
import java.awt.Color;
23 17026 vcaballero
import java.awt.Dimension;
24 15734 vcaballero
import java.io.Serializable;
25
26
import javax.swing.JScrollPane;
27
import javax.swing.JTextArea;
28
29
import org.gvsig.gui.beans.panelGroup.panels.AbstractPanel;
30
31
/**
32
 * <p>Sample of {@link AbstractPanel AbstractPanel}.</p>
33
 *
34
 * @version 23/10/2007
35
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
36
 */
37
public class SamplePanelGroupLabelRepeated extends AbstractPanel implements Serializable {
38 16231 vcaballero
        private static final long serialVersionUID = 1857806149242138609L;
39 15734 vcaballero
40
        /**
41
         * <p>Element for the interface.</p>
42
         */
43
        private JTextArea jTextArea = null;
44
45
        /**
46
         * @see AbstractPanel#AbstractPanel()
47
         */
48
        public SamplePanelGroupLabelRepeated() {
49
                super();
50
                initialize();
51
        }
52
53
        /**
54
         * @see AbstractPanel#AbstractPanel(String, String, String)
55
         */
56
        public SamplePanelGroupLabelRepeated(String id, String label, String labelGroup) {
57
                super(id, label, labelGroup);
58
                initialize();
59
        }
60
61
        @Override
62
        protected void initialize() {
63
                add(new JScrollPane(getJTextArea()));
64
                setToolTipText(getID());
65 17026 vcaballero
66
                setID(Samples_Data.PANELS3_IDS[1]);
67
                setLabel(Samples_Data.PANELS3_LABELS[1]);
68
                setLabelGroup(Samples_Data.PANELS3_LABELGROUPS[1]);
69
                setPreferredSize(new Dimension(Samples_Data.PANELS_DEFAULT_WIDTH, Samples_Data.PANELS_DEFAULT_HEIGHT));
70 17543 jmvivo
                resetChangedStatus();
71 15734 vcaballero
        }
72
73
        /**
74
         * This method initializes jTextArea
75
         *
76
         * @return JTextArea
77
         */
78
        private JTextArea getJTextArea() {
79
                if (jTextArea == null) {
80
                        jTextArea = new JTextArea(5, 40);
81
                        jTextArea.setText("I\'m a JTextArea object in the \"Panel\" with:\n\nID: " + getID() + "\nLabel: " + getLabel() + "\nLabelGroup: " + getLabelGroup());
82
                        jTextArea.setEditable(false);
83
                        jTextArea.setBackground(Color.GRAY);
84
                }
85
86
                return jTextArea;
87
        }
88
89
        @Override
90
        public void setID(String id) {
91
                super.setID(id);
92
93
                setToolTipText(getID());
94
                getJTextArea().setText("I\'m a JTextArea object in the \"Panel\" with:\n\nID: " + getID() + "\nLabel: " + getLabel() + "\nLabelGroup: " + getLabelGroup());
95 17543 jmvivo
                hasChanged = true;
96 15734 vcaballero
        }
97
98
        @Override
99
        public void setLabel(String label) {
100
                super.setLabel(label);
101
102
                getJTextArea().setText("I\'m a JTextArea object in the \"Panel\" with:\n\nID: " + getID() + "\nLabel: " + getLabel() + "\nLabelGroup: " + getLabelGroup());
103 17543 jmvivo
                hasChanged = true;
104 15734 vcaballero
        }
105
106
        @Override
107
        public void setLabelGroup(String labelGroup) {
108
                super.setLabelGroup(labelGroup);
109
110
                getJTextArea().setText("I\'m a JTextArea object in the \"Panel\" with:\n\nID: " + getID() + "\nLabel: " + getLabel() + "\nLabelGroup: " + getLabelGroup());
111 17543 jmvivo
                hasChanged = true;
112 15734 vcaballero
        }
113
114 17543 jmvivo
        /*
115
         * (non-Javadoc)
116
         * @see org.gvsig.gui.beans.panelGroup.panels.IPanel#accept()
117
         */
118 15734 vcaballero
        public void accept() {
119 17543 jmvivo
                System.out.println("I'm the IPanel: " + toString() + "\n and I'm executing an 'accept' method.");
120 15734 vcaballero
        }
121
122 17543 jmvivo
        /*
123
         * (non-Javadoc)
124
         * @see org.gvsig.gui.beans.panelGroup.panels.IPanel#apply()
125
         */
126 15734 vcaballero
        public void apply() {
127 17543 jmvivo
                System.out.println("I'm the IPanel: " + toString() + "\n and I'm executing an 'apply' method.");
128 15734 vcaballero
        }
129
130 17543 jmvivo
        /*
131
         * (non-Javadoc)
132
         * @see org.gvsig.gui.beans.panelGroup.panels.IPanel#cancel()
133
         */
134 15734 vcaballero
        public void cancel() {
135 17543 jmvivo
                System.out.println("I'm the IPanel: " + toString() + "\n and I'm executing a 'cancel' method.");
136 15734 vcaballero
        }
137
138 17543 jmvivo
        /*
139
         * (non-Javadoc)
140
         * @see org.gvsig.gui.beans.panelGroup.panels.IPanel#selected()
141
         */
142 15734 vcaballero
        public void selected() {
143 16231 vcaballero
                System.out.println("I'm the IPanel: " + toString() + "\n and I've been selected. My information is: " +
144 17026 vcaballero
                                 "\n\tID: " + getID() + "\n\tLABEL_GROUP: " + getLabelGroup() + "\n\tLABEL: " + getLabel() + "\n\tCLASS: " + getClass() +
145
                                 "\n\tMy Preferred Size: " + getPreferredSize() + "\n\tAnd My size: " + getSize());
146 15734 vcaballero
        }
147
}