svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / test / java / org / gvsig / app / panelGroup / samples / SamplePanelGroupLabelRepeated.java @ 40558
History | View | Annotate | Download (3.94 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.app.panelGroup.samples; |
25 |
|
26 |
import java.awt.Color; |
27 |
import java.awt.Dimension; |
28 |
import java.io.Serializable; |
29 |
|
30 |
import javax.swing.JScrollPane; |
31 |
import javax.swing.JTextArea; |
32 |
|
33 |
import org.gvsig.gui.beans.panelGroup.panels.AbstractPanel; |
34 |
|
35 |
/**
|
36 |
* <p>Sample of {@link AbstractPanel AbstractPanel}.</p>
|
37 |
*
|
38 |
* @version 23/10/2007
|
39 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
|
40 |
*/
|
41 |
public class SamplePanelGroupLabelRepeated extends AbstractPanel implements Serializable { |
42 |
private static final long serialVersionUID = 1857806149242138609L; |
43 |
|
44 |
/**
|
45 |
* <p>Element for the interface.</p>
|
46 |
*/
|
47 |
private JTextArea jTextArea = null; |
48 |
|
49 |
/**
|
50 |
* @see AbstractPanel#AbstractPanel()
|
51 |
*/
|
52 |
public SamplePanelGroupLabelRepeated() {
|
53 |
super();
|
54 |
initialize(); |
55 |
} |
56 |
|
57 |
/**
|
58 |
* @see AbstractPanel#AbstractPanel(String, String, String)
|
59 |
*/
|
60 |
public SamplePanelGroupLabelRepeated(String id, String label, String labelGroup) { |
61 |
super(id, label, labelGroup);
|
62 |
initialize(); |
63 |
} |
64 |
|
65 |
@Override
|
66 |
protected void initialize() { |
67 |
add(new JScrollPane(getJTextArea())); |
68 |
setToolTipText(getID()); |
69 |
|
70 |
setID(Samples_ExtensionPointsOfIPanels.PANELS3_IDS[1]);
|
71 |
setLabel(Samples_ExtensionPointsOfIPanels.PANELS3_LABELS[1]);
|
72 |
setLabelGroup(Samples_ExtensionPointsOfIPanels.PANELS3_LABELGROUPS[1]);
|
73 |
setPreferredSize(new Dimension(Samples_ExtensionPointsOfIPanels.PANELS_DEFAULT_WIDTH, Samples_ExtensionPointsOfIPanels.PANELS_DEFAULT_HEIGHT)); |
74 |
resetChangedStatus(); |
75 |
} |
76 |
|
77 |
/**
|
78 |
* This method initializes jTextArea
|
79 |
*
|
80 |
* @return JTextArea
|
81 |
*/
|
82 |
private JTextArea getJTextArea() { |
83 |
if (jTextArea == null) { |
84 |
jTextArea = new JTextArea(5, 40); |
85 |
jTextArea.setText("I\'m a JTextArea object in the \"Panel\" with:\n\nID: " + getID() + "\nLabel: " + getLabel() + "\nLabelGroup: " + getLabelGroup()); |
86 |
jTextArea.setEditable(false);
|
87 |
jTextArea.setBackground(Color.GRAY);
|
88 |
} |
89 |
|
90 |
return jTextArea;
|
91 |
} |
92 |
|
93 |
@Override
|
94 |
public void setID(String id) { |
95 |
super.setID(id);
|
96 |
|
97 |
setToolTipText(getID()); |
98 |
getJTextArea().setText("I\'m a JTextArea object in the \"Panel\" with:\n\nID: " + getID() + "\nLabel: " + getLabel() + "\nLabelGroup: " + getLabelGroup()); |
99 |
} |
100 |
|
101 |
@Override
|
102 |
public void setLabel(String label) { |
103 |
super.setLabel(label);
|
104 |
|
105 |
getJTextArea().setText("I\'m a JTextArea object in the \"Panel\" with:\n\nID: " + getID() + "\nLabel: " + getLabel() + "\nLabelGroup: " + getLabelGroup()); |
106 |
} |
107 |
|
108 |
@Override
|
109 |
public void setLabelGroup(String labelGroup) { |
110 |
super.setLabelGroup(labelGroup);
|
111 |
|
112 |
getJTextArea().setText("I\'m a JTextArea object in the \"Panel\" with:\n\nID: " + getID() + "\nLabel: " + getLabel() + "\nLabelGroup: " + getLabelGroup()); |
113 |
} |
114 |
|
115 |
public void accept() { |
116 |
} |
117 |
|
118 |
public void apply() { |
119 |
} |
120 |
|
121 |
public void cancel() { |
122 |
} |
123 |
|
124 |
public void selected() { |
125 |
System.out.println("I'm the IPanel: " + toString() + "\n and I've been selected. My information is: " + |
126 |
"\n\tID: " + getID() + "\n\tLABEL_GROUP: " + getLabelGroup() + "\n\tLABEL: " + getLabel() + "\n\tCLASS: " + getClass() + |
127 |
"\n\tMy Preferred Size: " + getPreferredSize() + "\n\tAnd My size: " + getSize()); |
128 |
} |
129 |
} |
130 |
|