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: [1] 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 [2] 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: [3] 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 [2]. Code and test case will be added shortly.
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
Created attachment 29713 [details] Sample screenshot in Linux env
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!
Created attachment 29715 [details] WinXP Java 6 disabled
Created attachment 29716 [details] WinXP Java 6 enabled
Created attachment 29717 [details] WinXP Java 6 disabled (icon/original)
Created attachment 29718 [details] WinXP Java 6 enabled (icon/original)
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
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
Created attachment 29720 [details] WinXP Java 6 enabled (icon/original) - Bar
Created attachment 29721 [details] WinXP Java 6 disabled (icon/original) - Bar
Created attachment 29722 [details] WinXP Java 6 enabled (icon/original) - Bar
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.
Created attachment 29723 [details] Current in linux
Created attachment 29724 [details] round third state
Created attachment 29725 [details] Mac OSX look
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.
Created attachment 29726 [details] MacOs Underterminate
Created attachment 29727 [details] enabled
(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.
(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.
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3005