root / trunk / libraries / libUIComponent / src-test-ui / org / gvsig / gui / beans / panelGroup / samples / SamplePanelGroupLabelRepeated.java @ 17543
History | View | Annotate | Download (4.45 KB)
1 |
/* 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 |
import java.awt.Dimension; |
24 |
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 |
private static final long serialVersionUID = 1857806149242138609L; |
39 |
|
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 |
|
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 |
resetChangedStatus(); |
71 |
} |
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 |
hasChanged = true;
|
96 |
} |
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 |
hasChanged = true;
|
104 |
} |
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 |
hasChanged = true;
|
112 |
} |
113 |
|
114 |
/*
|
115 |
* (non-Javadoc)
|
116 |
* @see org.gvsig.gui.beans.panelGroup.panels.IPanel#accept()
|
117 |
*/
|
118 |
public void accept() { |
119 |
System.out.println("I'm the IPanel: " + toString() + "\n and I'm executing an 'accept' method."); |
120 |
} |
121 |
|
122 |
/*
|
123 |
* (non-Javadoc)
|
124 |
* @see org.gvsig.gui.beans.panelGroup.panels.IPanel#apply()
|
125 |
*/
|
126 |
public void apply() { |
127 |
System.out.println("I'm the IPanel: " + toString() + "\n and I'm executing an 'apply' method."); |
128 |
} |
129 |
|
130 |
/*
|
131 |
* (non-Javadoc)
|
132 |
* @see org.gvsig.gui.beans.panelGroup.panels.IPanel#cancel()
|
133 |
*/
|
134 |
public void cancel() { |
135 |
System.out.println("I'm the IPanel: " + toString() + "\n and I'm executing a 'cancel' method."); |
136 |
} |
137 |
|
138 |
/*
|
139 |
* (non-Javadoc)
|
140 |
* @see org.gvsig.gui.beans.panelGroup.panels.IPanel#selected()
|
141 |
*/
|
142 |
public void selected() { |
143 |
System.out.println("I'm the IPanel: " + toString() + "\n and I've been selected. My information is: " + |
144 |
"\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 |
} |
147 |
} |
148 |
|