diff options
author | Artur Signell <artur.signell@itmill.com> | 2009-04-27 13:13:10 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2009-04-27 13:13:10 +0000 |
commit | 031aad4267fc6c49944b487164e9e1ba259ed549 (patch) | |
tree | 88db6a0e7edc1155f3ebaead4ed6a604a3d9efe0 /src/com/itmill/toolkit | |
parent | 19ad7df367dab9ba22b024f641c001fbf100d79a (diff) | |
download | vaadin-framework-031aad4267fc6c49944b487164e9e1ba259ed549.tar.gz vaadin-framework-031aad4267fc6c49944b487164e9e1ba259ed549.zip |
Test case for #2864
svn changeset:7536/svn branch:6.0
Diffstat (limited to 'src/com/itmill/toolkit')
-rw-r--r-- | src/com/itmill/toolkit/tests/components/table/TestCurrentPageFirstItem.java | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/tests/components/table/TestCurrentPageFirstItem.java b/src/com/itmill/toolkit/tests/components/table/TestCurrentPageFirstItem.java new file mode 100644 index 0000000000..fd4aed015d --- /dev/null +++ b/src/com/itmill/toolkit/tests/components/table/TestCurrentPageFirstItem.java @@ -0,0 +1,60 @@ +package com.itmill.toolkit.tests.components.table;
+
+import com.itmill.toolkit.Application;
+import com.itmill.toolkit.data.Container;
+import com.itmill.toolkit.data.Item;
+import com.itmill.toolkit.data.util.IndexedContainer;
+import com.itmill.toolkit.ui.Button;
+import com.itmill.toolkit.ui.Table;
+import com.itmill.toolkit.ui.VerticalLayout;
+import com.itmill.toolkit.ui.Window;
+import com.itmill.toolkit.ui.Button.ClickEvent;
+import com.itmill.toolkit.ui.Button.ClickListener;
+
+public class TestCurrentPageFirstItem extends Application implements
+ ClickListener {
+
+ private Button buttonIndex;
+ private Button buttonItem;
+ private Table table;
+ private int counter = 0;
+ IndexedContainer container = new IndexedContainer();
+
+ @Override
+ public void init() {
+ try {
+ Window main = new Window("Table header Test");
+ setMainWindow(main);
+ main.setSizeFull();
+ // setTheme("testtheme");
+ VerticalLayout baseLayout = new VerticalLayout();
+ main.setLayout(baseLayout);
+
+ table = new Table();
+ container.addContainerProperty("row", String.class, "");
+ table.setContainerDataSource(container);
+ table.setWidth("100%");
+ table.setPageLength(3);
+ buttonIndex = new Button("Add row and select last index", this);
+ buttonItem = new Button("Add row and select last item", this);
+
+ baseLayout.addComponent(table);
+ baseLayout.addComponent(buttonIndex);
+ baseLayout.addComponent(buttonItem);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void buttonClick(ClickEvent event) {
+ Item item = container.addItem(++counter);
+ item.getItemProperty("row").setValue(counter + "");
+ table.select(counter);
+ if (event.getButton() == buttonIndex) {
+ table.setCurrentPageFirstItemIndex(((Container.Indexed) table
+ .getContainerDataSource()).indexOfId(counter));
+ } else {
+ table.setCurrentPageFirstItemId(counter);
+ }
+ }
+}
|