1 |
mojays |
2 |
package appl.plugin.multimodelcontrol; |
2 |
|
|
|
3 |
alfonx |
60 |
import java.awt.Cursor; |
4 |
mojays |
2 |
import java.awt.Dimension; |
5 |
|
|
import java.awt.GridBagConstraints; |
6 |
alfonx |
60 |
import java.awt.GridBagLayout; |
7 |
|
|
import java.awt.GridLayout; |
8 |
|
|
import java.awt.Insets; |
9 |
mojays |
2 |
|
10 |
alfonx |
60 |
import javax.swing.BoxLayout; |
11 |
mojays |
2 |
import javax.swing.JButton; |
12 |
|
|
import javax.swing.JLabel; |
13 |
alfonx |
60 |
import javax.swing.JList; |
14 |
|
|
import javax.swing.JPanel; |
15 |
mojays |
2 |
import javax.swing.JScrollPane; |
16 |
|
|
import javax.swing.JTextArea; |
17 |
alfonx |
60 |
import javax.swing.ListSelectionModel; |
18 |
mojays |
2 |
|
19 |
|
|
import appl.parallel.gui.ParallelControlPanelEngine; |
20 |
alfonx |
60 |
import edu.bonn.xulu.gui.XuluInternalFrame; |
21 |
mojays |
2 |
|
22 |
|
|
/** |
23 |
|
|
* The GUI for the ModelControlCenter (MCC). All the interesting stuff happens in the |
24 |
|
|
* {@link ParallelControlPanelEngine}. |
25 |
|
|
* This GUI was created with the Visual Editor plugin for eclipse. |
26 |
|
|
* |
27 |
|
|
* @author Dominik Appl |
28 |
|
|
*/ |
29 |
|
|
public class MultiModelControlFrame extends XuluInternalFrame { |
30 |
|
|
|
31 |
|
|
static final long serialVersionUID = 1L; |
32 |
|
|
JPanel jContentPane = null; |
33 |
|
|
JPanel modelPanel = null; |
34 |
|
|
JPanel synchronisationPanel = null; |
35 |
|
|
JList modelList = null; |
36 |
|
|
JLabel loadedModels = null; |
37 |
|
|
JList syncCommandList = null; |
38 |
|
|
JLabel syncPanelName = null; |
39 |
|
|
JButton addStepCommand = null; |
40 |
|
|
JButton newOverAllStep = null; |
41 |
|
|
JButton clearModelSteps = null; |
42 |
|
|
JPanel syncButtonsPanel = null; |
43 |
|
|
JScrollPane jScrollPane = null; |
44 |
|
|
private JPanel jPanel = null; |
45 |
|
|
private JPanel controlPanel = null; |
46 |
|
|
JButton startButton = null; |
47 |
|
|
JButton stepButton = null; |
48 |
|
|
JButton stopButton = null; |
49 |
|
|
private JPanel jPanel3 = null; |
50 |
|
|
private JScrollPane jScrollPane1 = null; |
51 |
|
|
private JPanel jPanel5 = null; |
52 |
|
|
private JScrollPane jScrollPane2 = null; |
53 |
|
|
private JLabel jLabel3 = null; |
54 |
|
|
JTextArea console = null; |
55 |
|
|
|
56 |
|
|
|
57 |
|
|
public MultiModelControlFrame() { |
58 |
|
|
super("Multi Model ControlFrame"); |
59 |
|
|
initialize(); |
60 |
|
|
} |
61 |
|
|
|
62 |
|
|
/** |
63 |
|
|
* This method initializes this |
64 |
|
|
* |
65 |
|
|
* @return void |
66 |
|
|
*/ |
67 |
|
|
private void initialize() { |
68 |
|
|
this.setSize(486, 395); |
69 |
|
|
this.setContentPane(getJContentPane()); |
70 |
|
|
this.setTitle("Multi Model Control"); |
71 |
|
|
this.setClosable(true); |
72 |
|
|
this.setDefaultCloseOperation(HIDE_ON_CLOSE); |
73 |
|
|
} |
74 |
|
|
/** |
75 |
|
|
* This method initializes jContentPane |
76 |
|
|
* |
77 |
|
|
* @return javax.swing.JPanel |
78 |
|
|
*/ |
79 |
|
|
private JPanel getJContentPane() { |
80 |
|
|
if (jContentPane == null) { |
81 |
|
|
jContentPane = new JPanel(); |
82 |
|
|
jContentPane.setLayout(new BoxLayout(getJContentPane(), BoxLayout.Y_AXIS)); |
83 |
|
|
jContentPane.add(getControlPanel(), null); |
84 |
|
|
jContentPane.add(getJPanel(), null); |
85 |
|
|
jContentPane.add(getJPanel5(), null); |
86 |
|
|
} |
87 |
|
|
return jContentPane; |
88 |
|
|
} |
89 |
|
|
/** |
90 |
|
|
* This method initializes modelPanel |
91 |
|
|
* |
92 |
|
|
* @return javax.swing.JPanel |
93 |
|
|
*/ |
94 |
|
|
private JPanel getModelPanel() { |
95 |
|
|
if (modelPanel == null) { |
96 |
|
|
GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); |
97 |
|
|
gridBagConstraints3.insets = new Insets(0, 0, 2, 0); |
98 |
|
|
gridBagConstraints3.gridy = 2; |
99 |
|
|
gridBagConstraints3.ipadx = 0; |
100 |
|
|
gridBagConstraints3.ipady = 0; |
101 |
|
|
gridBagConstraints3.gridx = 0; |
102 |
|
|
GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
103 |
|
|
gridBagConstraints2.fill = GridBagConstraints.BOTH; |
104 |
|
|
gridBagConstraints2.gridy = 1; |
105 |
|
|
gridBagConstraints2.ipadx = 0; |
106 |
|
|
gridBagConstraints2.ipady = 0; |
107 |
|
|
gridBagConstraints2.weightx = 1.0; |
108 |
|
|
gridBagConstraints2.weighty = 1.0; |
109 |
|
|
gridBagConstraints2.insets = new Insets(5, 5, 5, 5); |
110 |
|
|
gridBagConstraints2.gridx = 0; |
111 |
|
|
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
112 |
|
|
gridBagConstraints.insets = new Insets(3, 3, 3, 3); |
113 |
|
|
gridBagConstraints.gridy = 0; |
114 |
|
|
gridBagConstraints.ipadx = 0; |
115 |
|
|
gridBagConstraints.gridx = 0; |
116 |
|
|
loadedModels = new JLabel(); |
117 |
|
|
loadedModels.setText("Models"); |
118 |
|
|
loadedModels.setMinimumSize(new Dimension(86, 10)); |
119 |
|
|
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
120 |
|
|
gridBagConstraints1.fill = GridBagConstraints.BOTH; |
121 |
|
|
gridBagConstraints1.weighty = 1.0; |
122 |
|
|
gridBagConstraints1.weightx = 1.0; |
123 |
|
|
modelPanel = new JPanel(); |
124 |
|
|
modelPanel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); |
125 |
|
|
modelPanel.setName("modelPanel"); |
126 |
|
|
modelPanel.setLayout(new GridBagLayout()); |
127 |
|
|
modelPanel.add(loadedModels, gridBagConstraints); |
128 |
|
|
modelPanel.add(getJScrollPane(), gridBagConstraints2); |
129 |
|
|
modelPanel.add(getAddStepCommand(), gridBagConstraints3); |
130 |
|
|
} |
131 |
|
|
return modelPanel; |
132 |
|
|
} |
133 |
|
|
|
134 |
|
|
/** |
135 |
|
|
* This method initializes synchronisationPanel |
136 |
|
|
* |
137 |
|
|
* @return javax.swing.JPanel |
138 |
|
|
*/ |
139 |
|
|
private JPanel getSynchronisationPanel() { |
140 |
|
|
if (synchronisationPanel == null) { |
141 |
|
|
GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); |
142 |
|
|
gridBagConstraints11.fill = GridBagConstraints.BOTH; |
143 |
|
|
gridBagConstraints11.weighty = 1.0; |
144 |
|
|
gridBagConstraints11.gridy = 1; |
145 |
|
|
gridBagConstraints11.insets = new Insets(0, 5, 2, 5); |
146 |
|
|
gridBagConstraints11.weightx = 1.0; |
147 |
|
|
GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
148 |
|
|
gridBagConstraints5.gridx = 0; |
149 |
|
|
gridBagConstraints5.insets = new Insets(0, 0, 2, 0); |
150 |
|
|
gridBagConstraints5.gridy = 11; |
151 |
|
|
GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); |
152 |
|
|
gridBagConstraints7.gridx = 0; |
153 |
|
|
gridBagConstraints7.ipady = 0; |
154 |
|
|
gridBagConstraints7.insets = new Insets(3, 0, 3, 0); |
155 |
|
|
gridBagConstraints7.gridy = 0; |
156 |
|
|
syncPanelName = new JLabel(); |
157 |
|
|
syncPanelName.setText("Commands"); |
158 |
|
|
synchronisationPanel = new JPanel(); |
159 |
|
|
synchronisationPanel.setToolTipText("Here you can synchronize the steps of multiple models"); |
160 |
|
|
synchronisationPanel.setLayout(new GridBagLayout()); |
161 |
|
|
synchronisationPanel.add(syncPanelName, gridBagConstraints7); |
162 |
|
|
synchronisationPanel.add(getJScrollPane1(), gridBagConstraints11); |
163 |
|
|
synchronisationPanel.add(getSyncButtonsPanel(), gridBagConstraints5); |
164 |
|
|
} |
165 |
|
|
return synchronisationPanel; |
166 |
|
|
} |
167 |
|
|
/** |
168 |
|
|
* This method initializes jList |
169 |
|
|
* |
170 |
|
|
* @return javax.swing.JList |
171 |
|
|
*/ |
172 |
|
|
private JList getModelList() { |
173 |
|
|
if (modelList == null) { |
174 |
|
|
modelList = new JList(); |
175 |
|
|
modelList.setName("modelList"); |
176 |
|
|
modelList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
177 |
|
|
modelList.setToolTipText("All models, which are currently loaded. Doubleclick on a model to set propertys"); |
178 |
|
|
} |
179 |
|
|
return modelList; |
180 |
|
|
} |
181 |
|
|
/** |
182 |
|
|
* This method initializes jList |
183 |
|
|
* |
184 |
|
|
* @return javax.swing.JList |
185 |
|
|
*/ |
186 |
|
|
private JList getSyncCommandList() { |
187 |
|
|
if (syncCommandList == null) { |
188 |
|
|
syncCommandList = new JList(); |
189 |
|
|
syncCommandList.setToolTipText("The list of commands to be executed"); |
190 |
|
|
|
191 |
|
|
} |
192 |
|
|
return syncCommandList; |
193 |
|
|
} |
194 |
|
|
|
195 |
|
|
/** |
196 |
|
|
* This method initializes addStepCommand |
197 |
|
|
* |
198 |
|
|
* @return javax.swing.JButton |
199 |
|
|
*/ |
200 |
|
|
private JButton getAddStepCommand() { |
201 |
|
|
if (addStepCommand == null) { |
202 |
|
|
addStepCommand = new JButton(); |
203 |
|
|
addStepCommand.setText("Add ====> "); |
204 |
|
|
addStepCommand.setPreferredSize(new Dimension(100, 20)); |
205 |
|
|
} |
206 |
|
|
return addStepCommand; |
207 |
|
|
} |
208 |
|
|
/** |
209 |
|
|
* This method initializes newOverAllStep |
210 |
|
|
* |
211 |
|
|
* @return javax.swing.JButton |
212 |
|
|
*/ |
213 |
|
|
private JButton getNewOverAllStep() { |
214 |
|
|
if (newOverAllStep == null) { |
215 |
|
|
newOverAllStep = new JButton(); |
216 |
|
|
newOverAllStep.setText("Add Repeat"); |
217 |
|
|
newOverAllStep.setPreferredSize(new Dimension(119, 20)); |
218 |
|
|
} |
219 |
|
|
return newOverAllStep; |
220 |
|
|
} |
221 |
|
|
/** |
222 |
|
|
* This method initializes clearModelSteps |
223 |
|
|
* |
224 |
|
|
* @return javax.swing.JButton |
225 |
|
|
*/ |
226 |
|
|
private JButton getClearModelSteps() { |
227 |
|
|
if (clearModelSteps == null) { |
228 |
|
|
clearModelSteps = new JButton(); |
229 |
|
|
clearModelSteps.setText("Delete entry"); |
230 |
|
|
clearModelSteps.setPreferredSize(new Dimension(64, 20)); |
231 |
|
|
} |
232 |
|
|
return clearModelSteps; |
233 |
|
|
} |
234 |
|
|
/** |
235 |
|
|
* This method initializes syncButtonsPanel |
236 |
|
|
* |
237 |
|
|
* @return javax.swing.JPanel |
238 |
|
|
*/ |
239 |
|
|
private JPanel getSyncButtonsPanel() { |
240 |
|
|
if (syncButtonsPanel == null) { |
241 |
|
|
GridLayout gridLayout1 = new GridLayout(); |
242 |
|
|
gridLayout1.setRows(1); |
243 |
|
|
gridLayout1.setColumns(2); |
244 |
|
|
GridBagConstraints gridBagConstraints9 = new GridBagConstraints(); |
245 |
|
|
gridBagConstraints9.anchor = GridBagConstraints.WEST; |
246 |
|
|
gridBagConstraints9.gridx = -1; |
247 |
|
|
gridBagConstraints9.gridy = -1; |
248 |
|
|
gridBagConstraints9.fill = GridBagConstraints.HORIZONTAL; |
249 |
|
|
GridBagConstraints gridBagConstraints8 = new GridBagConstraints(); |
250 |
|
|
gridBagConstraints8.fill = GridBagConstraints.HORIZONTAL; |
251 |
|
|
gridBagConstraints8.gridy = -1; |
252 |
|
|
gridBagConstraints8.gridx = -1; |
253 |
|
|
syncButtonsPanel = new JPanel(); |
254 |
|
|
syncButtonsPanel.setLayout(gridLayout1); |
255 |
|
|
syncButtonsPanel.add(getNewOverAllStep(), null); |
256 |
|
|
syncButtonsPanel.add(getClearModelSteps(), null); |
257 |
|
|
} |
258 |
|
|
return syncButtonsPanel; |
259 |
|
|
} |
260 |
|
|
/* (non-Javadoc) |
261 |
|
|
* @see edu.bonn.xulu.gui.XuluInternalFrame#refresh() |
262 |
|
|
*/ |
263 |
|
|
@Override |
264 |
|
|
public void refresh() { |
265 |
|
|
// TODO Auto-generated method stub |
266 |
|
|
|
267 |
|
|
} |
268 |
|
|
|
269 |
|
|
/** |
270 |
|
|
* This method initializes jScrollPane |
271 |
|
|
* |
272 |
|
|
* @return javax.swing.JScrollPane |
273 |
|
|
*/ |
274 |
|
|
private JScrollPane getJScrollPane() { |
275 |
|
|
if (jScrollPane == null) { |
276 |
|
|
jScrollPane = new JScrollPane(); |
277 |
|
|
jScrollPane.setViewportView(getModelList()); |
278 |
|
|
} |
279 |
|
|
return jScrollPane; |
280 |
|
|
} |
281 |
|
|
|
282 |
|
|
/** |
283 |
|
|
* This method initializes jPanel |
284 |
|
|
* |
285 |
|
|
* @return javax.swing.JPanel |
286 |
|
|
*/ |
287 |
|
|
private JPanel getJPanel() { |
288 |
|
|
if (jPanel == null) { |
289 |
|
|
GridLayout gridLayout = new GridLayout(); |
290 |
|
|
gridLayout.setRows(1); |
291 |
|
|
gridLayout.setVgap(0); |
292 |
|
|
gridLayout.setColumns(4); |
293 |
|
|
gridLayout.setHgap(0); |
294 |
|
|
jPanel = new JPanel(); |
295 |
|
|
jPanel.setLayout(gridLayout); |
296 |
|
|
jPanel.add(getModelPanel(), null); |
297 |
|
|
jPanel.add(getSynchronisationPanel(), null); |
298 |
|
|
} |
299 |
|
|
return jPanel; |
300 |
|
|
} |
301 |
|
|
|
302 |
|
|
/** |
303 |
|
|
* This method initializes controlPanel |
304 |
|
|
* |
305 |
|
|
* @return javax.swing.JPanel |
306 |
|
|
*/ |
307 |
|
|
private JPanel getControlPanel() { |
308 |
|
|
if (controlPanel == null) { |
309 |
|
|
GridLayout gridLayout3 = new GridLayout(); |
310 |
|
|
gridLayout3.setRows(1); |
311 |
|
|
gridLayout3.setHgap(5); |
312 |
|
|
gridLayout3.setColumns(2); |
313 |
|
|
gridLayout3.setVgap(5); |
314 |
|
|
controlPanel = new JPanel(); |
315 |
|
|
controlPanel.setMaximumSize(new Dimension(1000, 20)); |
316 |
|
|
controlPanel.setLayout(gridLayout3); |
317 |
|
|
controlPanel.add(getJPanel3(), null); |
318 |
|
|
} |
319 |
|
|
return controlPanel; |
320 |
|
|
} |
321 |
|
|
|
322 |
|
|
/** |
323 |
|
|
* This method initializes startButton |
324 |
|
|
* |
325 |
|
|
* @return javax.swing.JButton |
326 |
|
|
*/ |
327 |
|
|
private JButton getStartButton() { |
328 |
|
|
if (startButton == null) { |
329 |
|
|
startButton = new JButton(); |
330 |
|
|
startButton.setText("Start"); |
331 |
|
|
} |
332 |
|
|
return startButton; |
333 |
|
|
} |
334 |
|
|
|
335 |
|
|
/** |
336 |
|
|
* This method initializes stepButton |
337 |
|
|
* |
338 |
|
|
* @return javax.swing.JButton |
339 |
|
|
*/ |
340 |
|
|
private JButton getStepButton() { |
341 |
|
|
if (stepButton == null) { |
342 |
|
|
stepButton = new JButton(); |
343 |
|
|
stepButton.setText("Step"); |
344 |
|
|
} |
345 |
|
|
return stepButton; |
346 |
|
|
} |
347 |
|
|
|
348 |
|
|
/** |
349 |
|
|
* This method initializes stopButton |
350 |
|
|
* |
351 |
|
|
* @return javax.swing.JButton |
352 |
|
|
*/ |
353 |
|
|
private JButton getStopButton() { |
354 |
|
|
if (stopButton == null) { |
355 |
|
|
stopButton = new JButton(); |
356 |
|
|
stopButton.setText("Stop"); |
357 |
|
|
} |
358 |
|
|
return stopButton; |
359 |
|
|
} |
360 |
|
|
|
361 |
|
|
|
362 |
|
|
|
363 |
|
|
/** |
364 |
|
|
* This method initializes jPanel3 |
365 |
|
|
* |
366 |
|
|
* @return javax.swing.JPanel |
367 |
|
|
*/ |
368 |
|
|
private JPanel getJPanel3() { |
369 |
|
|
if (jPanel3 == null) { |
370 |
|
|
GridBagConstraints gridBagConstraints14 = new GridBagConstraints(); |
371 |
|
|
gridBagConstraints14.gridx = -1; |
372 |
|
|
gridBagConstraints14.gridy = -1; |
373 |
|
|
GridBagConstraints gridBagConstraints13 = new GridBagConstraints(); |
374 |
|
|
gridBagConstraints13.gridx = -1; |
375 |
|
|
gridBagConstraints13.gridy = -1; |
376 |
|
|
GridBagConstraints gridBagConstraints12 = new GridBagConstraints(); |
377 |
|
|
gridBagConstraints12.anchor = GridBagConstraints.WEST; |
378 |
|
|
gridBagConstraints12.gridy = -1; |
379 |
|
|
gridBagConstraints12.gridx = -1; |
380 |
|
|
jPanel3 = new JPanel(); |
381 |
|
|
jPanel3.setLayout(new GridBagLayout()); |
382 |
|
|
jPanel3.add(getStartButton(), gridBagConstraints12); |
383 |
|
|
jPanel3.add(getStepButton(), gridBagConstraints13); |
384 |
|
|
jPanel3.add(getStopButton(), gridBagConstraints14); |
385 |
|
|
} |
386 |
|
|
return jPanel3; |
387 |
|
|
} |
388 |
|
|
|
389 |
|
|
/** |
390 |
|
|
* This method initializes jScrollPane1 |
391 |
|
|
* |
392 |
|
|
* @return javax.swing.JScrollPane |
393 |
|
|
*/ |
394 |
|
|
private JScrollPane getJScrollPane1() { |
395 |
|
|
if (jScrollPane1 == null) { |
396 |
|
|
jScrollPane1 = new JScrollPane(); |
397 |
|
|
jScrollPane1.setViewportView(getSyncCommandList()); |
398 |
|
|
} |
399 |
|
|
return jScrollPane1; |
400 |
|
|
} |
401 |
|
|
|
402 |
|
|
/** |
403 |
|
|
* This method initializes jPanel5 |
404 |
|
|
* |
405 |
|
|
* @return javax.swing.JPanel |
406 |
|
|
*/ |
407 |
|
|
private JPanel getJPanel5() { |
408 |
|
|
if (jPanel5 == null) { |
409 |
|
|
GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); |
410 |
|
|
gridBagConstraints4.anchor = GridBagConstraints.NORTH; |
411 |
|
|
gridBagConstraints4.insets = new Insets(3, 0, 0, 0); |
412 |
|
|
gridBagConstraints4.gridy = 3; |
413 |
|
|
jLabel3 = new JLabel(); |
414 |
|
|
jLabel3.setText("Console"); |
415 |
|
|
GridBagConstraints gridBagConstraints15 = new GridBagConstraints(); |
416 |
|
|
gridBagConstraints15.fill = GridBagConstraints.BOTH; |
417 |
|
|
gridBagConstraints15.weighty = 1.0; |
418 |
|
|
gridBagConstraints15.gridy = 4; |
419 |
|
|
gridBagConstraints15.gridx = 0; |
420 |
|
|
gridBagConstraints15.anchor = GridBagConstraints.SOUTH; |
421 |
|
|
gridBagConstraints15.insets = new Insets(5, 5, 5, 5); |
422 |
|
|
gridBagConstraints15.weightx = 1.0; |
423 |
|
|
jPanel5 = new JPanel(); |
424 |
|
|
jPanel5.setLayout(new GridBagLayout()); |
425 |
|
|
jPanel5.add(jLabel3, gridBagConstraints4); |
426 |
|
|
jPanel5.add(getJScrollPane2(), gridBagConstraints15); |
427 |
|
|
} |
428 |
|
|
return jPanel5; |
429 |
|
|
} |
430 |
|
|
|
431 |
|
|
/** |
432 |
|
|
* This method initializes jScrollPane2 |
433 |
|
|
* |
434 |
|
|
* @return javax.swing.JScrollPane |
435 |
|
|
*/ |
436 |
|
|
private JScrollPane getJScrollPane2() { |
437 |
|
|
if (jScrollPane2 == null) { |
438 |
|
|
jScrollPane2 = new JScrollPane(); |
439 |
|
|
jScrollPane2.setViewportView(getConsole()); |
440 |
|
|
} |
441 |
|
|
return jScrollPane2; |
442 |
|
|
} |
443 |
|
|
|
444 |
|
|
/** |
445 |
|
|
* This method initializes console |
446 |
|
|
* |
447 |
|
|
* @return javax.swing.JTextArea |
448 |
|
|
*/ |
449 |
|
|
private JTextArea getConsole() { |
450 |
|
|
if (console == null) { |
451 |
|
|
console = new JTextArea(); |
452 |
|
|
} |
453 |
|
|
return console; |
454 |
|
|
} |
455 |
|
|
|
456 |
|
|
} // @jve:decl-index=0:visual-constraint="10,10" |