New Component: CustomCheckbox: indeterminate state

I had a couple of hours to spare on the weekend to create a new component for Vaadin. It’s an extension to the basic CheckBox, with added indeterminate state (you know, the state that is not quite true and not quite false).




CustomCheckbox demo on AppSpot



Vaadin 6.2 compliant JAR


Note
that the component requires tomorrow’s Vaadin nightly package or later (had to make a minor change to VButton to make the checkbox work).


Documentation

All functionality is otherwise same as basic CheckBox, but two additional methods “setIndeterminate()” and “isIndeterminate()” are available. When setIndeterminate is called, it has a side effect of setting the value of the CheckBox to false.

Hope someone finds this useful. Cheers!
11130.png

Forum ate my reply yesterday…

Anyway, cool idea, but I had some trouble with the demo yesterday. I clicked the component a few times, and it disappeared. Clicking the accompanying button did nothing, and when I did a ?restartApplication I got a completely blank screen. Removing the Vaadin cookie did not help, ?debug output attached.

This looks a lot like a GAE issue I’ve ran into myself a few times, the only ways to resurrect the app was to redeploy it, or disable and enable it from the GAE console. It’d be great to track the problem down, it occurs every now and then.
11131.png

The demo works now, but the component is a bit slow - try clicking it quickly several times.

Thanks Henri, found out those issue myself too, but didn’t have time to fix them.

The slowness comes, obviously, from the network lag. Currently the component is a bit poorly done, since it only works in immediate mode, and the state change is always made on the server side. I’ll be fixing that soon, it should work as fast as a regular checkbox then.

Update: Now fixed, demo should work faster and more reliably now. New package in incubator as well.

Hi Jouni,

I would like to customize checkboxes with the following needs :

  1. Put caption on the TOP of the component, instead of on the (default) right
  2. A custom image for the checkbox.

Your customcheckbox is currently an answer to #2.
But unfortuantely, I wasn’t able to move caption.
So I tried with a Label and a customchexbox on a verticallayout.
But, it seems to be impossible (?) to create a customcheckbox without any caption, as it is possible for a regular CheckBox.

Do you have any idea on how I can implement both #1 and #2 ?

Thank you very much !

BR

Stephen

Could you please remove the build directory from maven bundle. Thanks in advance.

Hi,

This is a pretty nice component and exactly fills my need. However, I have noticed two bugs:

-If I change the state from intermediate to not selected, the intermediate image stays until I refresh the page. This can be solved by forcing requestRepaint on the checkbox.
-If I put a checkbox with no caption, the images does not appear. The only workaround I found is to set some dummy text (eg “-”) and fix the width of the component.

Other than those two problems which both have a workaroudn, it works like a charm!

I downloaded your complete src and tried to run it but there was an error that says " The requested resource () is not available." i checked every link, it was all look fine. Please help me in it. Thank you