diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-05-23 08:06:06 +0000 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-05-23 08:06:06 +0000 |
commit | e8a652c91e9e02079180a854789afd5accffce7b (patch) | |
tree | 79524e7841167ac662ff6e5bc4c4480a6d46d48d /tests | |
parent | e8844544fcf3f62e9b8a9226e235b90a7106d881 (diff) | |
download | vaadin-framework-e8a652c91e9e02079180a854789afd5accffce7b.tar.gz vaadin-framework-e8a652c91e9e02079180a854789afd5accffce7b.zip |
Table: Make some columns uncollapsable (#7495)
svn changeset:23811/svn branch:6.8
Diffstat (limited to 'tests')
3 files changed, 176 insertions, 0 deletions
diff --git a/tests/testbench/com/vaadin/tests/components/table/TableWithNoncollapsibleColumns.html b/tests/testbench/com/vaadin/tests/components/table/TableWithNoncollapsibleColumns.html new file mode 100644 index 0000000000..e3c9a8423b --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/TableWithNoncollapsibleColumns.html @@ -0,0 +1,82 @@ +<?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>TableWithNoncollapsibleColumns</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">TableWithNoncollapsibleColumns</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.table.TableWithNoncollapsibleColumns?restartApplication</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableTableWithNoncollapsibleColumns::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>column-3-collapsed</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableTableWithNoncollapsibleColumns::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>column-3-noncollapsible</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableTableWithNoncollapsibleColumns::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableTableWithNoncollapsibleColumns::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableTableWithNoncollapsibleColumns::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableTableWithNoncollapsibleColumns::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[0]/domChild[1]</td> + <td>9,7</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>column-menu-after-collapsing-all-columns</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableTableWithNoncollapsibleColumns::Root/VContextMenu[0]#option2</td> + <td>93,4</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableTableWithNoncollapsibleColumns::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[0]/domChild[1]</td> + <td>7,10</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>column-menu-after-expanding-column-2</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/testbench/com/vaadin/tests/components/table/TableWithNoncollapsibleColumns.java b/tests/testbench/com/vaadin/tests/components/table/TableWithNoncollapsibleColumns.java new file mode 100644 index 0000000000..9e8c201452 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/TableWithNoncollapsibleColumns.java @@ -0,0 +1,83 @@ +package com.vaadin.tests.components.table; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Table; +import com.vaadin.ui.VerticalLayout; + +public class TableWithNoncollapsibleColumns extends TestBase { + + @Override + protected void setup() { + VerticalLayout layout = new VerticalLayout(); + layout.setSizeFull(); + addComponent(layout); + + final Table table = new Table(); + table.setWidth("100%"); + table.setHeight("300px"); + table.setColumnCollapsingAllowed(true); + + table.addContainerProperty("Column 1 - noncollapsible", String.class, + null); + table.addContainerProperty("Column 2 - collapsible", String.class, null); + table.addContainerProperty("Column 3 - toggle collapsing", + String.class, null); + + table.setColumnNoncollapsible("Column 1 - noncollapsible", true); + layout.addComponent(table); + + final Button button1 = new Button("Column 1: collapse/show", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + table.setColumnCollapsed( + "Column 1 - noncollapsible", + !table.isColumnCollapsed("Column 1 - noncollapsible")); + } + }); + final Button button2 = new Button("Column 2: collapse/show", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + table.setColumnCollapsed( + "Column 2 - collapsible", + !table.isColumnCollapsed("Column 2 - collapsible")); + } + }); + + final Button button3 = new Button("Column 3: collapse/show", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + table.setColumnCollapsed( + "Column 3 - toggle collapsing", + !table.isColumnCollapsed("Column 3 - toggle collapsing")); + } + }); + final Button button4 = new Button( + "Column 3: make noncollapsible/collapsible", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + table.setColumnNoncollapsible( + "Column 3 - toggle collapsing", + !table.isColumnNoncollapsible("Column 3 - toggle collapsing")); + } + }); + + layout.addComponent(button1); + layout.addComponent(button2); + layout.addComponent(button3); + layout.addComponent(button4); + + } + + @Override + protected String getDescription() { + return "Often a table has one column that identifies the row better than any other and it would not make sense to collapse that one. Make it possible from the server side api to disable collapsing for some properties. These properties could appear as grayed out in the collapse drop down menu."; + } + + @Override + protected Integer getTicketNumber() { + return 7495; + } + +} diff --git a/tests/testbench/com/vaadin/tests/components/table/Tables.java b/tests/testbench/com/vaadin/tests/components/table/Tables.java index 3f37a178b6..5c55ea87b2 100644 --- a/tests/testbench/com/vaadin/tests/components/table/Tables.java +++ b/tests/testbench/com/vaadin/tests/components/table/Tables.java @@ -73,6 +73,14 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> } }; + private Command<T, Boolean> columnNonCollapsibleCommand = new Command<T, Boolean>() { + + public void execute(T c, Boolean noncollapsible, Object propertyId) { + c.setColumnNoncollapsible(propertyId, noncollapsible); + + } + }; + protected Command<T, Boolean> columnResizeListenerCommand = new Command<T, Boolean>() { public void execute(Table c, Boolean value, Object data) { @@ -644,6 +652,9 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> createSelectAction("Expand ratio", category, expandOptions, "- remove -", columnExpandRatioCommand, propertyId); t.log("Expand"); + createBooleanAction("Noncollapsible", category, false, + columnNonCollapsibleCommand, propertyId); + // Footer text (move) // Header text (move) |