Events not triggered on check boxes

I tried to attach an event to a checkbox, like the example on page 90 of the"book-of-vaadin"

however, clicking on the checkboxes, seems not to trigger the events.

I’ve verified it even with the debugger, setting a breakpoint on the events procedures, that doesn’t get called.

The events get triggered only if I refresh the page.

I’ve tried both the" valueChangeEvent" than the “ClickEvent”.

I’m using the last Netbeans module (org-vaadin-support-0.1.2.nbm) , NetBeans 7.0, windows Xp sp3,

Firefox 4.0.1 and Chrome 11.0.66.90.

Here is thetest program.
Any suggestion ?
Regards.
Maurizio.


package com.example.vaadin;

import com.vaadin.Application;
import com.vaadin.ui.*;

public class MyApplication extends Application {

    @Override
    public void init() {
        Window main = new Window("MyApplication");
        Label label = new Label("Hello user !");
        label.setDescription("my label");
        main.addComponent(label);

        final CheckBox checkbox1 = new CheckBox("First CheckBox");
        main.addComponent(checkbox1);

        final CheckBox checkbox2 = new CheckBox("Second CheckBox");
        main.addComponent(checkbox2);

        checkbox1.addListener(
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        checkbox2.setValue(checkbox1.getValue());  
                    }
                }); 

        checkbox2.addListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                checkbox1.setValue(checkbox2.getValue());
            }
        });

        setMainWindow(main);
    }
}

I think that the problem is that your checkboxes are not in the immediate mode. Try to set the components to the immediate mode:

checkbox1.setImmediate(true);
checkbox2.setImmediate(true);

-Henri

Wonderful !! it works.
Regards.
Maurizio.