@@ -0,0 +1,2868 @@
+package com.vaadin.tests.layouts;%0A%0Aimport com.vaadin.terminal.Sizeable;%0Aimport com.vaadin.tests.components.AbstractTestCase;%0Aimport com.vaadin.ui.Button;%0Aimport com.vaadin.ui.GridLayout;%0Aimport com.vaadin.ui.TextField;%0Aimport com.vaadin.ui.VerticalLayout;%0Aimport com.vaadin.ui.Window;%0A%0Apublic class ComplexGLColumnExpansionWithColSpan extends AbstractTestCase %7B%0A    private int cols;%0A%0A    @Override%0A    protected String getDescription() %7B%0A        return %22Buttons should stay stacked on left when clicking new button%22;%0A    %7D%0A%0A    @Override%0A    protected Integer getTicketNumber() %7B%0A        return 5227;%0A    %7D%0A%0A    @Override%0A    public void init() %7B%0A        final VerticalLayout mainLayout = new VerticalLayout();%0A%0A        mainLayout.setSpacing(true);%0A        mainLayout.setMargin(true);%0A        mainLayout.setHeight(100, Sizeable.UNITS_PERCENTAGE);%0A        mainLayout.setWidth(100, Sizeable.UNITS_PERCENTAGE);%0A        setMainWindow(new Window(%22Vaadin Test%22, mainLayout));%0A%0A        cols = 1;%0A        final GridLayout gl = new GridLayout(cols, 3);%0A        gl.setWidth(%221000px%22);%0A        // textfield spreads across all cols%0A        final TextField textfield = new TextField();%0A        textfield.setWidth(100, Sizeable.UNITS_PERCENTAGE);%0A        Button b1 = new Button(%22new button%22);%0A        Button b2 = new Button(%22nothing%22);%0A        gl.addComponent(textfield, 0, 0);%0A        gl.addComponent(b1, 0, 1);%0A        gl.addComponent(b2, 0, 2);%0A        b1.setWidth(270, Sizeable.UNITS_PIXELS);%0A        b2.setWidth(270, Sizeable.UNITS_PIXELS);%0A        b1.addListener(new Button.ClickListener() %7B%0A            public void buttonClick(Button.ClickEvent event) %7B%0A                cols++;%0A                gl.setColumns(cols);%0A                Button b1 = new Button(%22new button%22 + cols);%0A                Button b2 = new Button(%22nothing%22 + cols);%0A                gl.addComponent(b1, cols - 1, 1);%0A                gl.addComponent(b2, cols - 1, 2);%0A                b1.setWidth(270, Sizeable.UNITS_PIXELS);%0A                b2.setWidth(270, Sizeable.UNITS_PIXELS);%0A                // adjust expand ratios...%0A                if (cols %3E 0) %7B%0A                    // next to last colum 0, last column 100%0A                    gl.setColumnExpandRatio(cols - 2, 0);%0A                    gl.setColumnExpandRatio(cols - 1, 100);%0A                %7D%0A                gl.removeComponent(textfield);%0A                gl.addComponent(textfield, 0, 0, cols - 1, 0);%0A            %7D%0A        %7D);%0A        gl.setSizeFull();%0A        mainLayout.addComponent(gl);%0A        mainLayout.setExpandRatio(gl, 100);%0A        Button restart = new Button(%22restart%22);%0A        mainLayout.addComponent(restart);%0A        restart.addListener(new Button.ClickListener() %7B%0A            public void buttonClick(Button.ClickEvent event) %7B%0A                mainLayout.getWindow().getApplication().close();%0A            %7D%0A        %7D);%0A%0A    %7D%0A%0A%7D%0A

test case for #5227