diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2013-02-08 17:20:04 +0200 |
---|---|---|
committer | Johannes Dahlström <johannesd@vaadin.com> | 2013-02-18 15:35:08 +0200 |
commit | 6949cd8109db726b92e80cffb3286c67ec7abb47 (patch) | |
tree | 7375480cc72873d7277060a8991087c37026a80d /uitest/src/com/vaadin | |
parent | 41e1a013d829f75c0bdadea40ec0b42429e2a581 (diff) | |
download | vaadin-framework-6949cd8109db726b92e80cffb3286c67ec7abb47.tar.gz vaadin-framework-6949cd8109db726b92e80cffb3286c67ec7abb47.zip |
Merge of second part of (#10513) to Vaadin 7.
Fix for TreeTable's indent handling & width calculations.
Conflicts:
client/src/com/vaadin/client/ui/table/TableConnector.java
Change-Id: I94f0d84ac978045d3b79be6b3726ea6973d30b35
Diffstat (limited to 'uitest/src/com/vaadin')
2 files changed, 161 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollBarWithChildren.html b/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollBarWithChildren.html new file mode 100644 index 0000000000..611e7a5994 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollBarWithChildren.html @@ -0,0 +1,69 @@ +<?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.TreeTableExtraScrollbarWithChildren?restartApplication</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>button</td> + <td></td> +</tr> +<tr> + <td>pause</td> + <td>300</td> + <td></td> +</tr> +<!-- screenCapture should not have a horizontal scrollbar, and the columns should be the same width in body and headers --> +<tr> + <td>screenCapture</td> + <td></td> + <td>expanded</td> +</tr> +<tr> + <td>mouseClick</td> + <td>button</td> + <td></td> +</tr> +<tr> + <td>pause</td> + <td>300</td> + <td></td> +</tr> +<!-- screenCapture should not have a horizontal scrollbar, the columns should be back to original width in body and headers, and vertical scrollbar shouldn't have left an empty space --> +<tr> + <td>screenCapture</td> + <td></td> + <td>collapsed</td> +</tr> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.treetable.TreeTableExtraScrollbarWithChildren</td> + <td></td> +</tr> +<tr> + <td>pause</td> + <td>300</td> + <td></td> +</tr> +<!-- screenCapture should not have changed --> +<tr> + <td>screenCapture</td> + <td></td> + <td>refreshed</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbarWithChildren.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbarWithChildren.java new file mode 100644 index 0000000000..cad33e242f --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbarWithChildren.java @@ -0,0 +1,92 @@ +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.Notification; +import com.vaadin.ui.Table; +import com.vaadin.ui.TreeTable; + +public class TreeTableExtraScrollbarWithChildren extends TestBase { + + @Override + protected String getDescription() { + return "Arrow calculation should not cause a horizontal scrollbar" + + " if there is enough space for the final contents."; + } + + @Override + protected Integer getTicketNumber() { + return 10513; + } + + @Override + protected void setup() { + HorizontalLayout layout = new HorizontalLayout(); + layout.setWidth("300px"); + layout.setHeight("300px"); + + final TreeTable table = new TreeTable(); + table.setSizeFull(); + + table.addGeneratedColumn("parameterId", new HierarchyColumnGenerator()); + 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")); + final TestObject parent = new TestObject("name 6", "value 6"); + table.addItem(parent); + table.setFooterVisible(true); + for (int i = 1; i <= 10; ++i) { + TestObject child = new TestObject("name 6-" + i, "value 6-" + i); + table.addItem(child); + table.setParent(child, parent); + } + table.setVisibleColumns(new Object[] { "wordingTextId", "parameterId", + "parameterTypeId" }); + table.setColumnHeaders(new String[] { "", "", "" }); + table.setHierarchyColumn("parameterId"); + + layout.addComponent(table); + + Button button = new Button("Toggle"); + button.setId("button"); + button.addClickListener(new ClickListener() { + + public void buttonClick(ClickEvent event) { + table.setCollapsed(parent, !table.isCollapsed(parent)); + Notification.show("collapsed: " + table.isCollapsed(parent)); + } + }); + + addComponent(layout); + addComponent(button); + } + + private class HierarchyColumnGenerator implements Table.ColumnGenerator { + public Object generateCell(Table table, Object itemId, Object columnId) { + Label label = new Label("this should be mostly hidden"); + label.setSizeUndefined(); + return label; + } + } + + 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; + } + } + +} |