1 |
package appl.ext; |
2 |
|
3 |
import java.awt.BorderLayout; |
4 |
import javax.swing.JPanel; |
5 |
import javax.swing.JFrame; |
6 |
import java.awt.Dimension; |
7 |
import javax.swing.JList; |
8 |
import javax.swing.JScrollPane; |
9 |
import javax.swing.JTable; |
10 |
import javax.swing.BoxLayout; |
11 |
|
12 |
import edu.bonn.xulu.gui.XuluInternalFrame; |
13 |
|
14 |
import java.awt.FlowLayout; |
15 |
import java.awt.GridLayout; |
16 |
import java.awt.GridBagLayout; |
17 |
import java.awt.GridBagConstraints; |
18 |
import java.awt.Insets; |
19 |
import javax.swing.ListSelectionModel; |
20 |
import javax.swing.JLabel; |
21 |
import javax.swing.border.SoftBevelBorder; |
22 |
import javax.swing.BorderFactory; |
23 |
import javax.swing.border.BevelBorder; |
24 |
import javax.swing.JTextField; |
25 |
import javax.swing.JTextArea; |
26 |
import javax.swing.SwingConstants; |
27 |
|
28 |
/** |
29 |
* Displays the properties of {@link XuluConfig}. The interesting stuff happens |
30 |
* in {@link ConfigurationEditorEngine}. |
31 |
* |
32 |
* @see XuluConfig |
33 |
* @see ConfigurationEditorEngine |
34 |
* @author Dominik Appl |
35 |
*/ |
36 |
public class ConfigurationEditorGUI extends JPanel { |
37 |
|
38 |
private static final long serialVersionUID = 1L; |
39 |
|
40 |
JList keyList = null; |
41 |
|
42 |
JScrollPane scrollPane = null; |
43 |
|
44 |
JTable entryTable = null; |
45 |
|
46 |
private JPanel jPanel = null; |
47 |
|
48 |
private JPanel jPanel1 = null; |
49 |
|
50 |
private JLabel jLabel = null; |
51 |
|
52 |
private JScrollPane jScrollPane = null; |
53 |
|
54 |
JTextArea docArea = null; |
55 |
|
56 |
private JLabel jLabel1 = null; |
57 |
|
58 |
private JPanel jPanel2 = null; |
59 |
|
60 |
/** |
61 |
* This is the default constructor |
62 |
*/ |
63 |
public ConfigurationEditorGUI() { |
64 |
super(); |
65 |
initialize(); |
66 |
} |
67 |
|
68 |
/** |
69 |
* This method initializes this |
70 |
* |
71 |
* @return void |
72 |
*/ |
73 |
private void initialize() { |
74 |
GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); |
75 |
gridBagConstraints4.insets = new Insets(0, 0, 0, 0); |
76 |
gridBagConstraints4.gridy = 0; |
77 |
gridBagConstraints4.ipady = 0; |
78 |
gridBagConstraints4.gridwidth = 1; |
79 |
gridBagConstraints4.weightx = 1.0; |
80 |
gridBagConstraints4.weighty = 1.0; |
81 |
gridBagConstraints4.fill = GridBagConstraints.BOTH; |
82 |
gridBagConstraints4.ipadx = 0; |
83 |
gridBagConstraints4.gridx = 1; |
84 |
GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); |
85 |
gridBagConstraints3.gridx = 0; |
86 |
gridBagConstraints3.ipadx = 135; |
87 |
gridBagConstraints3.ipady = 0; |
88 |
gridBagConstraints3.anchor = GridBagConstraints.WEST; |
89 |
gridBagConstraints3.fill = GridBagConstraints.VERTICAL; |
90 |
gridBagConstraints3.gridheight = 1; |
91 |
gridBagConstraints3.gridwidth = 1; |
92 |
gridBagConstraints3.weightx = 0.0; |
93 |
gridBagConstraints3.weighty = 1.0; |
94 |
gridBagConstraints3.gridy = 0; |
95 |
this.setLayout(new GridBagLayout()); |
96 |
this.setSize(682, 239); |
97 |
this.add(getJPanel(), gridBagConstraints3); |
98 |
this.add(getJPanel1(), gridBagConstraints4); |
99 |
} |
100 |
|
101 |
/** |
102 |
* This method initializes keyList |
103 |
* |
104 |
* @return javax.swing.JList |
105 |
*/ |
106 |
private JList getKeyList() { |
107 |
if (keyList == null) { |
108 |
keyList = new JList(); |
109 |
keyList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
110 |
} |
111 |
return keyList; |
112 |
} |
113 |
|
114 |
/** |
115 |
* This method initializes scrollPane |
116 |
* |
117 |
* @return javax.swing.JScrollPane |
118 |
*/ |
119 |
private JScrollPane getScrollPane() { |
120 |
if (scrollPane == null) { |
121 |
scrollPane = new JScrollPane(); |
122 |
scrollPane.setViewportView(getEntryTable()); |
123 |
} |
124 |
return scrollPane; |
125 |
} |
126 |
|
127 |
/** |
128 |
* This method initializes entryTable |
129 |
* |
130 |
* @return javax.swing.JTable |
131 |
*/ |
132 |
private JTable getEntryTable() { |
133 |
if (entryTable == null) { |
134 |
entryTable = new JTable(); |
135 |
} |
136 |
return entryTable; |
137 |
} |
138 |
|
139 |
/** |
140 |
* This method initializes jPanel |
141 |
* |
142 |
* @return javax.swing.JPanel |
143 |
*/ |
144 |
private JPanel getJPanel() { |
145 |
if (jPanel == null) { |
146 |
GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
147 |
gridBagConstraints2.fill = GridBagConstraints.BOTH; |
148 |
gridBagConstraints2.gridy = 1; |
149 |
gridBagConstraints2.ipadx = 0; |
150 |
gridBagConstraints2.ipady = 0; |
151 |
gridBagConstraints2.weightx = 1.0; |
152 |
gridBagConstraints2.weighty = 1.0; |
153 |
gridBagConstraints2.insets = new Insets(0, 10, 10, 10); |
154 |
gridBagConstraints2.gridx = 0; |
155 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
156 |
gridBagConstraints.insets = new Insets(5, 0, 5, 0); |
157 |
gridBagConstraints.gridy = 0; |
158 |
gridBagConstraints.gridx = 0; |
159 |
jLabel = new JLabel(); |
160 |
jLabel.setText("Category:"); |
161 |
jPanel = new JPanel(); |
162 |
jPanel.setLayout(new GridBagLayout()); |
163 |
jPanel.add(jLabel, gridBagConstraints); |
164 |
jPanel.add(getJScrollPane(), gridBagConstraints2); |
165 |
} |
166 |
return jPanel; |
167 |
} |
168 |
|
169 |
/** |
170 |
* This method initializes jPanel1 |
171 |
* |
172 |
* @return javax.swing.JPanel |
173 |
*/ |
174 |
private JPanel getJPanel1() { |
175 |
if (jPanel1 == null) { |
176 |
GridBagConstraints gridBagConstraints8 = new GridBagConstraints(); |
177 |
gridBagConstraints8.insets = new Insets(0, 0, 1, 0); |
178 |
gridBagConstraints8.gridy = 1; |
179 |
gridBagConstraints8.ipadx = 419; |
180 |
gridBagConstraints8.ipady = 0; |
181 |
gridBagConstraints8.fill = GridBagConstraints.NONE; |
182 |
gridBagConstraints8.gridx = 0; |
183 |
GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); |
184 |
gridBagConstraints7.fill = GridBagConstraints.BOTH; |
185 |
gridBagConstraints7.gridy = 0; |
186 |
gridBagConstraints7.ipadx = 55; |
187 |
gridBagConstraints7.ipady = 0; |
188 |
gridBagConstraints7.weightx = 1.0; |
189 |
gridBagConstraints7.weighty = 1.0; |
190 |
gridBagConstraints7.insets = new Insets(25, 0, 0, 10); |
191 |
gridBagConstraints7.gridx = 0; |
192 |
jLabel1 = new JLabel(); |
193 |
jLabel1.setText("Documentation:"); |
194 |
jLabel1.setVerticalAlignment(SwingConstants.TOP); |
195 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
196 |
gridBagConstraints1.anchor = GridBagConstraints.EAST; |
197 |
gridBagConstraints1.insets = new Insets(0, 150, 0, 0); |
198 |
gridBagConstraints1.gridx = -1; |
199 |
gridBagConstraints1.gridy = -1; |
200 |
gridBagConstraints1.ipady = 0; |
201 |
gridBagConstraints1.weightx = 1.0; |
202 |
gridBagConstraints1.weighty = 1.0; |
203 |
gridBagConstraints1.fill = GridBagConstraints.BOTH; |
204 |
jPanel1 = new JPanel(); |
205 |
jPanel1.setLayout(new GridBagLayout()); |
206 |
jPanel1.add(getScrollPane(), gridBagConstraints7); |
207 |
jPanel1.add(getJPanel2(), gridBagConstraints8); |
208 |
} |
209 |
return jPanel1; |
210 |
} |
211 |
|
212 |
/** |
213 |
* This method initializes jScrollPane |
214 |
* |
215 |
* @return javax.swing.JScrollPane |
216 |
*/ |
217 |
private JScrollPane getJScrollPane() { |
218 |
if (jScrollPane == null) { |
219 |
jScrollPane = new JScrollPane(); |
220 |
jScrollPane.setPreferredSize(new Dimension(100, 100)); |
221 |
jScrollPane.setViewportView(getKeyList()); |
222 |
} |
223 |
return jScrollPane; |
224 |
} |
225 |
|
226 |
/** |
227 |
* This method initializes docArea |
228 |
* |
229 |
* @return javax.swing.JTextArea |
230 |
*/ |
231 |
private JTextArea getDocArea() { |
232 |
if (docArea == null) { |
233 |
docArea = new JTextArea(); |
234 |
docArea.setPreferredSize(new Dimension(0, 50)); |
235 |
docArea.setText("<select a value to see its documentation>"); |
236 |
docArea.setRows(2); |
237 |
docArea.setLineWrap(true); |
238 |
docArea.setEditable(false); |
239 |
} |
240 |
return docArea; |
241 |
} |
242 |
|
243 |
/** |
244 |
* This method initializes jPanel2 |
245 |
* |
246 |
* @return javax.swing.JPanel |
247 |
*/ |
248 |
private JPanel getJPanel2() { |
249 |
if (jPanel2 == null) { |
250 |
GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); |
251 |
gridBagConstraints6.fill = GridBagConstraints.HORIZONTAL; |
252 |
gridBagConstraints6.gridy = 1; |
253 |
gridBagConstraints6.ipadx = 0; |
254 |
gridBagConstraints6.ipady = 21; |
255 |
gridBagConstraints6.weightx = 1.0; |
256 |
gridBagConstraints6.weighty = 1.0; |
257 |
gridBagConstraints6.insets = new Insets(0, 0, 10, 10); |
258 |
gridBagConstraints6.gridx = 1; |
259 |
GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
260 |
gridBagConstraints5.insets = new Insets(0, 0, 0, 0); |
261 |
gridBagConstraints5.gridy = 0; |
262 |
gridBagConstraints5.anchor = GridBagConstraints.WEST; |
263 |
gridBagConstraints5.gridx = 1; |
264 |
jPanel2 = new JPanel(); |
265 |
jPanel2.setLayout(new GridBagLayout()); |
266 |
jPanel2.add(jLabel1, gridBagConstraints5); |
267 |
jPanel2.add(getDocArea(), gridBagConstraints6); |
268 |
} |
269 |
return jPanel2; |
270 |
} |
271 |
|
272 |
} // @jve:decl-index=0:visual-constraint="10,10" |