|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| package jtr.ui.swing; |
|
12 |
| |
|
13 |
| import javax.swing.JProgressBar; |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
| |
|
22 |
| |
|
23 |
| public class TestRunningFrame extends javax.swing.JFrame { |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
1
| public TestRunningFrame(int lMin, int lMax, int gMin, int gMax, int rMin, int rMax) {
|
|
32 |
1
| localMin = lMin;
|
|
33 |
1
| localMax = lMax;
|
|
34 |
1
| globalMin = gMin;
|
|
35 |
1
| globalMax = gMax;
|
|
36 |
1
| localRunsMin = rMin;
|
|
37 |
1
| curLocalRuns = 0;
|
|
38 |
1
| localRunsMax = rMax;
|
|
39 |
1
| initComponents();
|
|
40 |
1
| this.setIconImage(IconImageProvider.getIcon());
|
|
41 |
| } |
|
42 |
| |
|
43 |
| |
|
44 |
| |
|
45 |
| |
|
46 |
| |
|
47 |
| |
|
48 |
| |
|
49 |
1
| private void initComponents() {
|
|
50 |
1
| localEpochsProgressBar = new JProgressBar(localMin,localMax);
|
|
51 |
1
| usrMsgLabel = new javax.swing.JLabel();
|
|
52 |
1
| localEpochsLabel = new javax.swing.JLabel();
|
|
53 |
1
| globalTestsLabel = new javax.swing.JLabel();
|
|
54 |
1
| globalTestsProgressBar = new JProgressBar(globalMin,globalMax);
|
|
55 |
1
| runsCounterLabel = new javax.swing.JLabel();
|
|
56 |
1
| runsCounter = new javax.swing.JLabel();
|
|
57 |
1
| this.updateLocalRuns();
|
|
58 |
| |
|
59 |
1
| setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
|
|
60 |
1
| setTitle("JTR 4.0 Test Running...");
|
|
61 |
1
| setName("testRunningFrame");
|
|
62 |
1
| setResizable(false);
|
|
63 |
1
| localEpochsProgressBar.setToolTipText("Percentage of only locally started epochs");
|
|
64 |
1
| localEpochsProgressBar.setAlignmentX(0.2F);
|
|
65 |
1
| localEpochsProgressBar.setAlignmentY(0.2F);
|
|
66 |
1
| localEpochsProgressBar.setStringPainted(true);
|
|
67 |
| |
|
68 |
1
| usrMsgLabel.setFont(new java.awt.Font("Lucida Grande", 0, 10));
|
|
69 |
1
| usrMsgLabel.setText("Please, wait for tests accomplishment...");
|
|
70 |
| |
|
71 |
1
| localEpochsLabel.setFont(new java.awt.Font("Lucida Grande", 0, 11));
|
|
72 |
1
| localEpochsLabel.setText("Local epochs");
|
|
73 |
| |
|
74 |
1
| globalTestsLabel.setFont(new java.awt.Font("Lucida Grande", 0, 11));
|
|
75 |
1
| globalTestsLabel.setText("Global tests");
|
|
76 |
| |
|
77 |
1
| globalTestsProgressBar.setToolTipText("Percentage of global tests accomplishment");
|
|
78 |
1
| globalTestsProgressBar.setStringPainted(true);
|
|
79 |
| |
|
80 |
1
| runsCounterLabel.setFont(new java.awt.Font("Lucida Grande", 0, 11));
|
|
81 |
1
| runsCounterLabel.setLabelFor(runsCounter);
|
|
82 |
1
| runsCounterLabel.setText("Local Runs");
|
|
83 |
1
| runsCounterLabel.setToolTipText("Local Runs accomplishment indicator");
|
|
84 |
1
| runsCounterLabel.setFocusable(false);
|
|
85 |
| |
|
86 |
1
| runsCounter.setFont(new java.awt.Font("Lucida Grande", 0, 11));
|
|
87 |
1
| runsCounter.setToolTipText("Locally-accomplished runs / required runs per epoch accomplishment");
|
|
88 |
1
| runsCounter.setFocusable(false);
|
|
89 |
| |
|
90 |
1
| org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
|
|
91 |
1
| getContentPane().setLayout(layout);
|
|
92 |
1
| layout.setHorizontalGroup(
|
|
93 |
| layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
|
94 |
| .add(layout.createSequentialGroup() |
|
95 |
| .addContainerGap() |
|
96 |
| .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
|
97 |
| .add(runsCounterLabel) |
|
98 |
| .add(layout.createSequentialGroup() |
|
99 |
| .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
|
100 |
| .add(layout.createSequentialGroup() |
|
101 |
| .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
|
102 |
| .add(localEpochsLabel) |
|
103 |
| .add(globalTestsLabel)) |
|
104 |
| .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
|
105 |
| .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) |
|
106 |
| .add(org.jdesktop.layout.GroupLayout.LEADING, localEpochsProgressBar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|
107 |
| .add(org.jdesktop.layout.GroupLayout.LEADING, globalTestsProgressBar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|
108 |
| .add(org.jdesktop.layout.GroupLayout.LEADING, runsCounter, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) |
|
109 |
| .add(usrMsgLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 221, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
|
110 |
| .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) |
|
111 |
| ); |
|
112 |
1
| layout.setVerticalGroup(
|
|
113 |
| layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
|
114 |
| .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() |
|
115 |
| .addContainerGap() |
|
116 |
| .add(usrMsgLabel) |
|
117 |
| .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|
118 |
| .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
|
119 |
| .add(runsCounterLabel) |
|
120 |
| .add(runsCounter, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 14, Short.MAX_VALUE)) |
|
121 |
| .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
|
122 |
| .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
|
123 |
| .add(localEpochsProgressBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
|
124 |
| .add(localEpochsLabel)) |
|
125 |
| .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
|
126 |
| .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
|
127 |
| .add(globalTestsLabel) |
|
128 |
| .add(globalTestsProgressBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
|
129 |
| .addContainerGap()) |
|
130 |
| ); |
|
131 |
1
| pack();
|
|
132 |
| } |
|
133 |
| |
|
134 |
50
| public void updateLocalEpochs(int progress) {
|
|
135 |
50
| synchronized(localEpochsProgressBar) {
|
|
136 |
50
| localEpochsProgressBar.setValue(progress);
|
|
137 |
| } |
|
138 |
| } |
|
139 |
| |
|
140 |
2
| public void updateGlobalTests(int progress) {
|
|
141 |
2
| synchronized(globalTestsProgressBar) {
|
|
142 |
2
| globalTestsProgressBar.setValue(progress);
|
|
143 |
| } |
|
144 |
| } |
|
145 |
| |
|
146 |
22176
| public void updateLocalRuns() {
|
|
147 |
22177
| synchronized(runsCounter) {
|
|
148 |
22201
| runsCounter.setText(curLocalRuns+"/"+localRunsMax);
|
|
149 |
22201
| if(++curLocalRuns==localRunsMax+1)
|
|
150 |
50
| curLocalRuns=1;
|
|
151 |
| } |
|
152 |
| } |
|
153 |
| |
|
154 |
| |
|
155 |
| private javax.swing.JLabel globalTestsLabel; |
|
156 |
| private javax.swing.JProgressBar globalTestsProgressBar; |
|
157 |
| private javax.swing.JLabel localEpochsLabel; |
|
158 |
| private javax.swing.JProgressBar localEpochsProgressBar; |
|
159 |
| private javax.swing.JLabel runsCounter; |
|
160 |
| private javax.swing.JLabel runsCounterLabel; |
|
161 |
| private javax.swing.JLabel usrMsgLabel; |
|
162 |
| |
|
163 |
| |
|
164 |
| private Integer localMin, localMax, globalMin, globalMax, localRunsMin, localRunsMax, curLocalRuns; |
|
165 |
| } |