@@ -46,6 +46,7 @@ import javax.swing.JTabbedPane
46
46
import javax.swing.JTable
47
47
import javax.swing.RepaintManager
48
48
import javax.swing.SwingConstants
49
+ import javax.swing.Timer
49
50
import javax.swing.UIManager
50
51
import javax.swing.border.EmptyBorder
51
52
import javax.swing.event.HyperlinkEvent
@@ -85,6 +86,8 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
85
86
ToolbarButton clearButton
86
87
JComboBox<ComboBoxItem<String , String > > runComboBox
87
88
JLabel statusLabel
89
+ JLabel elapsedTimeLabel
90
+ Timer elapsedTimeTimer
88
91
JLabel testCounterValueLabel
89
92
JLabel errorCounterValueLabel
90
93
JLabel failureCounterValueLabel
@@ -360,6 +363,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
360
363
resetDerived
361
364
val item = new ComboBoxItem<String , String > (currentRun. reporterId, currentRun. name)
362
365
runComboBox. selectedItem = item
366
+ elapsedTimeTimer. start
363
367
}
364
368
}
365
369
@@ -765,7 +769,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
765
769
toolbar. add(clearButton)
766
770
c. gridx = 0
767
771
c. gridy = 0
768
- c. gridwidth = 1
772
+ c. gridwidth = 2
769
773
c. gridheight = 1
770
774
c. insets = new Insets (0 , 0 , 0 , 0 ) // top, left, bottom, right
771
775
c. anchor = GridBagConstraints :: NORTH
@@ -780,12 +784,42 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
780
784
c. gridy = 1
781
785
c. gridwidth = 1
782
786
c. gridheight = 1
783
- c. insets = new Insets (10 , 10 , 10 , 10 ) // top, left, bottom, right
787
+ c. insets = new Insets (10 , 10 , 10 , 0 ) // top, left, bottom, right
784
788
c. anchor = GridBagConstraints :: WEST
785
789
c. fill = GridBagConstraints :: HORIZONTAL
786
790
c. weightx = 1
787
791
c. weighty = 0
788
792
basePanel. add(statusLabel, c)
793
+ elapsedTimeLabel = new JLabel
794
+ elapsedTimeLabel. preferredSize = new Dimension (60 , 0 )
795
+ c. gridx = 1
796
+ c. gridy = 1
797
+ c. gridwidth = 1
798
+ c. gridheight = 1
799
+ c. insets = new Insets (10 , 10 , 10 , 10 ) // top, left, bottom, right
800
+ c. anchor = GridBagConstraints :: WEST
801
+ c. fill = GridBagConstraints :: NONE
802
+ c. weightx = 0
803
+ c. weighty = 0
804
+ basePanel. add(elapsedTimeLabel, c)
805
+ elapsedTimeTimer = new Timer (100 , new ActionListener () {
806
+ override actionPerformed(ActionEvent e) {
807
+ if (currentRun !== null && currentRun. start !== null ) {
808
+ val time = new SmartTime
809
+ time. smart = useSmartTimes
810
+ if (currentRun. executionTime !== null ) {
811
+ time. seconds = currentRun. executionTime
812
+ elapsedTimeTimer. stop
813
+ } else {
814
+ val long now = System . currentTimeMillis
815
+ time. seconds = new Double (now - currentRun. start) / 1000
816
+ }
817
+ elapsedTimeLabel. text = ' ' ' «time.toString»«IF !useSmartTimes» s«ENDIF»' ' '
818
+ } else {
819
+ elapsedTimeLabel. text = null
820
+ }
821
+ }
822
+ })
789
823
790
824
// Counters
791
825
// - Test counter
@@ -822,7 +856,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
822
856
// - add everything to basePanel
823
857
c. gridx = 0
824
858
c. gridy = 2
825
- c. gridwidth = 1
859
+ c. gridwidth = 2
826
860
c. gridheight = 1
827
861
c. insets = new Insets (5 , 0 , 5 , 0 ) // top, left, bottom, right
828
862
c. anchor = GridBagConstraints :: WEST
@@ -854,7 +888,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
854
888
progressBar. UI = new BasicProgressBarUI
855
889
c. gridx = 0
856
890
c. gridy = 3
857
- c. gridwidth = 1
891
+ c. gridwidth = 2
858
892
c. gridheight = 1
859
893
c. insets = new Insets (10 , 10 , 10 , 10 ) // top, left, bottom, right
860
894
c. anchor = GridBagConstraints :: WEST
@@ -1206,7 +1240,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
1206
1240
horizontalSplitPane. resizeWeight = 0.5
1207
1241
c. gridx = 0
1208
1242
c. gridy = 4
1209
- c. gridwidth = 1
1243
+ c. gridwidth = 2
1210
1244
c. gridheight = 1
1211
1245
c. insets = new Insets (10 , 10 , 10 , 10 ) // top, left, bottom, right
1212
1246
c. anchor = GridBagConstraints :: WEST
0 commit comments