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