CheckBox setValue() not triggering visual checkmark when used as DisclosurePanel header

155 views
Skip to first unread message

Shawn Drape

unread,
Dec 8, 2011, 11:31:15 AM12/8/11
to google-we...@googlegroups.com
Hi all,

I'm fairly sure this is a bug but I thought I'd ask about it here before I went and created an issue for it.

I'm using a CheckBox as the header of a DisclosurePanel, and since I'm already aware that the click handlers for the CheckBox are ignored I have created open and close handlers on the DisclosurePanel to manually set value of the CheckBox. This works splendidly so long as you click on the label of the CheckBox; the item is checked, the panel opens, and you see the new contents.

However, if you click on the input element of the CheckBox, the value still changes, and the disclosure panel still opens, but the visual indicator isn't drawn (or in the case of closing, removed). I've attempted to debug it as well as I can, and everything seems to be in place, everything firing as it should and the inputElem.setChecked(value) and .setDefaultChecked(value) are both getting hit (I believe they are the methods responsible for drawing, but not 100% sure).

Is there something I can do to fix this behaviour? As much as I'd like to leave it as good enough, my users are going to get frustrated by the most obvious interaction not working.

Thanks in advance for your help!

Here is a code sample:

public class CheckBoxBugExample extends Composite{

    private VerticalPanel container = new VerticalPanel();
    private CheckBox customResponseHeader = new CheckBox("Customize Message");
    private DisclosurePanel responderDisclosurePanel = new DisclosurePanel();

    public CheckBoxBugExample(){
        initWidget(container);
        responderDisclosurePanel.setHeader(customResponseHeader);
        responderDisclosurePanel.setContent(new HTMLPanel("Hello, world!"));
        container.add(responderDisclosurePanel);

        responderDisclosurePanel.addOpenHandler(new OpenHandler<DisclosurePanel>() {
            @Override
            public void onOpen(OpenEvent<DisclosurePanel> disclosurePanelOpenEvent) {
                customResponseHeader.setValue(true, true);
            }
        });

        responderDisclosurePanel.addCloseHandler(new CloseHandler<DisclosurePanel>() {
            @Override
            public void onClose(CloseEvent<DisclosurePanel> disclosurePanelCloseEvent) {
                customResponseHeader.setValue(false, true);
            }
        });
    }
}
Reply all
Reply to author
Forward
0 new messages