1 |
mojays |
2 |
package appl.parallel.gui; |
2 |
|
|
|
3 |
|
|
import javax.swing.JPanel; |
4 |
|
|
import java.awt.GridBagLayout; |
5 |
|
|
import java.awt.Dimension; |
6 |
|
|
import java.awt.GridBagConstraints; |
7 |
|
|
|
8 |
|
|
import javax.swing.JButton; |
9 |
|
|
import javax.swing.JLabel; |
10 |
|
|
import javax.swing.BoxLayout; |
11 |
|
|
import javax.swing.ListSelectionModel; |
12 |
|
|
import java.awt.Insets; |
13 |
|
|
import javax.swing.border.SoftBevelBorder; |
14 |
|
|
import javax.swing.table.DefaultTableModel; |
15 |
|
|
import edu.bonn.xulu.XuluModellingPlatform; |
16 |
|
|
import javax.swing.JScrollPane; |
17 |
|
|
import javax.swing.JTable; |
18 |
|
|
|
19 |
|
|
import java.awt.Rectangle; |
20 |
|
|
|
21 |
|
|
/** |
22 |
|
|
* The GUI for the ParallelControlPanel . All the interesting |
23 |
|
|
* stuff happens in the {@link ParallelControlPanelEngine}. |
24 |
|
|
* This GUI was created with the Visual Editor plugin for eclipse. |
25 |
|
|
* Editing with another VE may be a bad idea. |
26 |
|
|
* |
27 |
|
|
* @author Dominik Appl |
28 |
|
|
*/ |
29 |
|
|
public class ParallelControlPanel extends JPanel { |
30 |
|
|
|
31 |
|
|
static final long serialVersionUID = 1L; |
32 |
|
|
|
33 |
|
|
JPanel executionPanel = null; |
34 |
|
|
|
35 |
|
|
JLabel Steps = null; |
36 |
|
|
|
37 |
|
|
JTable computingResourcesList = null; |
38 |
|
|
|
39 |
|
|
JScrollPane jScrollPane1 = null; |
40 |
|
|
|
41 |
|
|
JPanel jPanel = null; |
42 |
|
|
|
43 |
|
|
JScrollPane jScrollPane = null; |
44 |
|
|
|
45 |
|
|
SimplePropertyTable propertyTable = null; |
46 |
|
|
|
47 |
|
|
JButton refreshButton = null; |
48 |
|
|
|
49 |
|
|
JButton selectAllButton = null; |
50 |
|
|
|
51 |
|
|
JPanel buttonPanel = null; |
52 |
|
|
|
53 |
|
|
/** |
54 |
|
|
* This is the default constructor. It should be only used be the eclipse VE |
55 |
|
|
*/ |
56 |
|
|
public ParallelControlPanel() { |
57 |
|
|
super(); |
58 |
|
|
initialize(); |
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
/** |
62 |
|
|
* This method initializes this |
63 |
|
|
* |
64 |
|
|
* @return void |
65 |
|
|
*/ |
66 |
|
|
private void initialize() { |
67 |
|
|
this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); |
68 |
|
|
this.setSize(578, 268); |
69 |
|
|
this.add(getExecutionPanel(), null); |
70 |
|
|
this.add(getJPanel(), null); |
71 |
|
|
} |
72 |
|
|
|
73 |
|
|
/** |
74 |
|
|
* This method initializes executionPanel |
75 |
|
|
* |
76 |
|
|
* @return javax.swing.JPanel |
77 |
|
|
*/ |
78 |
|
|
private JPanel getExecutionPanel() { |
79 |
|
|
if (executionPanel == null) { |
80 |
|
|
GridBagConstraints gridBagConstraints12 = new GridBagConstraints(); |
81 |
|
|
gridBagConstraints12.gridx = 1; |
82 |
|
|
gridBagConstraints12.gridy = 2; |
83 |
|
|
GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); |
84 |
|
|
gridBagConstraints11.fill = GridBagConstraints.BOTH; |
85 |
|
|
gridBagConstraints11.weighty = 1.0; |
86 |
|
|
gridBagConstraints11.gridx = 0; |
87 |
|
|
gridBagConstraints11.gridy = 1; |
88 |
|
|
gridBagConstraints11.ipadx = 0; |
89 |
|
|
gridBagConstraints11.insets = new Insets(5, 5, 5, 5); |
90 |
|
|
gridBagConstraints11.gridwidth = 2; |
91 |
|
|
gridBagConstraints11.weightx = 1.0; |
92 |
|
|
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
93 |
|
|
gridBagConstraints.insets = new Insets(0, 0, 0, 0); |
94 |
|
|
gridBagConstraints.gridy = 0; |
95 |
|
|
gridBagConstraints.anchor = GridBagConstraints.NORTH; |
96 |
|
|
gridBagConstraints.gridheight = 1; |
97 |
|
|
gridBagConstraints.gridwidth = 2; |
98 |
|
|
gridBagConstraints.gridx = 0; |
99 |
|
|
Steps = new JLabel(); |
100 |
|
|
Steps.setText("Computing resources:"); |
101 |
|
|
Steps.setName("Steps"); |
102 |
|
|
executionPanel = new JPanel(); |
103 |
|
|
executionPanel.setLayout(new GridBagLayout()); |
104 |
|
|
executionPanel.setBorder(new SoftBevelBorder( |
105 |
|
|
SoftBevelBorder.LOWERED)); |
106 |
|
|
executionPanel.setVisible(true); |
107 |
|
|
executionPanel.add(Steps, gridBagConstraints); |
108 |
|
|
executionPanel.add(getJScrollPane1(), gridBagConstraints11); |
109 |
|
|
executionPanel.add(getButtonPanel(), gridBagConstraints12); |
110 |
|
|
} |
111 |
|
|
return executionPanel; |
112 |
|
|
} |
113 |
|
|
|
114 |
|
|
/** |
115 |
|
|
* This method initializes computingResourcesList |
116 |
|
|
* |
117 |
|
|
* @return javax.swing.JList |
118 |
|
|
*/ |
119 |
|
|
private JTable getComputingResourcesList() { |
120 |
|
|
if (computingResourcesList == null) { |
121 |
|
|
computingResourcesList = new JTable(); |
122 |
|
|
computingResourcesList.setShowHorizontalLines(false); |
123 |
|
|
computingResourcesList |
124 |
|
|
.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); |
125 |
|
|
} |
126 |
|
|
return computingResourcesList; |
127 |
|
|
} |
128 |
|
|
|
129 |
|
|
/** |
130 |
|
|
* This method initializes jScrollPane1 |
131 |
|
|
* |
132 |
|
|
* @return javax.swing.JScrollPane |
133 |
|
|
*/ |
134 |
|
|
private JScrollPane getJScrollPane1() { |
135 |
|
|
if (jScrollPane1 == null) { |
136 |
|
|
jScrollPane1 = new JScrollPane(); |
137 |
|
|
jScrollPane1.setName("jScrollPane1"); |
138 |
|
|
jScrollPane1.setViewportView(getComputingResourcesList()); |
139 |
|
|
jScrollPane1.setPreferredSize(new Dimension(200, 250)); |
140 |
|
|
} |
141 |
|
|
return jScrollPane1; |
142 |
|
|
} |
143 |
|
|
|
144 |
|
|
/** |
145 |
|
|
* This method initializes jPanel |
146 |
|
|
* |
147 |
|
|
* @return javax.swing.JPanel |
148 |
|
|
*/ |
149 |
|
|
private JPanel getJPanel() { |
150 |
|
|
if (jPanel == null) { |
151 |
|
|
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
152 |
|
|
gridBagConstraints1.fill = GridBagConstraints.BOTH; |
153 |
|
|
gridBagConstraints1.gridy = 0; |
154 |
|
|
gridBagConstraints1.weightx = 1.0; |
155 |
|
|
gridBagConstraints1.weighty = 1.0; |
156 |
|
|
gridBagConstraints1.gridx = 0; |
157 |
|
|
jPanel = new JPanel(); |
158 |
|
|
jPanel.setLayout(new GridBagLayout()); |
159 |
|
|
jPanel.add(getJScrollPane(), gridBagConstraints1); |
160 |
|
|
} |
161 |
|
|
return jPanel; |
162 |
|
|
} |
163 |
|
|
|
164 |
|
|
/** |
165 |
|
|
* This method initializes jScrollPane |
166 |
|
|
* |
167 |
|
|
* @return javax.swing.JScrollPane |
168 |
|
|
*/ |
169 |
|
|
private JScrollPane getJScrollPane() { |
170 |
|
|
if (jScrollPane == null) { |
171 |
|
|
jScrollPane = new JScrollPane(); |
172 |
|
|
jScrollPane.setViewportView(getPropertyTable()); |
173 |
|
|
} |
174 |
|
|
return jScrollPane; |
175 |
|
|
} |
176 |
|
|
|
177 |
|
|
/** |
178 |
|
|
* This method initializes propertyTable |
179 |
|
|
* |
180 |
|
|
* @return javax.swing.JTable |
181 |
|
|
*/ |
182 |
|
|
private JTable getPropertyTable() { |
183 |
|
|
if (propertyTable == null) { |
184 |
|
|
propertyTable = new SimplePropertyTable(); |
185 |
|
|
} |
186 |
|
|
return propertyTable; |
187 |
|
|
} |
188 |
|
|
|
189 |
|
|
/** |
190 |
|
|
* This method initializes refreshButton |
191 |
|
|
* |
192 |
|
|
* @return javax.swing.JButton |
193 |
|
|
*/ |
194 |
|
|
private JButton getRefreshButton() { |
195 |
|
|
if (refreshButton == null) { |
196 |
|
|
refreshButton = new JButton(); |
197 |
|
|
refreshButton.setName("refreshButton"); |
198 |
|
|
refreshButton.setText("Refresh"); |
199 |
|
|
} |
200 |
|
|
return refreshButton; |
201 |
|
|
} |
202 |
|
|
|
203 |
|
|
/** |
204 |
|
|
* This method initializes selectAllButton |
205 |
|
|
* |
206 |
|
|
* @return javax.swing.JButton |
207 |
|
|
*/ |
208 |
|
|
private JButton getSelectAllButton() { |
209 |
|
|
if (selectAllButton == null) { |
210 |
|
|
selectAllButton = new JButton(); |
211 |
|
|
selectAllButton.setText("Select available"); |
212 |
|
|
} |
213 |
|
|
return selectAllButton; |
214 |
|
|
} |
215 |
|
|
|
216 |
|
|
/** |
217 |
|
|
* This method initializes buttonPanel |
218 |
|
|
* |
219 |
|
|
* @return javax.swing.JPanel |
220 |
|
|
*/ |
221 |
|
|
protected JPanel getButtonPanel() { |
222 |
|
|
if (buttonPanel == null) { |
223 |
|
|
GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); |
224 |
|
|
gridBagConstraints3.anchor = GridBagConstraints.SOUTHEAST; |
225 |
|
|
gridBagConstraints3.gridy = -1; |
226 |
|
|
gridBagConstraints3.gridx = -1; |
227 |
|
|
GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
228 |
|
|
gridBagConstraints2.anchor = GridBagConstraints.CENTER; |
229 |
|
|
gridBagConstraints2.insets = new Insets(0, 0, 0, 0); |
230 |
|
|
gridBagConstraints2.gridheight = 1; |
231 |
|
|
gridBagConstraints2.gridwidth = 1; |
232 |
|
|
gridBagConstraints2.gridx = -1; |
233 |
|
|
gridBagConstraints2.gridy = -1; |
234 |
|
|
gridBagConstraints2.ipadx = 0; |
235 |
|
|
gridBagConstraints2.ipady = 0; |
236 |
|
|
gridBagConstraints2.weightx = 0.5; |
237 |
|
|
gridBagConstraints2.fill = GridBagConstraints.HORIZONTAL; |
238 |
|
|
buttonPanel = new JPanel(); |
239 |
|
|
buttonPanel.setLayout(new GridBagLayout()); |
240 |
|
|
buttonPanel.add(getRefreshButton(), gridBagConstraints2); |
241 |
|
|
buttonPanel.add(getSelectAllButton(), gridBagConstraints3); |
242 |
|
|
} |
243 |
|
|
return buttonPanel; |
244 |
|
|
} |
245 |
|
|
|
246 |
|
|
} // @jve:decl-index=0:visual-constraint="10,10" |