GWT Analyze Layouts solve layout problem

Hi all!

There is a table containing a row of the panel and another table (Debug window reports no errors in the interface):

After adding rows to a sub table:

But as soon as I press the button “Analyze Layout” interface looks like this (problem resolved):

Can I call the “Analyze Layouts” on the server when I need it?

Analyze layouts (AL) has a side effect of sometimes fixing issues, but that doesn’t mean that it is the way that it should be. Sounds like you’ve come across a bug, and that AL accidentally fixes the inconsistency while analyzing it. The best thing to do is to get it fixed, either in your code or in Vaadin.

Try to isolate the issue. Create a new Vaadin project and try to reproduce it. Minimize the code needed to reproduce it until there is nothing to be removed. Either you spot the issue in your code here or then you’re certain that it is a Vaadin issue. If it is Vaadin related then create a new ticket on the issue at
dev.vaadin.com
.

Here is an example demonstrating the problem:


package com.example.vaadin;

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

public class MyApplication extends Application {

    @Override
    public void init() {
        Window mainWindow = new Window("Test");
        setMainWindow(mainWindow);

        Window w = getMainWindow();
        w.setWidth("100%");
        w.setHeight(-1);

        Panel windowPanel = new Panel();
        windowPanel.setSizeFull();
        windowPanel.setScrollable(true);

        VerticalLayout rootLayout = (VerticalLayout) windowPanel.getContent();
        rootLayout.setWidth("100%");
        rootLayout.setMargin(false);
        rootLayout.setSpacing(false);

        rootLayout.addComponent(new TestForm());

        w.setContent(windowPanel);
    }

    public class TestForm extends VerticalLayout {

        private void generateTableRow(final Table table) {

            final Button dButton = new Button("Del");
            Object itemId = System.currentTimeMillis();
            dButton.setData(itemId);
            dButton.setStyleName(Reindeer.BUTTON_LINK);
            dButton.addListener(new Button.ClickListener() {

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    Object itemId = dButton.getData();
                    table.removeItem(itemId);
                }
            });

            table.addItem(new Object[]{dButton, generateTablePanel()}, itemId);
        }

        private Panel generateTablePanel() {

            Panel panel = new Panel();

            final Table table = new Table();
            table.setWidth("100%");
            table.setPageLength(0);
            table.setSelectable(false);

            table.addContainerProperty("X", Button.class, null);
            table.setColumnWidth("X", 20);

            table.addContainerProperty("Перечисление", Panel.class, null);

            Button addButton = new Button("Add");
            addButton.addListener(new Button.ClickListener() {

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    generateTableRow(table);
                }
            });

            panel.addComponent(addButton);
            panel.addComponent(table);

            return panel;
        }

        public TestForm() {
            addComponent(generateTablePanel());
        }
    }
}

I create ticket
#8823
for this issue