aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/table/ModifyContainerProperty.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-08-30 17:24:36 +0300
committerArtur Signell <artur@vaadin.com>2012-08-30 17:24:36 +0300
commit7b25b3886ea95bc6495506fbe9472e45fcbde684 (patch)
tree0b93cb65dab437feb46720659a63b8f1ef48f7f4 /uitest/src/com/vaadin/tests/components/table/ModifyContainerProperty.java
parent8941056349e302e687e40e94c13709e75f256d73 (diff)
downloadvaadin-framework-7b25b3886ea95bc6495506fbe9472e45fcbde684.tar.gz
vaadin-framework-7b25b3886ea95bc6495506fbe9472e45fcbde684.zip
Renamed tests -> uitest and tests/testbench -> uitest/src (#9299)
Diffstat (limited to 'uitest/src/com/vaadin/tests/components/table/ModifyContainerProperty.java')
-rw-r--r--uitest/src/com/vaadin/tests/components/table/ModifyContainerProperty.java62
1 files changed, 62 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/table/ModifyContainerProperty.java b/uitest/src/com/vaadin/tests/components/table/ModifyContainerProperty.java
new file mode 100644
index 0000000000..00965220db
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/ModifyContainerProperty.java
@@ -0,0 +1,62 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Table;
+
+@SuppressWarnings("serial")
+public class ModifyContainerProperty extends TestBase {
+
+ private Table table = new Table();
+ private IndexedContainer ic = new IndexedContainer();
+
+ @Override
+ protected void setup() {
+ addComponent(table);
+
+ ic.addContainerProperty("one", String.class, "one");
+ ic.addContainerProperty("two", String.class, "two");
+
+ ic.addItem("foo");
+
+ ic.getContainerProperty("foo", "one").setValue("bar");
+ ic.getContainerProperty("foo", "two").setValue("baz");
+
+ table.setContainerDataSource(ic);
+ addComponent(new Button("Remove container property",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(com.vaadin.ui.Button.ClickEvent arg0) {
+ ic.removeContainerProperty("one");
+ }
+ }));
+ addComponent(new Button("Add container property",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(com.vaadin.ui.Button.ClickEvent arg0) {
+ boolean added = ic.addContainerProperty("three",
+ String.class, "three");
+ if (added) {
+ Object[] current = table.getVisibleColumns();
+ Object[] vis = new Object[current.length + 1];
+ for (int i = 0; i < current.length; i++) {
+ vis[i] = current[i];
+ }
+ vis[current.length] = "three";
+ table.setVisibleColumns(vis);
+ }
+ }
+ }));
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Clicking on \"Add container property\" adds a property to the container and sets it visible. The table should then show a \"three\" column in addition to the others. Clicking on \"Remove container property\" should remove column \"two\" from the table.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 3165;
+ }
+}