1 package info.mikethomas.fahview.v6project.panels;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 import info.mikethomas.fahview.v6project.utilities.LogReader;
25 import info.mikethomas.fahview.v6project.utilities.ProgressCellRenderer;
26 import javax.swing.JTable;
27
28
29
30
31
32
33
34 public class QueuePanel extends javax.swing.JPanel {
35
36
37
38
39 public QueuePanel() {
40 initComponents();
41
42 table.getColumn("Progress").setCellRenderer(new ProgressCellRenderer());
43 }
44
45
46
47
48
49
50 public JTable getTable() {
51 return table;
52 }
53
54
55
56
57
58
59
60
61 protected void setStatus(int position, int value) {
62 table.getModel().setValueAt(value, position, 1);
63 }
64
65
66
67
68
69
70
71
72 protected void setPercentage(int position, String value) {
73 table.getModel().setValueAt(value, position, 2);
74 }
75
76
77
78
79
80
81
82
83 protected void setProject(int position, String value) {
84 table.getModel().setValueAt(value, position, 3);
85 }
86
87
88
89
90
91
92 protected void setIssued(String issued) {
93 this.issued.setText(issued);
94 }
95
96
97
98
99
100
101 protected void setWorkServer(String workServer) {
102 this.workServer.setText(workServer);
103 }
104
105
106
107
108
109
110 protected void setCollectionServer(String collectionServer) {
111 this.collectionServer.setText(collectionServer);
112 }
113
114
115
116
117
118
119 protected void setUserName(String userName) {
120 this.userName.setText(userName);
121 }
122
123
124
125
126
127
128 protected void setTeamNumber(String teamNumber) {
129 this.teamNumber.setText(teamNumber);
130 }
131
132
133
134
135
136
137 protected void setCore(String core) {
138 this.core.setText(core);
139 }
140
141
142
143
144
145
146 @SuppressWarnings("unchecked")
147
148 private void initComponents() {
149
150 queueWindow = new javax.swing.JScrollPane();
151 table = new javax.swing.JTable();
152 currentWU = new javax.swing.JInternalFrame();
153 issuedLabel = new javax.swing.JLabel();
154 workServerLabel = new javax.swing.JLabel();
155 collectionServerLabel = new javax.swing.JLabel();
156 UserNameLabel = new javax.swing.JLabel();
157 TeamNumberLabel = new javax.swing.JLabel();
158 issued = new javax.swing.JLabel();
159 workServer = new javax.swing.JLabel();
160 collectionServer = new javax.swing.JLabel();
161 userName = new javax.swing.JLabel();
162 teamNumber = new javax.swing.JLabel();
163 coreLabel = new javax.swing.JLabel();
164 core = new javax.swing.JLabel();
165
166 table.setModel(new javax.swing.table.DefaultTableModel(
167 new Object [][] {
168 {"0", null, "0%", null},
169 {"1", null, "0%", null},
170 {"2", null, "0%", null},
171 {"3", null, "0%", null},
172 {"4", null, "0%", null},
173 {"5", null, "0%", null},
174 {"6", null, "0%", null},
175 {"7", null, "0%", null},
176 {"8", null, "0%", null},
177 {"9", null, "0%", null}
178 },
179 new String [] {
180 "Position", "Status", "Progress", "Project"
181 }
182 ) {
183 Class[] types = new Class [] {
184 java.lang.String.class, java.lang.Integer.class, java.lang.String.class, java.lang.String.class
185 };
186 boolean[] canEdit = new boolean [] {
187 true, false, true, false
188 };
189
190 public Class getColumnClass(int columnIndex) {
191 return types [columnIndex];
192 }
193
194 public boolean isCellEditable(int rowIndex, int columnIndex) {
195 return canEdit [columnIndex];
196 }
197 });
198 table.setEnabled(false);
199 queueWindow.setViewportView(table);
200
201 currentWU.setVisible(true);
202
203 issuedLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
204 org.openide.awt.Mnemonics.setLocalizedText(issuedLabel, org.openide.util.NbBundle.getMessage(QueuePanel.class, "QueuePanel.issuedLabel.text"));
205
206 workServerLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
207 org.openide.awt.Mnemonics.setLocalizedText(workServerLabel, org.openide.util.NbBundle.getMessage(QueuePanel.class, "QueuePanel.workServerLabel.text"));
208
209 collectionServerLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
210 org.openide.awt.Mnemonics.setLocalizedText(collectionServerLabel, org.openide.util.NbBundle.getMessage(QueuePanel.class, "QueuePanel.collectionServerLabel.text"));
211
212 UserNameLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
213 org.openide.awt.Mnemonics.setLocalizedText(UserNameLabel, org.openide.util.NbBundle.getMessage(QueuePanel.class, "QueuePanel.UserNameLabel.text"));
214
215 TeamNumberLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
216 org.openide.awt.Mnemonics.setLocalizedText(TeamNumberLabel, org.openide.util.NbBundle.getMessage(QueuePanel.class, "QueuePanel.TeamNumberLabel.text"));
217
218 coreLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
219 org.openide.awt.Mnemonics.setLocalizedText(coreLabel, org.openide.util.NbBundle.getMessage(QueuePanel.class, "QueuePanel.coreLabel.text"));
220
221 org.jdesktop.layout.GroupLayout currentWULayout = new org.jdesktop.layout.GroupLayout(currentWU.getContentPane());
222 currentWU.getContentPane().setLayout(currentWULayout);
223 currentWULayout.setHorizontalGroup(
224 currentWULayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
225 .add(currentWULayout.createSequentialGroup()
226 .addContainerGap()
227 .add(currentWULayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
228 .add(currentWULayout.createSequentialGroup()
229 .add(6, 6, 6)
230 .add(coreLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
231 .add(org.jdesktop.layout.GroupLayout.TRAILING, UserNameLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
232 .add(issuedLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
233 .add(workServerLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
234 .add(collectionServerLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
235 .add(org.jdesktop.layout.GroupLayout.TRAILING, TeamNumberLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
236 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
237 .add(currentWULayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
238 .add(issued, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
239 .add(workServer, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
240 .add(collectionServer, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
241 .add(userName, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
242 .add(teamNumber, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
243 .add(core, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 129, Short.MAX_VALUE))
244 .addContainerGap())
245 );
246 currentWULayout.setVerticalGroup(
247 currentWULayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
248 .add(currentWULayout.createSequentialGroup()
249 .addContainerGap()
250 .add(currentWULayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
251 .add(issuedLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
252 .add(issued, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
253 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
254 .add(currentWULayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
255 .add(workServerLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
256 .add(workServer, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
257 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
258 .add(currentWULayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
259 .add(collectionServerLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
260 .add(collectionServer, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
261 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
262 .add(currentWULayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
263 .add(UserNameLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
264 .add(userName, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
265 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
266 .add(currentWULayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
267 .add(TeamNumberLabel)
268 .add(teamNumber, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 16, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
269 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
270 .add(currentWULayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
271 .add(coreLabel)
272 .add(core, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 16, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
273 .addContainerGap(110, Short.MAX_VALUE))
274 );
275
276 org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
277 this.setLayout(layout);
278 layout.setHorizontalGroup(
279 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
280 .add(layout.createSequentialGroup()
281 .addContainerGap()
282 .add(queueWindow, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 320, Short.MAX_VALUE)
283 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
284 .add(currentWU, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
285 .addContainerGap())
286 );
287 layout.setVerticalGroup(
288 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
289 .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
290 .addContainerGap()
291 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
292 .add(currentWU)
293 .add(queueWindow, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
294 .addContainerGap())
295 );
296 }
297
298 private javax.swing.JLabel TeamNumberLabel;
299 private javax.swing.JLabel UserNameLabel;
300 private javax.swing.JLabel collectionServer;
301 private javax.swing.JLabel collectionServerLabel;
302 private javax.swing.JLabel core;
303 private javax.swing.JLabel coreLabel;
304 private javax.swing.JInternalFrame currentWU;
305 private javax.swing.JLabel issued;
306 private javax.swing.JLabel issuedLabel;
307 private javax.swing.JScrollPane queueWindow;
308 private javax.swing.JTable table;
309 private javax.swing.JLabel teamNumber;
310 private javax.swing.JLabel userName;
311 private javax.swing.JLabel workServer;
312 private javax.swing.JLabel workServerLabel;
313
314 }