@@ -0,0 +1,2460 @@
+package com.itmill.toolkit.tests.components.table;%0A%0Aimport com.itmill.toolkit.data.Item;%0Aimport com.itmill.toolkit.data.util.IndexedContainer;%0Aimport com.itmill.toolkit.tests.components.TestBase;%0Aimport com.itmill.toolkit.ui.Button;%0Aimport com.itmill.toolkit.ui.Table;%0Aimport com.itmill.toolkit.ui.Button.ClickEvent;%0A%0Apublic class ContainerSizeChange extends TestBase %7B%0A%0A    private Table table;%0A    private MyDataSource ds;%0A%0A    @Override%0A    protected String getDescription() %7B%0A        return %22A table should be able to handle a decrease in the size of the container. The original container here contains 50 items and the decrease button removes 10 of these. To reproduce the problem: Click 'Decrease size' two times to reduce size to 30 and scroll to the end (50). What should happen is the table should notice the container size has decreased and show the last items which now exists in the new container.%22;%0A    %7D%0A%0A    @Override%0A    protected Integer getTicketNumber() %7B%0A        return 2862;%0A    %7D%0A%0A    @Override%0A    protected void setup() %7B%0A        table = new Table(%22A table%22);%0A        ds = new MyDataSource();%0A        table.setContainerDataSource(ds);%0A        table.setPageLength(5);%0A        addComponent(table);%0A%0A        Button b = new Button(%22Decrease size%22, new Button.ClickListener() %7B%0A%0A            public void buttonClick(ClickEvent event) %7B%0A                ds.decreaseSize();%0A            %7D%0A%0A        %7D);%0A%0A        addComponent(b);%0A%0A        b = new Button(%22Increase size%22, new Button.ClickListener() %7B%0A%0A            public void buttonClick(ClickEvent event) %7B%0A                ds.increaseSize();%0A            %7D%0A%0A        %7D);%0A%0A        addComponent(b);%0A%0A    %7D%0A%0A%7D%0A%0Aclass MyDataSource extends IndexedContainer %7B%0A%0A    private int size = 0;%0A%0A    public MyDataSource() %7B%0A        addContainerProperty(%22a%22, String.class, %22%22);%0A        addContainerProperty(%22b%22, String.class, %22%22);%0A        addContainerProperty(%22c%22, String.class, %22%22);%0A%0A        for (int i = 0; i %3C 100; i++) %7B%0A            Item item = addItem(String.valueOf(i));%0A            item.getItemProperty(%22a%22).setValue(%22a %22 + i);%0A            item.getItemProperty(%22b%22).setValue(%22b %22 + i);%0A            item.getItemProperty(%22c%22).setValue(%22c %22 + i);%0A        %7D%0A        size = 50;%0A    %7D%0A%0A    public void increaseSize() %7B%0A        size += 10;%0A%0A    %7D%0A%0A    public void decreaseSize() %7B%0A        if (size %3E 10) %7B%0A            size -= 10;%0A        %7D%0A%0A    %7D%0A%0A    @Override%0A    public int size() %7B%0A        return size;%0A    %7D%0A%7D%0A

Test case for #2862