vaadin / framework

Vaadin 6, 7, 8 is a Java framework for modern Java web applications.
http://vaadin.com/
Other
1.78k stars 729 forks source link

Disabling and re-enabling a FormLayout with a Slider breaks Slider #11619

Open OlliTietavainenVaadin opened 5 years ago

OlliTietavainenVaadin commented 5 years ago

Minimal reproducible example:

        VerticalLayout rootLayout = new VerticalLayout();
        FormLayout layout = new FormLayout();
        Slider displayTime = new Slider("displaytime");
        displayTime.setMin(0);
        displayTime.setMax(100);
        layout.addComponent(displayTime);
        // DateField for comparison - it works as expected
        DateField dateField = new DateField("date");
        dateField.setValue(LocalDate.now());
        layout.addComponent(dateField);
        layout.setEnabled(false);
        rootLayout.addComponent(layout);
        Button button = new Button("re-enable FormLayout", e -> {
            layout.setEnabled(true);
        });
        rootLayout.addComponent(button);
        setContent(rootLayout);
stale[bot] commented 5 years ago

Hello there!

We are sorry that this issue hasn't progressed lately. We are prioritizing issues by severity and the number of customers we expect are experiencing this and haven't gotten around to fix this issue yet.

There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):

Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!

TatuLund commented 4 years ago

This happens with other layout components too, e.g. VerticalLayout. And it looks like it is weird timing issue. I briefly checked SliderConnector and VSlider code and could not figure out why this happens. But if you tweak the Slider enabled status with a suitable delay it is a workaround.

    protected void init(VaadinRequest request) {
        VerticalLayout rootLayout = new VerticalLayout();
        VerticalLayout layout = new VerticalLayout();
        Slider displayTime = new Slider("displaytime");
        displayTime.setMin(0);
        displayTime.setMax(100);
        layout.addComponent(displayTime);
        // DateField for comparison - it works as expected
        DateField dateField = new DateField("date");
        dateField.setValue(LocalDate.now());
        layout.addComponent(dateField);
        layout.setEnabled(false);
        rootLayout.addComponent(layout);
        Button button = new Button("re-enable FormLayout", e -> {
            layout.setEnabled(true);
            displayTime.setEnabled(false);
            Thread t = new Thread(() -> {
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e1) {
                    // TODO Auto-generated catch block
                }
                this.access(() -> displayTime.setEnabled(true));                
            });
            t.start();
        });
        rootLayout.addComponents(button);
        setContent(rootLayout);     
}
stale[bot] commented 3 years ago

Hello there!

We are sorry that this issue hasn't progressed lately. We are prioritizing issues by severity and the number of customers we expect are experiencing this and haven't gotten around to fix this issue yet.

There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):

Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!