root / trunk / libraries / libUIComponent / src / org / gvsig / gui / beans / panelGroup / panels / AbstractPanel.java @ 15734
History | View | Annotate | Download (4.84 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.panels; |
21 |
|
22 |
import javax.swing.JPanel; |
23 |
|
24 |
import org.gvsig.gui.beans.panelGroup.AbstractPanelGroup; |
25 |
|
26 |
/**
|
27 |
* <p>Represents a {@link JPanel JPanel} adapted to work as a panel of an {@link AbstractPanelGroup AbstractPanelGroup}.</p>
|
28 |
*
|
29 |
* @see JPanel
|
30 |
* @see IPanel
|
31 |
*
|
32 |
* @see AbstractPanelGroup
|
33 |
*
|
34 |
* @version 16/10/2007
|
35 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
|
36 |
*/
|
37 |
public abstract class AbstractPanel extends JPanel implements IPanel { |
38 |
/**
|
39 |
* <p>Optional attribute that identifies this panel.</p>
|
40 |
*
|
41 |
* @see #getID()
|
42 |
* @see #setID(String)
|
43 |
*/
|
44 |
private String id; |
45 |
|
46 |
/**
|
47 |
* <p>Identifier used by a {@link AbstractPanelGroup AbstractPanelGroup} to identify this panel.</p>
|
48 |
*
|
49 |
* @see #getLabel()
|
50 |
* @see #setLabel(String)
|
51 |
*/
|
52 |
private String label; |
53 |
|
54 |
/**
|
55 |
* <p>Identifier used to group together different <code>IPanel</code> panels
|
56 |
* in a {@link AbstractPanelGroup AbstractPanelGroup}</p>
|
57 |
*
|
58 |
* @see #getLabelGroup()
|
59 |
* @see #setLabelGroup(String)
|
60 |
*/
|
61 |
private String labelGroup; |
62 |
|
63 |
/**
|
64 |
* <p>Reference to an object that is related this panel</p>
|
65 |
*
|
66 |
* @see #setReference(Object)
|
67 |
* @see #getReferenceClass()
|
68 |
*/
|
69 |
private Object reference; |
70 |
|
71 |
/**
|
72 |
* <p>Initializes this panel.</p>
|
73 |
*/
|
74 |
public AbstractPanel() {
|
75 |
super();
|
76 |
|
77 |
this.id = null; |
78 |
this.label = null; |
79 |
this.labelGroup = null; |
80 |
} |
81 |
|
82 |
/**
|
83 |
* <p>Initializes this panel using three parameters.</p>
|
84 |
*
|
85 |
* @param id optional attribute that identifies this panel
|
86 |
* @param label identifier used by a {@link AbstractPanelGroup AbstractPanelGroup} to identify this panel
|
87 |
* @param labelGroup identifier used to group together different <code>IPanel</code> panels
|
88 |
* in a {@link AbstractPanelGroup AbstractPanelGroup}
|
89 |
*/
|
90 |
public AbstractPanel(String id, String label, String labelGroup) { |
91 |
super();
|
92 |
|
93 |
this.id = id;
|
94 |
this.label = label;
|
95 |
this.labelGroup = labelGroup;
|
96 |
} |
97 |
|
98 |
/**
|
99 |
* <p>This method is used by each concrete implementation of <code>AbstractPanel</code> to
|
100 |
* execute its particular initialization tasks.</p>
|
101 |
*/
|
102 |
protected abstract void initialize(); |
103 |
|
104 |
/*
|
105 |
* (non-Javadoc)
|
106 |
* @see org.gvsig.gui.beans.panelGroup.panels.IPanel#getID()
|
107 |
*/
|
108 |
public String getID() { |
109 |
return id;
|
110 |
} |
111 |
|
112 |
/*
|
113 |
* (non-Javadoc)
|
114 |
* @see org.gvsig.gui.beans.panelGroup.panels.IPanel#getLabel()
|
115 |
*/
|
116 |
public String getLabel() { |
117 |
return label;
|
118 |
} |
119 |
|
120 |
/*
|
121 |
* (non-Javadoc)
|
122 |
* @see org.gvsig.gui.beans.panelGroup.panels.IPanel#getLabelGroup()
|
123 |
*/
|
124 |
public String getLabelGroup() { |
125 |
return labelGroup;
|
126 |
} |
127 |
|
128 |
/*
|
129 |
* (non-Javadoc)
|
130 |
* @see org.gvsig.gui.beans.panelGroup.panels.IPanel#setID(java.lang.String)
|
131 |
*/
|
132 |
public void setID(String id) { |
133 |
this.id = id;
|
134 |
} |
135 |
|
136 |
/*
|
137 |
* (non-Javadoc)
|
138 |
* @see org.gvsig.gui.beans.panelGroup.panels.IPanel#setLabel(java.lang.String)
|
139 |
*/
|
140 |
public void setLabel(String label) { |
141 |
this.label = label;
|
142 |
} |
143 |
|
144 |
/*
|
145 |
* (non-Javadoc)
|
146 |
* @see org.gvsig.gui.beans.panelGroup.panels.IPanel#setLabelGroup(java.lang.String)
|
147 |
*/
|
148 |
public void setLabelGroup(String labelGroup) { |
149 |
this.labelGroup = labelGroup;
|
150 |
} |
151 |
|
152 |
/*
|
153 |
* (non-Javadoc)
|
154 |
* @see org.gvsig.gui.beans.panelGroup.panels.IPanel#getReferenceClass()
|
155 |
*/
|
156 |
public Class getReferenceClass() { |
157 |
return (reference == null)? null : reference.getClass(); |
158 |
} |
159 |
|
160 |
/*
|
161 |
* (non-Javadoc)
|
162 |
* @see org.gvsig.gui.beans.panelGroup.panels.IPanel#accept()
|
163 |
*/
|
164 |
public abstract void accept(); |
165 |
|
166 |
/*
|
167 |
* (non-Javadoc)
|
168 |
* @see org.gvsig.gui.beans.panelGroup.panels.IPanel#apply()
|
169 |
*/
|
170 |
public abstract void apply(); |
171 |
|
172 |
/*
|
173 |
* (non-Javadoc)
|
174 |
* @see org.gvsig.gui.beans.panelGroup.panels.IPanel#cancel()
|
175 |
*/
|
176 |
public abstract void cancel(); |
177 |
|
178 |
/*
|
179 |
* (non-Javadoc)
|
180 |
* @see org.gvsig.gui.beans.panelGroup.panels.IPanel#selected()
|
181 |
*/
|
182 |
public abstract void selected(); |
183 |
|
184 |
/*
|
185 |
* (non-Javadoc)
|
186 |
* @see org.gvsig.gui.beans.panelGroup.panels.IPanel#setReference(java.lang.Object)
|
187 |
*/
|
188 |
public void setReference(Object ref) { |
189 |
reference = ref; |
190 |
} |
191 |
|
192 |
/*
|
193 |
* (non-Javadoc)
|
194 |
* @see java.awt.Component#toString()
|
195 |
*/
|
196 |
public String toString() { |
197 |
return (label == null)? "": label; |
198 |
} |
199 |
} |