@@ -0,0 +1,2199 @@
+package com.itmill.toolkit.tests.components.table;%0D%0A%0D%0Aimport com.itmill.toolkit.Application;%0D%0Aimport com.itmill.toolkit.data.Container;%0D%0Aimport com.itmill.toolkit.data.Item;%0D%0Aimport com.itmill.toolkit.data.util.IndexedContainer;%0D%0Aimport com.itmill.toolkit.ui.Button;%0D%0Aimport com.itmill.toolkit.ui.Table;%0D%0Aimport com.itmill.toolkit.ui.VerticalLayout;%0D%0Aimport com.itmill.toolkit.ui.Window;%0D%0Aimport com.itmill.toolkit.ui.Button.ClickEvent;%0D%0Aimport com.itmill.toolkit.ui.Button.ClickListener;%0D%0A%0D%0Apublic class TestCurrentPageFirstItem extends Application implements%0D%0A        ClickListener %7B%0D%0A%0D%0A    private Button buttonIndex;%0D%0A    private Button buttonItem;%0D%0A    private Table table;%0D%0A    private int counter = 0;%0D%0A    IndexedContainer container = new IndexedContainer();%0D%0A%0D%0A    @Override%0D%0A    public void init() %7B%0D%0A        try %7B%0D%0A            Window main = new Window(%22Table header Test%22);%0D%0A            setMainWindow(main);%0D%0A            main.setSizeFull();%0D%0A            // setTheme(%22testtheme%22);%0D%0A            VerticalLayout baseLayout = new VerticalLayout();%0D%0A            main.setLayout(baseLayout);%0D%0A%0D%0A            table = new Table();%0D%0A            container.addContainerProperty(%22row%22, String.class, %22%22);%0D%0A            table.setContainerDataSource(container);%0D%0A            table.setWidth(%22100%25%22);%0D%0A            table.setPageLength(3);%0D%0A            buttonIndex = new Button(%22Add row and select last index%22, this);%0D%0A            buttonItem = new Button(%22Add row and select last item%22, this);%0D%0A%0D%0A            baseLayout.addComponent(table);%0D%0A            baseLayout.addComponent(buttonIndex);%0D%0A            baseLayout.addComponent(buttonItem);%0D%0A        %7D catch (Exception e) %7B%0D%0A            e.printStackTrace();%0D%0A        %7D%0D%0A    %7D%0D%0A%0D%0A    public void buttonClick(ClickEvent event) %7B%0D%0A        Item item = container.addItem(++counter);%0D%0A        item.getItemProperty(%22row%22).setValue(counter + %22%22);%0D%0A        table.select(counter);%0D%0A        if (event.getButton() == buttonIndex) %7B%0D%0A            table.setCurrentPageFirstItemIndex(((Container.Indexed) table%0D%0A                    .getContainerDataSource()).indexOfId(counter));%0D%0A        %7D else %7B%0D%0A            table.setCurrentPageFirstItemId(counter);%0D%0A        %7D%0D%0A    %7D%0D%0A%7D%0D%0A

Test case for #2864