Possible bug in handling setVisible()?

I have the following test code:


import com.itmill.toolkit.ui.*;

public class Test extends FormLayout implements Button.ClickListener {
    
    private TextField messages;
    private CheckBox control;
    
    public Test() {
        setCaption("Test");
        control = new CheckBox("Messages On/Off", this);
        control.setImmediate(true);
        addComponent(control);
        messages = new TextField("Messages");
        messages.setRows(10);
        messages.setColumns(40);
        messages.setVisible(false);
        messages.setEnabled(false);
        addComponent(messages);
    }
    
    public final void buttonClick(Button.ClickEvent e) {
        if(e.getButton() == control) {
            messages.setVisible(control.booleanValue());
        }
    }
}

“messages” is initially hidden and disabled. It should become visible when the check box is clicked. It does become visible, but when it happens:
(1) It appears as normal TextField (single row, default width).
(2) It is no more in the disabled state. I can type something into it and the server displays a Warning: Ignoring variable change for disabled component class com.itmill.toolkit.ui.TextField, caption=Messages

Everything is working correctly if the initial state of “messages” is setVisible(true). That is, if I comment out the line messages.setVisible(false), everything works.

Hi,

This is a bug in FormLayout. I created a ticket (http://dev.itmill.com/ticket/2706) about this. If the textarea is initially visible, everything will work out. Also if you use something else than a FormLayout, it should work.

Thank you for the quick response and action.

The bug says it was fixed 23 months ago: "Test case and fix in [7000]
(5.3) and [7002]
(6.0). "

I’m rocking version 6.4.2 and I see the same behaviour. Am I missing something?

Looks the same but is another issue. Created http://dev.vaadin.com/ticket/6308