@@ -30,6 +30,7 @@ import java.text.DecimalFormat
30
30
import java.util.ArrayList
31
31
import javax.swing.Box
32
32
import javax.swing.DefaultComboBoxModel
33
+ import javax.swing.JCheckBoxMenuItem
33
34
import javax.swing.JComboBox
34
35
import javax.swing.JComponent
35
36
import javax.swing.JLabel
@@ -38,6 +39,7 @@ import javax.swing.JPanel
38
39
import javax.swing.JPopupMenu
39
40
import javax.swing.JProgressBar
40
41
import javax.swing.JScrollPane
42
+ import javax.swing.JSeparator
41
43
import javax.swing.JSplitPane
42
44
import javax.swing.JTabbedPane
43
45
import javax.swing.JTable
@@ -49,8 +51,10 @@ import javax.swing.event.ListSelectionEvent
49
51
import javax.swing.event.ListSelectionListener
50
52
import javax.swing.plaf.basic.BasicProgressBarUI
51
53
import javax.swing.table.DefaultTableCellRenderer
54
+ import oracle.ide.config.Preferences
52
55
import oracle.javatools.ui.table.ToolbarButton
53
56
import org.utplsql.sqldev.model.LimitedLinkedHashMap
57
+ import org.utplsql.sqldev.model.preference.PreferenceModel
54
58
import org.utplsql.sqldev.model.runner.Run
55
59
import org.utplsql.sqldev.resources.UtplsqlResources
56
60
import org.utplsql.sqldev.runner.UtplsqlRunner
@@ -59,6 +63,7 @@ import org.utplsql.sqldev.runner.UtplsqlWorksheetRunner
59
63
class RunnerPanel implements FocusListener , ActionListener {
60
64
static val GREEN = new Color (0 , 153 , 0 )
61
65
static val RED = new Color (153 , 0 , 0 )
66
+ static val INDICATOR_WIDTH = 20
62
67
LimitedLinkedHashMap<String , Run > runs = new LimitedLinkedHashMap<String , Run > (10 )
63
68
Run currentRun
64
69
JPanel basePanel
@@ -75,11 +80,16 @@ class RunnerPanel implements FocusListener, ActionListener {
75
80
JLabel disabledCounterValueLabel
76
81
JLabel warningsCounterValueLabel
77
82
JLabel infoCounterValueLabel
83
+ JCheckBoxMenuItem showDisabledCounterCheckBoxMenuItem
84
+ JCheckBoxMenuItem showWarningsCounterCheckBoxMenuItem
85
+ JCheckBoxMenuItem showInfoCounterCheckBoxMenuItem
78
86
JProgressBar progressBar;
79
87
TestOverviewTableModel testOverviewTableModel
80
88
JTable testOverviewTable
81
89
JMenuItem testOverviewRunMenuItem
82
90
JMenuItem testOverviewRunWorksheetMenuItem
91
+ JCheckBoxMenuItem showWarningIndicatorCheckBoxMenuItem
92
+ JCheckBoxMenuItem showInfoIndicatorCheckBoxMenuItem
83
93
JTextArea testIdTextArea
84
94
JTextField testOwnerTextField
85
95
JTextField testPackageTextField
@@ -134,6 +144,72 @@ class RunnerPanel implements FocusListener, ActionListener {
134
144
runComboBox. addActionListener(this )
135
145
}
136
146
}
147
+
148
+ private def applyShowDisabledCounter (boolean show ) {
149
+ disabledCounterValueLabel. parent. visible = showDisabledCounterCheckBoxMenuItem. selected
150
+ }
151
+
152
+ private def applyShowWarningsCounter (boolean show ) {
153
+ warningsCounterValueLabel. parent. visible = showWarningsCounterCheckBoxMenuItem. selected
154
+ }
155
+
156
+ private def applyShowInfoCounter (boolean show ) {
157
+ infoCounterValueLabel. parent. visible = showInfoCounterCheckBoxMenuItem. selected
158
+ }
159
+
160
+ private def applyShowWarningIndicator (boolean show ) {
161
+ val col = testOverviewTable. columnModel. getColumn(1 )
162
+ if (show) {
163
+ col. width = INDICATOR_WIDTH
164
+ col. minWidth = INDICATOR_WIDTH
165
+ col. maxWidth = INDICATOR_WIDTH
166
+ col. preferredWidth = INDICATOR_WIDTH
167
+ } else {
168
+ col. width = 0
169
+ col. minWidth = 0
170
+ col. maxWidth = 0
171
+ col. preferredWidth = 0
172
+ }
173
+ }
174
+
175
+ private def applyShowInfoIndicator (boolean show ) {
176
+ val col = testOverviewTable. columnModel. getColumn(2 )
177
+ if (show) {
178
+ col. width = INDICATOR_WIDTH
179
+ col. minWidth = INDICATOR_WIDTH
180
+ col. maxWidth = INDICATOR_WIDTH
181
+ col. preferredWidth = INDICATOR_WIDTH
182
+ } else {
183
+ col. width = 0
184
+ col. minWidth = 0
185
+ col. maxWidth = 0
186
+ col. preferredWidth = 0
187
+ }
188
+ }
189
+
190
+ private def getPreferenceModel () {
191
+ var PreferenceModel preferences
192
+ try {
193
+ preferences = PreferenceModel . getInstance(Preferences . preferences)
194
+ } catch (NoClassDefFoundError e) {
195
+ preferences = PreferenceModel . getInstance(null )
196
+ }
197
+ return preferences
198
+ }
199
+
200
+ private def applyPreferences () {
201
+ val PreferenceModel preferences = preferenceModel
202
+ showDisabledCounterCheckBoxMenuItem. selected = preferences. showDisabledCounter
203
+ applyShowDisabledCounter(showDisabledCounterCheckBoxMenuItem. selected)
204
+ showWarningsCounterCheckBoxMenuItem. selected = preferences. showWarningsCounter
205
+ applyShowWarningsCounter(showWarningsCounterCheckBoxMenuItem. selected)
206
+ showInfoCounterCheckBoxMenuItem. selected = preferences. showInfoCounter
207
+ applyShowInfoCounter(showInfoCounterCheckBoxMenuItem. selected)
208
+ showWarningIndicatorCheckBoxMenuItem. selected = preferences. showWarningIndicator
209
+ applyShowWarningIndicator(showWarningIndicatorCheckBoxMenuItem. selected)
210
+ showInfoIndicatorCheckBoxMenuItem. selected = preferences. showInfoIndicator
211
+ applyShowInfoIndicator(showInfoIndicatorCheckBoxMenuItem. selected)
212
+ }
137
213
138
214
def setModel (Run run ) {
139
215
runs. put(run. reporterId, run)
@@ -261,6 +337,16 @@ class RunnerPanel implements FocusListener, ActionListener {
261
337
} else if (e. source == testOverviewRunWorksheetMenuItem) {
262
338
val worksheet = new UtplsqlWorksheetRunner (pathListFromSelectedTests, currentRun. connectionName)
263
339
worksheet. runTestAsync
340
+ } else if (e. source == showDisabledCounterCheckBoxMenuItem) {
341
+ applyShowDisabledCounter(showDisabledCounterCheckBoxMenuItem. selected)
342
+ } else if (e. source == showWarningsCounterCheckBoxMenuItem) {
343
+ applyShowWarningsCounter( showWarningsCounterCheckBoxMenuItem. selected)
344
+ } else if (e. source == showInfoCounterCheckBoxMenuItem) {
345
+ applyShowInfoCounter(showInfoCounterCheckBoxMenuItem. selected)
346
+ } else if (e. source == showWarningIndicatorCheckBoxMenuItem) {
347
+ applyShowWarningIndicator(showWarningIndicatorCheckBoxMenuItem. selected)
348
+ } else if (e. source == showInfoIndicatorCheckBoxMenuItem) {
349
+ applyShowInfoIndicator(showInfoIndicatorCheckBoxMenuItem. selected)
264
350
}
265
351
}
266
352
@@ -523,6 +609,22 @@ class RunnerPanel implements FocusListener, ActionListener {
523
609
c. weightx = 1
524
610
c. weighty = 0
525
611
basePanel. add(counterPanel,c)
612
+
613
+ // Context menu for counters panel
614
+ val countersPopupMenu = new JPopupMenu
615
+ showDisabledCounterCheckBoxMenuItem = new JCheckBoxMenuItem (UtplsqlResources . getString(" PREF_SHOW_DISABLED_COUNTER_LABEL" ). replace(" ?" ," " ))
616
+ showDisabledCounterCheckBoxMenuItem. selected = true
617
+ showDisabledCounterCheckBoxMenuItem. addActionListener(this )
618
+ countersPopupMenu. add(showDisabledCounterCheckBoxMenuItem)
619
+ showWarningsCounterCheckBoxMenuItem = new JCheckBoxMenuItem (UtplsqlResources . getString(" PREF_SHOW_WARNINGS_COUNTER_LABEL" ). replace(" ?" ," " ))
620
+ showWarningsCounterCheckBoxMenuItem. selected = true
621
+ showWarningsCounterCheckBoxMenuItem. addActionListener(this )
622
+ countersPopupMenu. add(showWarningsCounterCheckBoxMenuItem)
623
+ showInfoCounterCheckBoxMenuItem = new JCheckBoxMenuItem (UtplsqlResources . getString(" PREF_SHOW_INFO_COUNTER_LABEL" ). replace(" ?" ," " ))
624
+ showInfoCounterCheckBoxMenuItem. selected = true
625
+ showInfoCounterCheckBoxMenuItem. addActionListener(this )
626
+ countersPopupMenu. add(showInfoCounterCheckBoxMenuItem)
627
+ counterPanel. componentPopupMenu = countersPopupMenu
526
628
527
629
// Progress bar
528
630
progressBar = new JProgressBar
@@ -551,19 +653,19 @@ class RunnerPanel implements FocusListener, ActionListener {
551
653
testOverviewTable. selectionModel. addListSelectionListener(new TestOverviewRowListener (this ))
552
654
val testTableHeaderRenderer = new TestTableHeaderRenderer
553
655
val overviewTableStatus = testOverviewTable. columnModel. getColumn(0 )
554
- overviewTableStatus. minWidth = 20
555
- overviewTableStatus. preferredWidth = 20
556
- overviewTableStatus. maxWidth = 20
656
+ overviewTableStatus. minWidth = INDICATOR_WIDTH
657
+ overviewTableStatus. preferredWidth = INDICATOR_WIDTH
658
+ overviewTableStatus. maxWidth = INDICATOR_WIDTH
557
659
overviewTableStatus. headerRenderer = testTableHeaderRenderer
558
660
val overviewTableWarning = testOverviewTable. columnModel. getColumn(1 )
559
- overviewTableWarning. minWidth = 20
560
- overviewTableWarning. preferredWidth = 20
561
- overviewTableWarning. maxWidth = 20
661
+ overviewTableWarning. minWidth = INDICATOR_WIDTH
662
+ overviewTableWarning. preferredWidth = INDICATOR_WIDTH
663
+ overviewTableWarning. maxWidth = INDICATOR_WIDTH
562
664
overviewTableWarning. headerRenderer = testTableHeaderRenderer
563
665
val overviewTableInfo = testOverviewTable. columnModel. getColumn(2 )
564
- overviewTableInfo. minWidth = 20
565
- overviewTableInfo. preferredWidth = 20
566
- overviewTableInfo. maxWidth = 20
666
+ overviewTableInfo. minWidth = INDICATOR_WIDTH
667
+ overviewTableInfo. preferredWidth = INDICATOR_WIDTH
668
+ overviewTableInfo. maxWidth = INDICATOR_WIDTH
567
669
overviewTableInfo. headerRenderer = testTableHeaderRenderer
568
670
val overviewTableId = testOverviewTable. columnModel. getColumn(3 )
569
671
overviewTableId. headerRenderer = testTableHeaderRenderer
@@ -584,8 +686,17 @@ class RunnerPanel implements FocusListener, ActionListener {
584
686
testOverviewRunWorksheetMenuItem = new JMenuItem (" Run test in new worksheet" , UtplsqlResources . getIcon(" RUN_WORKSHEET_ICON" ));
585
687
testOverviewRunWorksheetMenuItem. addActionListener(this )
586
688
testOverviewPopupMenu. add(testOverviewRunWorksheetMenuItem)
689
+ testOverviewPopupMenu. add(new JSeparator )
690
+ showWarningIndicatorCheckBoxMenuItem = new JCheckBoxMenuItem (UtplsqlResources . getString(" PREF_SHOW_WARNING_INDICATOR_LABEL" ). replace(" ?" ," " ))
691
+ showWarningIndicatorCheckBoxMenuItem. selected = true
692
+ showWarningIndicatorCheckBoxMenuItem. addActionListener(this )
693
+ testOverviewPopupMenu. add(showWarningIndicatorCheckBoxMenuItem)
694
+ showInfoIndicatorCheckBoxMenuItem = new JCheckBoxMenuItem (UtplsqlResources . getString(" PREF_SHOW_INFO_INDICATOR_LABEL" ). replace(" ?" ," " ))
695
+ showInfoIndicatorCheckBoxMenuItem. selected = true
696
+ showInfoIndicatorCheckBoxMenuItem. addActionListener(this )
697
+ testOverviewPopupMenu. add(showInfoIndicatorCheckBoxMenuItem)
587
698
testOverviewTable. componentPopupMenu = testOverviewPopupMenu
588
-
699
+
589
700
// Test tabbed pane (Test Properties)
590
701
// - Id
591
702
val testInfoPanel = new ScrollablePanel
@@ -897,5 +1008,6 @@ class RunnerPanel implements FocusListener, ActionListener {
897
1008
c. weightx = 1
898
1009
c. weighty = 1
899
1010
basePanel. add(horizontalSplitPane, c)
1011
+ applyPreferences
900
1012
}
901
1013
}
0 commit comments