@@ -17,6 +17,7 @@ package org.utplsql.sqldev.ui.runner
17
17
18
18
import java.awt.Color
19
19
import java.awt.Component
20
+ import java.awt.Dimension
20
21
import java.awt.GridBagConstraints
21
22
import java.awt.GridBagLayout
22
23
import java.awt.Insets
@@ -29,6 +30,8 @@ import org.utplsql.sqldev.model.runner.Run
29
30
import org.utplsql.sqldev.resources.UtplsqlResources
30
31
31
32
class RunnerPanel {
33
+ static val GREEN = new Color (0 , 153 , 0 )
34
+ static val RED = new Color (153 , 0 , 0 )
32
35
LimitedLinkedHashMap<String , Run > runs = new LimitedLinkedHashMap<String , Run > (10 )
33
36
JPanel basePanel
34
37
JLabel statusLabel
@@ -44,35 +47,28 @@ class RunnerPanel {
44
47
return basePanel
45
48
}
46
49
47
- def setStatus (String text ) {
48
- statusLabel. text = text
49
- }
50
-
51
50
def setModel (Run run ) {
52
51
runs. put(run. reporterId, run)
53
52
}
54
53
55
- def updateCounter () {
56
- val run = currentRun
54
+ def update (String reporterId ) {
55
+ val run = runs. get(reporterId)
56
+ statusLabel. text = run. status
57
57
testCounterValueLabel. text = ' ' ' «run.totalNumberOfCompletedTests»/«run.totalNumberOfTests»' ' '
58
58
errorCounterValueLabel. text = ' ' ' «run.counter.error»' ' '
59
59
failureCounterValueLabel. text = ' ' ' «run.counter.failure»' ' '
60
60
if (run. totalNumberOfTests == 0 ) {
61
61
progressBar. value = 100
62
62
} else {
63
- progressBar. value = 100 * run. totalNumberOfCompletedTests / run. totalNumberOfTests
63
+ progressBar. value = Math . round( 100 * run. totalNumberOfCompletedTests / run. totalNumberOfTests)
64
64
}
65
65
if (run. counter. error > 0 || run. counter. failure > 0 ) {
66
- progressBar. foreground = Color . RED
66
+ progressBar. foreground = RED
67
67
} else {
68
- progressBar. foreground = Color . GREEN
68
+ progressBar. foreground = GREEN
69
69
}
70
70
}
71
-
72
- private def getCurrentRun () {
73
- return runs. values. get(runs. values. length - 1 )
74
- }
75
-
71
+
76
72
private def initializeGUI () {
77
73
// Base panel containing all components
78
74
basePanel = new JPanel ()
@@ -169,8 +165,11 @@ class RunnerPanel {
169
165
170
166
// Progress bar
171
167
progressBar = new JProgressBar
168
+ val progressBarDim = new Dimension (10 , 20 )
169
+ progressBar. preferredSize = progressBarDim
170
+ progressBar. minimumSize = progressBarDim
172
171
progressBar. stringPainted = false
173
- progressBar. foreground = Color . GREEN
172
+ progressBar. foreground = GREEN
174
173
progressBar. UI = new BasicProgressBarUI
175
174
c. gridx = 0
176
175
c. gridy = 2
0 commit comments