Skip to content

Commit 9fcda69

Browse files
rename test id to suitepath, remove end date/time, reorder items, fix
missing checkmark on Windows with windows look and feel
1 parent b6f47bf commit 9fcda69

File tree

1 file changed

+73
-69
lines changed

1 file changed

+73
-69
lines changed

sqldev/src/main/java/org/utplsql/sqldev/ui/runner/RunnerPanel.xtend

Lines changed: 73 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import javax.swing.JTable
4646
import javax.swing.JTextArea
4747
import javax.swing.JTextField
4848
import javax.swing.SwingConstants
49+
import javax.swing.UIManager
4950
import javax.swing.border.EmptyBorder
5051
import javax.swing.event.ListSelectionEvent
5152
import javax.swing.event.ListSelectionListener
@@ -60,7 +61,6 @@ import org.utplsql.sqldev.resources.UtplsqlResources
6061
import org.utplsql.sqldev.runner.UtplsqlRunner
6162
import org.utplsql.sqldev.runner.UtplsqlWorksheetRunner
6263

63-
// TODO: fix missing checkmark on Windows with windows look and feel (just a blue box is shown instead of checkmark)
6464
class RunnerPanel implements FocusListener, ActionListener {
6565
static val GREEN = new Color(0, 153, 0)
6666
static val RED = new Color(153, 0, 0)
@@ -92,13 +92,12 @@ class RunnerPanel implements FocusListener, ActionListener {
9292
JCheckBoxMenuItem showWarningIndicatorCheckBoxMenuItem
9393
JCheckBoxMenuItem showInfoIndicatorCheckBoxMenuItem
9494
JCheckBoxMenuItem syncDetailTabCheckBoxMenuItem
95-
JTextArea testIdTextArea
9695
JTextField testOwnerTextField
9796
JTextField testPackageTextField
9897
JTextField testProcedureTextField
9998
JTextArea testDescriptionTextArea
99+
JTextArea suitePathTextArea
100100
JTextField testStartTextField
101-
JTextField testEndTextField
102101
FailuresTableModel failuresTableModel
103102
JTable failuresTable
104103
JTextArea testFailureMessageTextArea
@@ -121,13 +120,12 @@ class RunnerPanel implements FocusListener, ActionListener {
121120
testOverviewTable.rowSorter.sortKeys = null
122121
testOverviewRunMenuItem.enabled = false
123122
testOverviewRunWorksheetMenuItem.enabled = false
124-
testIdTextArea.text = null
123+
suitePathTextArea.text = null
125124
testOwnerTextField.text = null
126125
testPackageTextField.text = null
127126
testProcedureTextField.text = null
128127
testDescriptionTextArea.text = null
129128
testStartTextField.text = null
130-
testEndTextField.text = null
131129
failuresTableModel.model = null
132130
failuresTableModel.fireTableDataChanged
133131
testFailureMessageTextArea.text = null
@@ -229,15 +227,21 @@ class RunnerPanel implements FocusListener, ActionListener {
229227
val PreferenceModel preferences = preferenceModel
230228
showDisabledCounterCheckBoxMenuItem.selected = preferences.showDisabledCounter
231229
applyShowDisabledCounter(showDisabledCounterCheckBoxMenuItem.selected)
230+
fixCheckBoxMenuItem(showDisabledCounterCheckBoxMenuItem)
232231
showWarningsCounterCheckBoxMenuItem.selected = preferences.showWarningsCounter
233232
applyShowWarningsCounter(showWarningsCounterCheckBoxMenuItem.selected)
233+
fixCheckBoxMenuItem(showWarningsCounterCheckBoxMenuItem)
234234
showInfoCounterCheckBoxMenuItem.selected = preferences.showInfoCounter
235235
applyShowInfoCounter(showInfoCounterCheckBoxMenuItem.selected)
236+
fixCheckBoxMenuItem(showInfoCounterCheckBoxMenuItem)
236237
showWarningIndicatorCheckBoxMenuItem.selected = preferences.showWarningIndicator
237238
applyShowWarningIndicator(showWarningIndicatorCheckBoxMenuItem.selected)
239+
fixCheckBoxMenuItem(showWarningIndicatorCheckBoxMenuItem)
238240
showInfoIndicatorCheckBoxMenuItem.selected = preferences.showInfoIndicator
239241
applyShowInfoIndicator(showInfoIndicatorCheckBoxMenuItem.selected)
242+
fixCheckBoxMenuItem(showInfoIndicatorCheckBoxMenuItem)
240243
syncDetailTabCheckBoxMenuItem.selected = preferences.syncDetailTab
244+
fixCheckBoxMenuItem(syncDetailTabCheckBoxMenuItem)
241245
}
242246

243247
def setModel(Run run) {
@@ -259,7 +263,7 @@ class RunnerPanel implements FocusListener, ActionListener {
259263
def synchronized update(String reporterId) {
260264
setCurrentRun(runs.get(reporterId))
261265
val row = currentRun.totalNumberOfCompletedTests - 1
262-
val header = testOverviewTableModel.testIdColumnName
266+
val header = testOverviewTableModel.suitepathColumnName
263267
val idColumn = testOverviewTable.columnModel.getColumn(3)
264268
if (idColumn.headerValue != header) {
265269
idColumn.headerValue = header
@@ -294,8 +298,8 @@ class RunnerPanel implements FocusListener, ActionListener {
294298
}
295299

296300
override void focusGained(FocusEvent e) {
297-
if (e.source == testIdTextArea) {
298-
testIdTextArea.caret.visible = true
301+
if (e.source == suitePathTextArea) {
302+
suitePathTextArea.caret.visible = true
299303
} else if (e.source == testDescriptionTextArea) {
300304
testDescriptionTextArea.caret.visible = true
301305
} else if (e.source == testFailureMessageTextArea) {
@@ -310,8 +314,8 @@ class RunnerPanel implements FocusListener, ActionListener {
310314
}
311315

312316
override focusLost(FocusEvent e) {
313-
if (e.source == testIdTextArea) {
314-
testIdTextArea.caret.visible = false
317+
if (e.source == suitePathTextArea) {
318+
suitePathTextArea.caret.visible = false
315319
} else if (e.source == testDescriptionTextArea) {
316320
testDescriptionTextArea.caret.visible = false
317321
} else if (e.source == testFailureMessageTextArea) {
@@ -335,6 +339,25 @@ class RunnerPanel implements FocusListener, ActionListener {
335339
}
336340
return pathList
337341
}
342+
343+
private def isWindowsLookAndFeel() {
344+
val laf = UIManager.systemLookAndFeelClassName
345+
if (laf.toLowerCase.contains("windows")) {
346+
return true
347+
} else {
348+
return false
349+
}
350+
}
351+
352+
private def void fixCheckBoxMenuItem(JCheckBoxMenuItem item) {
353+
if (windowsLookAndFeel) {
354+
if (item.selected) {
355+
item.icon = UtplsqlResources.getIcon("CHECKMARK_ICON")
356+
} else {
357+
item.icon = null
358+
}
359+
}
360+
}
338361

339362
override actionPerformed(ActionEvent e) {
340363
if (e.source == refreshButton) {
@@ -369,16 +392,22 @@ class RunnerPanel implements FocusListener, ActionListener {
369392
worksheet.runTestAsync
370393
} else if (e.source == showDisabledCounterCheckBoxMenuItem) {
371394
applyShowDisabledCounter(showDisabledCounterCheckBoxMenuItem.selected)
395+
fixCheckBoxMenuItem(showDisabledCounterCheckBoxMenuItem)
372396
} else if (e.source == showWarningsCounterCheckBoxMenuItem) {
373397
applyShowWarningsCounter( showWarningsCounterCheckBoxMenuItem.selected)
398+
fixCheckBoxMenuItem(showWarningsCounterCheckBoxMenuItem)
374399
} else if (e.source == showInfoCounterCheckBoxMenuItem) {
375400
applyShowInfoCounter(showInfoCounterCheckBoxMenuItem.selected)
401+
fixCheckBoxMenuItem(showInfoCounterCheckBoxMenuItem)
376402
} else if (e.source == showWarningIndicatorCheckBoxMenuItem) {
377403
applyShowWarningIndicator(showWarningIndicatorCheckBoxMenuItem.selected)
404+
fixCheckBoxMenuItem(showWarningIndicatorCheckBoxMenuItem)
378405
} else if (e.source == showInfoIndicatorCheckBoxMenuItem) {
379406
applyShowInfoIndicator(showInfoIndicatorCheckBoxMenuItem.selected)
407+
fixCheckBoxMenuItem(showInfoIndicatorCheckBoxMenuItem)
380408
} else if (e.source == syncDetailTabCheckBoxMenuItem) {
381409
syncDetailTab
410+
fixCheckBoxMenuItem(syncDetailTabCheckBoxMenuItem)
382411
}
383412
}
384413

@@ -406,13 +435,12 @@ class RunnerPanel implements FocusListener, ActionListener {
406435
if (rowIndex != -1) {
407436
val row = p.testOverviewTable.convertRowIndexToModel(rowIndex)
408437
val test = p.testOverviewTableModel.getTest(row)
409-
p.testIdTextArea.text = test.id
438+
p.suitePathTextArea.text = test.id
410439
p.testOwnerTextField.text = test.ownerName
411440
p.testPackageTextField.text = test.objectName
412441
p.testProcedureTextField.text = test.procedureName
413442
p.testDescriptionTextArea.text = test.description?.trim
414443
p.testStartTextField.text = formatDateTime(test.startTime)
415-
p.testEndTextField.text = formatDateTime(test.endTime)
416444
p.failuresTableModel.model = test.failedExpectations
417445
p.testFailureMessageTextArea.text = null
418446
if (test.failedExpectations !== null && test.failedExpectations.size > 0) {
@@ -716,43 +744,15 @@ class RunnerPanel implements FocusListener, ActionListener {
716744
testOverviewTable.componentPopupMenu = testOverviewPopupMenu
717745

718746
// Test tabbed pane (Test Properties)
719-
// - Id
720747
val testInfoPanel = new ScrollablePanel
721748
testInfoPanel.setLayout(new GridBagLayout())
722-
val testIdLabel = new JLabel("Id")
723-
c.gridx = 0
724-
c.gridy = 0
725-
c.gridwidth = 1
726-
c.gridheight = 1
727-
c.insets = new Insets(10, 10, 0, 0) // top, left, bottom, right
728-
c.anchor = GridBagConstraints::NORTHWEST
729-
c.fill = GridBagConstraints::NONE
730-
c.weightx = 0
731-
c.weighty = 0
732-
testInfoPanel.add(testIdLabel, c)
733-
testIdTextArea = new JTextArea
734-
testIdTextArea.editable = false
735-
testIdTextArea.enabled = true
736-
testIdTextArea.lineWrap = true
737-
testIdTextArea.wrapStyleWord = false
738-
testIdTextArea.addFocusListener(this)
739-
c.gridx = 1
740-
c.gridy = 0
741-
c.gridwidth = 1
742-
c.gridheight = 1
743-
c.insets = new Insets(5, 5, 0, 10) // top, left, bottom, right
744-
c.anchor = GridBagConstraints::WEST
745-
c.fill = GridBagConstraints::HORIZONTAL
746-
c.weightx = 1
747-
c.weighty = 0
748-
testInfoPanel.add(testIdTextArea, c)
749749
// - Owner
750750
val testOwnerLabel = new JLabel("Owner")
751751
c.gridx = 0
752-
c.gridy = 1
752+
c.gridy = 0
753753
c.gridwidth = 1
754754
c.gridheight = 1
755-
c.insets = new Insets(5, 10, 0, 0) // top, left, bottom, right
755+
c.insets = new Insets(10, 10, 0, 0) // top, left, bottom, right
756756
c.anchor = GridBagConstraints::WEST
757757
c.fill = GridBagConstraints::NONE
758758
c.weightx = 0
@@ -761,10 +761,10 @@ class RunnerPanel implements FocusListener, ActionListener {
761761
testOwnerTextField = new JTextField
762762
testOwnerTextField.editable = false
763763
c.gridx = 1
764-
c.gridy = 1
764+
c.gridy = 0
765765
c.gridwidth = 1
766766
c.gridheight = 1
767-
c.insets = new Insets(5, 5, 0, 10) // top, left, bottom, right
767+
c.insets = new Insets(10, 5, 0, 10) // top, left, bottom, right
768768
c.anchor = GridBagConstraints::WEST
769769
c.fill = GridBagConstraints::HORIZONTAL
770770
c.weightx = 1
@@ -773,7 +773,7 @@ class RunnerPanel implements FocusListener, ActionListener {
773773
// - Package
774774
val testPackageLabel = new JLabel("Package")
775775
c.gridx = 0
776-
c.gridy = 2
776+
c.gridy = 1
777777
c.gridwidth = 1
778778
c.gridheight = 1
779779
c.insets = new Insets(5, 10, 0, 0) // top, left, bottom, right
@@ -785,7 +785,7 @@ class RunnerPanel implements FocusListener, ActionListener {
785785
testPackageTextField = new JTextField
786786
testPackageTextField.editable = false
787787
c.gridx = 1
788-
c.gridy = 2
788+
c.gridy = 1
789789
c.gridwidth = 1
790790
c.gridheight = 1
791791
c.insets = new Insets(5, 5, 0, 10) // top, left, bottom, right
@@ -797,7 +797,7 @@ class RunnerPanel implements FocusListener, ActionListener {
797797
// - Procedure
798798
val testProcedureLabel = new JLabel("Procedure")
799799
c.gridx = 0
800-
c.gridy = 3
800+
c.gridy = 2
801801
c.gridwidth = 1
802802
c.gridheight = 1
803803
c.insets = new Insets(5, 10, 0, 0) // top, left, bottom, right
@@ -809,7 +809,7 @@ class RunnerPanel implements FocusListener, ActionListener {
809809
testProcedureTextField = new JTextField
810810
testProcedureTextField.editable = false
811811
c.gridx = 1
812-
c.gridy = 3
812+
c.gridy = 2
813813
c.gridwidth = 1
814814
c.gridheight = 1
815815
c.insets = new Insets(5, 5, 0, 10) // top, left, bottom, right
@@ -821,7 +821,7 @@ class RunnerPanel implements FocusListener, ActionListener {
821821
// - Description
822822
val testDescriptionLabel = new JLabel(UtplsqlResources.getString("RUNNER_DESCRIPTION"))
823823
c.gridx = 0
824-
c.gridy = 4
824+
c.gridy = 3
825825
c.gridwidth = 1
826826
c.gridheight = 1
827827
c.insets = new Insets(5, 10, 0, 0) // top, left, bottom, right
@@ -837,7 +837,7 @@ class RunnerPanel implements FocusListener, ActionListener {
837837
testDescriptionTextArea.wrapStyleWord = true
838838
testDescriptionTextArea.addFocusListener(this)
839839
c.gridx = 1
840-
c.gridy = 4
840+
c.gridy = 3
841841
c.gridwidth = 1
842842
c.gridheight = 1
843843
c.insets = new Insets(5, 5, 0, 10) // top, left, bottom, right
@@ -846,58 +846,62 @@ class RunnerPanel implements FocusListener, ActionListener {
846846
c.weightx = 1
847847
c.weighty = 0
848848
testInfoPanel.add(testDescriptionTextArea, c)
849-
// - Start
850-
val testStartLabel = new JLabel("Start")
849+
// - Suitepath
850+
val suitePathLabel = new JLabel("Suitepath")
851851
c.gridx = 0
852-
c.gridy = 5
852+
c.gridy = 4
853853
c.gridwidth = 1
854854
c.gridheight = 1
855855
c.insets = new Insets(5, 10, 0, 0) // top, left, bottom, right
856-
c.anchor = GridBagConstraints::WEST
856+
c.anchor = GridBagConstraints::NORTHWEST
857857
c.fill = GridBagConstraints::NONE
858858
c.weightx = 0
859-
c.weighty = 0
860-
testInfoPanel.add(testStartLabel, c)
861-
testStartTextField = new JTextField
862-
testStartTextField.editable = false
859+
c.weighty = 0
860+
testInfoPanel.add(suitePathLabel, c)
861+
suitePathTextArea = new JTextArea
862+
suitePathTextArea.editable = false
863+
suitePathTextArea.enabled = true
864+
suitePathTextArea.lineWrap = true
865+
suitePathTextArea.wrapStyleWord = false
866+
suitePathTextArea.addFocusListener(this)
863867
c.gridx = 1
864-
c.gridy = 5
868+
c.gridy = 4
865869
c.gridwidth = 1
866870
c.gridheight = 1
867871
c.insets = new Insets(5, 5, 0, 10) // top, left, bottom, right
868872
c.anchor = GridBagConstraints::WEST
869873
c.fill = GridBagConstraints::HORIZONTAL
870874
c.weightx = 1
871875
c.weighty = 0
872-
testInfoPanel.add(testStartTextField, c)
873-
// - End
874-
val testEndLabel = new JLabel("End")
876+
testInfoPanel.add(suitePathTextArea, c)
877+
// - Start
878+
val testStartLabel = new JLabel("Start")
875879
c.gridx = 0
876-
c.gridy = 6
880+
c.gridy = 5
877881
c.gridwidth = 1
878882
c.gridheight = 1
879883
c.insets = new Insets(5, 10, 10, 0) // top, left, bottom, right
880884
c.anchor = GridBagConstraints::WEST
881885
c.fill = GridBagConstraints::NONE
882886
c.weightx = 0
883887
c.weighty = 0
884-
testInfoPanel.add(testEndLabel, c)
885-
testEndTextField = new JTextField
886-
testEndTextField.editable = false
888+
testInfoPanel.add(testStartLabel, c)
889+
testStartTextField = new JTextField
890+
testStartTextField.editable = false
887891
c.gridx = 1
888-
c.gridy = 6
892+
c.gridy = 5
889893
c.gridwidth = 1
890894
c.gridheight = 1
891895
c.insets = new Insets(5, 5, 10, 10) // top, left, bottom, right
892896
c.anchor = GridBagConstraints::WEST
893897
c.fill = GridBagConstraints::HORIZONTAL
894898
c.weightx = 1
895899
c.weighty = 0
896-
testInfoPanel.add(testEndTextField, c)
900+
testInfoPanel.add(testStartTextField, c)
897901
// - Vertical spring and scrollbar for info panel
898902
val testInfoVerticalSpringLabel = new JLabel
899903
c.gridx = 0
900-
c.gridy = 7
904+
c.gridy = 6
901905
c.gridwidth = 1
902906
c.gridheight = 1
903907
c.insets = new Insets(0, 0, 0, 0) // top, left, bottom, right

0 commit comments

Comments
 (0)