diff options
Diffstat (limited to 'uitest/src/com')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbar.html | 31 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbar.java | 112 |
2 files changed, 143 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbar.html b/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbar.html new file mode 100644 index 0000000000..c499747232 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbar.html @@ -0,0 +1,31 @@ +<?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>TreeTableExtraScrollbar</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">TreeTableExtraScrollbar</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.treetable.TreeTableExtraScrollbar?restartApplication</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>button</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td></td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbar.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbar.java new file mode 100644 index 0000000000..4af0da158d --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbar.java @@ -0,0 +1,112 @@ +package com.vaadin.tests.components.treetable; + +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.Label; +import com.vaadin.ui.Table; +import com.vaadin.ui.TreeTable; + +public class TreeTableExtraScrollbar extends TestBase { + + @Override + protected String getDescription() { + return "Vertical scrollbar should not cause a horizontal scrollbar" + + " if there is more excess space than vertical scrollbar needs."; + } + + @Override + protected Integer getTicketNumber() { + return 10513; + } + + @Override + protected void setup() { + HorizontalLayout layout = new HorizontalLayout(); + layout.setWidth("310px"); + layout.setHeight("300px"); + + final Table table = new TreeTable(); + table.setSizeFull(); + + table.addGeneratedColumn("parameterId", new EmptyColumnGenerator()); + table.addGeneratedColumn("wordingTextId", new TypeColumnGenerator()); + table.addGeneratedColumn("parameterTypeId", new TypeColumnGenerator()); + + table.setColumnWidth("parameterId", 26); + + table.addItem(new TestObject("name 1", "value 1")); + table.addItem(new TestObject("name 2", "value 2")); + table.addItem(new TestObject("name 3", "value 3")); + table.addItem(new TestObject("name 4", "value 4")); + table.addItem(new TestObject("name 5", "value 5")); + + layout.addComponent(table); + + Button button = new Button("Add"); + button.setId("button"); + button.addClickListener(new ClickListener() { + + public void buttonClick(ClickEvent event) { + table.addItem(new TestObject("name 6-1", "value 6-1")); + table.addItem(new TestObject("name 6-2", "value 6-2")); + table.addItem(new TestObject("name 6-3", "value 6-3")); + table.addItem(new TestObject("name 6-4", "value 6-4")); + table.addItem(new TestObject("name 6-5", "value 6-5")); + table.addItem(new TestObject("name 6-6", "value 6-6")); + table.addItem(new TestObject("name 6-7", "value 6-7")); + table.addItem(new TestObject("name 6-8", "value 6-8")); + table.addItem(new TestObject("name 6-9", "value 6-9")); + table.addItem(new TestObject("name 6-9", "value 6-10")); + } + }); + + addComponent(layout); + addComponent(button); + } + + private class EmptyColumnGenerator implements Table.ColumnGenerator { + public Object generateCell(Table table, Object itemId, Object columnId) { + return null; + } + } + + private class TypeColumnGenerator implements Table.ColumnGenerator { + public Object generateCell(Table table, Object itemId, Object columnId) { + if (itemId instanceof TestObject) { + return new Label(((TestObject) itemId).getValue()); + } + return null; + } + } + +} + +class TestObject { + + private String name; + private String value; + + public TestObject(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} |