aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/automatedtests/ComponentsInTable.java
diff options
context:
space:
mode:
authorJani Laakso <jani.laakso@itmill.com>2008-04-07 15:38:15 +0000
committerJani Laakso <jani.laakso@itmill.com>2008-04-07 15:38:15 +0000
commitf51577b7567821f8bb13ecaa60eb101f708e6147 (patch)
tree10cef62ed79d94aba6e83d76f0b753f1f3cc1410 /src/com/itmill/toolkit/automatedtests/ComponentsInTable.java
parent638fe9899be27b8f4f92dc4750f813c1210ecb1f (diff)
downloadvaadin-framework-f51577b7567821f8bb13ecaa60eb101f708e6147.tar.gz
vaadin-framework-f51577b7567821f8bb13ecaa60eb101f708e6147.zip
Created com.itmill.toolkit.automatedtests package which contains "official" automated tests
* do not touch them unless you change automated test client's testcase scripts too. * copy your testing application to package com.itmill.toolkit.automatedtests * do not point to "development / testing / production" packages which are edited in the future without relation to testing * use setDebugId's for all components that are used in testing Moved few classes from "experimental" com.itmill.toolkit.tests package into "official" side. Copied featurebrowser to automatedtests package and added setDebugId's for most components that are used in the testing. svn changeset:4138/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/automatedtests/ComponentsInTable.java')
-rw-r--r--src/com/itmill/toolkit/automatedtests/ComponentsInTable.java74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/automatedtests/ComponentsInTable.java b/src/com/itmill/toolkit/automatedtests/ComponentsInTable.java
new file mode 100644
index 0000000000..619b54bdb7
--- /dev/null
+++ b/src/com/itmill/toolkit/automatedtests/ComponentsInTable.java
@@ -0,0 +1,74 @@
+/*
+@ITMillApache2LicenseForJavaFiles@
+ */
+
+package com.itmill.toolkit.automatedtests;
+
+import java.util.Date;
+import java.util.Vector;
+
+import com.itmill.toolkit.ui.Button;
+import com.itmill.toolkit.ui.CustomComponent;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Table;
+import com.itmill.toolkit.ui.Button.ClickEvent;
+
+public class ComponentsInTable extends CustomComponent {
+
+ public ComponentsInTable(int cols, int rows) {
+ final OrderedLayout main = new OrderedLayout();
+ setCompositionRoot(main);
+
+ main.addComponent(getTestTable(cols, rows));
+ }
+
+ public static Table getTestTable(int cols, int rows) {
+ final Table t = new Table();
+ t.setColumnCollapsingAllowed(true);
+ for (int i = 0; i < cols; i++) {
+ t.addContainerProperty(testString[i], String.class, "");
+ }
+ t.addContainerProperty("button", Button.class, null);
+ for (int i = 0; i < rows; i++) {
+ final Vector content = new Vector();
+ for (int j = 0; j < cols; j++) {
+ content.add(rndString());
+ }
+ content.add(new Button("b" + i, new Button.ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ Button b = event.getButton();
+ System.out.println(event.getButton().getCaption()
+ + " click: " + (new Date()).toGMTString());
+ System.out.println(event.getButton().getApplication());
+
+ }
+ }));
+ t.addItem(content.toArray(), "" + i);
+ }
+ t.setRowHeaderMode(Table.ROW_HEADER_MODE_ID);
+ return t;
+ }
+
+ static String[] testString = new String[] { "Jacob", "Michael", "Joshua",
+ "Matthew", "Ethan", "Andrew", "Daniel", "Anthony", "Christopher",
+ "Joseph", "William", "Alexander", "Ryan", "David", "Nicholas",
+ "Tyler", "James", "John", "Jonathan", "Nathan", "Samuel",
+ "Christian", "Noah", "Dylan", "Benjamin", "Logan", "Brandon",
+ "Gabriel", "Zachary", "Jose", "Elijah", "Angel", "Kevin", "Jack",
+ "Caleb", "Justin", "Austin", "Evan", "Robert", "Thomas", "Luke",
+ "Mason", "Aidan", "Jackson", "Isaiah", "Jordan", "Gavin", "Connor",
+ "Aiden", "Isaac", "Jason", "Cameron", "Hunter", "Jayden", "Juan",
+ "Charles", "Aaron", "Lucas", "Luis", "Owen", "Landon", "Diego",
+ "Brian", "Adam", "Adrian", "Kyle", "Eric", "Ian", "Nathaniel",
+ "Carlos", "Alex", "Bryan", "Jesus", "Julian", "Sean", "Carter",
+ "Hayden", "Jeremiah", "Cole", "Brayden", "Wyatt", "Chase",
+ "Steven", "Timothy", "Dominic", "Sebastian", "Xavier", "Jaden",
+ "Jesse", "Devin", "Seth", "Antonio", "Richard", "Miguel", "Colin",
+ "Cody", "Alejandro", "Caden", "Blake", "Carson" };
+
+ public static String rndString() {
+ return testString[(int) (Math.random() * testString.length)];
+ }
+
+}