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