different CheckBox behavior in 7.4.x and 7.5.x

I just updated from Vaadin 7.4.8 to 7.5.5 in my Project. First Thing i nocticed that i can not read the correct checkbox value.

immediate value of CheckBox is false in 7.4 and 7.5 by default.

ChechBox c = new CheckBox(); //is unchecked by default
//now check in Browser
boolean value = c.getValue(); // returns true in 7.4 and false in 7.5

is that intended?

Another thing i noticed in 7.5, that i can not use the Button.click() funtion to simulate a button click.

I am afraid to upgrade my project to vaadin 7.5, cause it would not work like before.

It looks like in both cases you are doing something wrong.

I just tested the CheckBox in 7.4.8 and in 7.5.5 with this UI code:

    @Override
    protected void init(VaadinRequest request) {
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        setContent(layout);

        CheckBox button = new CheckBox("check");
        layout.addComponent(button);
        
        layout.addComponent(new Button("test", e->Notification.show(""+button.getValue())));
    }

Both are working in the same way and correctly.

Also the Button.click method is still there: https://github.com/vaadin/vaadin/blob/7.5/server/src/com/vaadin/ui/Button.java

Yes works all fine in 7.5.5
i suggest starting your app in debug mode and check the versions of the followings:

  • server
  • client
  • widgetset

when i set the checkbox to immediate=true, they will work with version 7.5.5

Client engine version7.5.5
Server engine version7.5.5
Theme version7.5.5
Push server version2.2.7.vaadin1
Push client version2.2.6.vaadin5-jquery (note: does not need to match server version)
Widget setde.fidetis.diasterminal.widgetset.Widgetset
Themediasterminal
Communication methodPush (websocket)
Heartbeat30s

Problem seems to be the Layoutclicklistener of the AbsoluteLayout on which the checkbox is. When i remove the Layoutclicklistener, the checkbox value will be also set on server side.

Could you show your code? Or write a minimal example how to reproduce the problem.
If you are sure it’s a bug, you can submit a bug report.

I know the code is a little bit weird, but its happening when i use nested layouts with layoutClicklisteners in my project.

@Override
    protected void init(VaadinRequest request) {

        /*
         * This code has been working in 7.4.x
         */
        
        VerticalLayout layoutMain     = new VerticalLayout();
        VerticalLayout layoutSub     = new VerticalLayout();
        
        layoutMain.addComponent(layoutSub);
        
        final CheckBox checkbox = new CheckBox("checkbox inside 2nd layout");
        layoutSub.addComponent(checkbox);
        
        Button button = new Button("get checkbox value", new Button.ClickListener() {
            
            @Override
            public void buttonClick(ClickEvent event) {
                Notification.show(""+checkbox.getValue());
            }
        });
        layoutSub.addComponent(button);
        
        
        layoutMain.addLayoutClickListener(new LayoutClickListener() {
            @Override
            public void layoutClick(LayoutClickEvent event) {
                
            }
        });
        
        layoutSub.addLayoutClickListener(new LayoutClickListener() {
            @Override
            public void layoutClick(LayoutClickEvent event) {

            }
        });
        
        setContent(layoutMain);
        
    }

Yes, I see. Thanks, probably it should be reported as a bug.
As a workaround you can set the checkbox immediate, then it behaves the same.