@@ -0,0 +1,2684 @@
+package com.vaadin.tests.components.treetable;%0D%0A%0D%0Aimport com.vaadin.data.Container.Hierarchical;%0D%0Aimport com.vaadin.data.util.HierarchicalContainer;%0D%0Aimport com.vaadin.terminal.ExternalResource;%0D%0Aimport com.vaadin.tests.components.TestBase;%0D%0Aimport com.vaadin.ui.Button;%0D%0Aimport com.vaadin.ui.Button.ClickEvent;%0D%0Aimport com.vaadin.ui.Link;%0D%0Aimport com.vaadin.ui.TreeTable;%0D%0A%0D%0Apublic class ChangeDataSourcePageLengthZero extends TestBase %7B%0D%0A    @Override%0D%0A    public void setup() %7B%0D%0A        final TreeTable tt = new TreeTable();%0D%0A        tt.setSizeUndefined();%0D%0A        tt.setWidth(%22100%25%22);%0D%0A        tt.setImmediate(true);%0D%0A        tt.setPageLength(0);%0D%0A        setupContainer(tt, 20);%0D%0A        addComponent(tt);%0D%0A        Button page1 = new Button(%22Set new data source (20 items)%22);%0D%0A        page1.addListener(new Button.ClickListener() %7B%0D%0A            public void buttonClick(ClickEvent event) %7B%0D%0A                setupContainer(tt, 20);%0D%0A            %7D%0D%0A        %7D);%0D%0A        Button page2 = new Button(%22Set new data source (10 items)%22);%0D%0A        page2.addListener(new Button.ClickListener() %7B%0D%0A            public void buttonClick(ClickEvent event) %7B%0D%0A                setupContainer(tt, 10);%0D%0A            %7D%0D%0A        %7D);%0D%0A        addComponent(page1);%0D%0A        addComponent(page2);%0D%0A    %7D%0D%0A%0D%0A    private static void setupContainer(TreeTable tt, int num) %7B%0D%0A        HierarchicalContainer container = new HierarchicalContainer();%0D%0A        container.addContainerProperty(%22i%22, Integer.class, null);%0D%0A        container.addContainerProperty(%22link%22, Link.class, null);%0D%0A        fillContainer(container, num);%0D%0A        tt.setContainerDataSource(container);%0D%0A    %7D%0D%0A%0D%0A    private static void fillContainer(Hierarchical container, int num) %7B%0D%0A        Object previous = null;%0D%0A        for (int i = 0; i %3C num; i++) %7B%0D%0A            Object item = container.addItem();%0D%0A            container.getContainerProperty(item, %22i%22).setValue(i + 1);%0D%0A            container.getContainerProperty(item, %22link%22).setValue(%0D%0A                    new Link(String.valueOf(i + 1), new ExternalResource(%0D%0A                            %22http://www.google.fi%22)));%0D%0A            if (i %3E 0 && (i + 1) %25 2 == 0) %7B%0D%0A                container.setChildrenAllowed(item, false);%0D%0A                container.setParent(item, previous);%0D%0A            %7D else %7B%0D%0A                container.setChildrenAllowed(item, true);%0D%0A            %7D%0D%0A            previous = item;%0D%0A        %7D%0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    protected String getDescription() %7B%0D%0A        return %22Changing the data source should update the height of a TreeTable with pagelength zero%22;%0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    protected Integer getTicketNumber() %7B%0D%0A        return 7908;%0D%0A    %7D%0D%0A%7D

Test for #7908