--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>TestCurrentPageFirstItem</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">TestCurrentPageFirstItem</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/TestCurrentPageFirstItem?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runTestCurrentPageFirstItem::/VHorizontalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runTestCurrentPageFirstItem::/VHorizontalLayout[0]/ChildComponentContainer[5]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runTestCurrentPageFirstItem::/VHorizontalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
package com.vaadin.tests.components.table;
-import com.vaadin.Application;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Table;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Window;
-public class TestCurrentPageFirstItem extends Application implements
- ClickListener {
+public class TestCurrentPageFirstItem extends TestBase implements ClickListener {
private Button buttonIndex;
private Button buttonItem;
- private Table table;
+ private Table[] tables = new Table[4];
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.setContent(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 setup() {
+ container.addContainerProperty("row", String.class, "");
+
+ HorizontalLayout baseLayout = new HorizontalLayout();
+ baseLayout.setHeight("115px");
+ addComponent(baseLayout);
+
+ for (int i = 0; i < tables.length; ++i) {
+ Table t = new Table();
+ t.setContainerDataSource(container);
+ t.setWidth("100px");
+ baseLayout.addComponent(t);
+ tables[i] = t;
}
+ tables[0].setSizeFull();
+ tables[0].setCaption("Full");
+ tables[1].setHeight("100px");
+ tables[1].setCaption("100px");
+ tables[2].setHeight("95%");
+ tables[2].setCaption("95%");
+ tables[3].setPageLength(3);
+ tables[3].setCaption("3 rows");
+
+ buttonIndex = new Button("Add row and select last index", this);
+ buttonItem = new Button("Add row and select last item", this);
+ baseLayout.addComponent(buttonIndex);
+ baseLayout.addComponent(buttonItem);
}
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);
+ for (int i = 0; i < tables.length; ++i) {
+ Table t = tables[i];
+ t.select(counter);
+ if (event.getButton() == buttonIndex) {
+ t.setCurrentPageFirstItemIndex(((Container.Indexed) t
+ .getContainerDataSource()).indexOfId(counter));
+ } else {
+ t.setCurrentPageFirstItemId(counter);
+ }
}
}
+
+ @Override
+ protected String getDescription() {
+ return "Table height changes when using setCurrentPageFirstItemId";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2864;
+ }
}