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