|Summary:||Add tristate checkbox implementation|
|Component:||Main||Assignee:||JMeter issues mailing list <issues>|
Sample screenshot in Linux env
TristateCheckBoxTest - Win7/Java7(with javax.swing.plaf.synth.SynthUI)
WinXP Java 6 disabled
WinXP Java 6 enabled
WinXP Java 6 disabled (icon/original)
WinXP Java 6 enabled (icon/original)
WinXP Java 6 enabled (icon/original) - Bar
WinXP Java 6 disabled (icon/original) - Bar
WinXP Java 6 enabled (icon/original) - Bar
Current in linux
round third state
Mac OSX look
Description Sebb 2012-12-05 16:34:29 UTC
A tri-state checkbox would have three states: - unselected - selected - indeterminate (i.e. neither) The indeterminate state would be useful for handling defaults - e.g. if the sampler checkbox is indeterminate, use the setting from the configuration. There don't seem to be any existing implementations with a suitable license. The following implementation is neat and simple:  http://stackoverflow.com/questions/1263323/tristate-checkboxes-in-java However, testing shows that it does not support ItemListener properly, as the processing causes an additional item change. It also relies on its ActionListener being processed first. However, it does provide a useful hint - using a icon for the indeterminate state. Another implementation is at  http://www.javaspecialists.eu/archive/Issue145.html This works well, however the indeterminate state is not very obvious on the display, particularly in the Motif LAF. Another TriState implementation is here:  http://www.coderanch.com/t/342563/GUI/java/TriState-CheckBox It does not support ActionListener, however it does have a useful Icon implementation which can be used to improve implementation . Code and test case will be added shortly.
Comment 1 Sebb 2012-12-06 01:45:32 UTC
Added initial implementation. It needs a bit of work on the Nimbus UI. Please try running test/src/org/apache/jmeter/gui/util/TristateCheckBoxTest.java to see what how the UI behaves. URL: http://svn.apache.org/viewvc?rev=1417726&view=rev Log: Add tristate checkbox implementation Bugzilla Id: 54251 Added: jmeter/trunk/src/core/org/apache/jmeter/gui/util/TristateCheckBox.java (with props) jmeter/trunk/src/core/org/apache/jmeter/gui/util/TristateState.java (with props) jmeter/trunk/test/src/org/apache/jmeter/gui/util/TristateCheckBoxTest.java (with props) Modified: jmeter/trunk/xdocs/changes.xml
Comment 2 Milamber 2012-12-06 08:05:24 UTC
Created attachment 29713 [details] Sample screenshot in Linux env
Comment 3 Kurt Hong 2012-12-06 09:16:35 UTC
Created attachment 29714 [details] TristateCheckBoxTest - Win7/Java7(with javax.swing.plaf.synth.SynthUI) looks good for me except Nimbus. But it's using javax.swing.plaf.synth.SynthUI. Thank you!
Comment 6 Sebb 2012-12-06 10:10:08 UTC
Created attachment 29717 [details] WinXP Java 6 disabled (icon/original)
Comment 7 Sebb 2012-12-06 10:10:46 UTC
Created attachment 29718 [details] WinXP Java 6 enabled (icon/original)
Comment 8 Sebb 2012-12-06 10:11:54 UTC
Show how original design (no special icon) looked. URL: http://svn.apache.org/viewvc?rev=1417789&view=rev Log: Add tests for original code - which did not use a special icon - for comparison Bugzilla Id: 54251 Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/util/TristateCheckBox.java jmeter/trunk/test/src/org/apache/jmeter/gui/util/TristateCheckBoxTest.java
Comment 9 Sebb 2012-12-06 11:08:59 UTC
URL: http://svn.apache.org/viewvc?rev=1417803&view=rev Log: Fix up so Nimbus calls paint when disabling the button Bugzilla Id: 54251 Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/util/TristateCheckBox.java
Comment 10 Sebb 2012-12-06 19:58:05 UTC
Created attachment 29720 [details] WinXP Java 6 enabled (icon/original) - Bar
Comment 11 Sebb 2012-12-06 19:58:41 UTC
Created attachment 29721 [details] WinXP Java 6 disabled (icon/original) - Bar
Comment 12 Sebb 2012-12-06 20:00:06 UTC
Created attachment 29722 [details] WinXP Java 6 enabled (icon/original) - Bar
Comment 13 Sebb 2012-12-06 20:06:37 UTC
This should fix the compilation issues: URL: http://svn.apache.org/viewvc?rev=1418045&view=rev Log: Fix up so does not use private Sun class; we get the icon size from the UIManager defaults Also change from cross to horizontal line Bugzilla Id: 54251 Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/util/TristateCheckBox.java Also changed the icon to a horizontal bar. This is what GMail uses when some (but not all) mails in a list are selected, so hopefully would be more obvious / less confusing than a cross. Also, the code should now pick up the actual icon size, even if it varies from the default. Not yet sure if we need to allow for LAF changes or whether those will be handled by recreating the relevant classes.
Comment 17 Philippe Mouawad 2012-12-06 20:51:20 UTC
Under MacOS X: - icon look is clear - but "Tristate checkbox (original)" is not. There is no real difference between indeterminate and checked. Thank you sebb.
Comment 18 Philippe Mouawad 2012-12-06 20:51:47 UTC
Created attachment 29726 [details] MacOs Underterminate
Comment 20 Sebb 2012-12-07 10:02:22 UTC
(In reply to comment #17) > Under MacOS X: > - icon look is clear > - but "Tristate checkbox (original)" is not. There is no real difference > between indeterminate and checked. That is also the case for WinXP, which is why the icon solution attracted my attention.
Comment 21 Sebb 2012-12-07 10:12:17 UTC
(In reply to comment #14) > Created attachment 29723 [details] > Current in linux The left shift is odd, because the code uses the supplied x,y coordinates. Maybe a bug in the JVM? Also, the unix Nimbus look is very different from MacOS and Windows. It would be nice to fix these problems, but I don't think they are show-stoppers. If necessary they can be fixed later.