aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/tests/magi/TableExample.java
diff options
context:
space:
mode:
authorMarko Grönroos <magi@iki.fi>2008-05-29 13:21:45 +0000
committerMarko Grönroos <magi@iki.fi>2008-05-29 13:21:45 +0000
commit8acbce77cb67017dd3efd51a8d8c76202383b086 (patch)
treee774b83bed3e5c2f8b98d165bb974b839db5d835 /src/com/itmill/toolkit/tests/magi/TableExample.java
parentd410369e22e1887f5ade7d946d38e70243a0aa68 (diff)
downloadvaadin-framework-8acbce77cb67017dd3efd51a8d8c76202383b086.tar.gz
vaadin-framework-8acbce77cb67017dd3efd51a8d8c76202383b086.zip
Renamed manual related testbench.
svn changeset:4697/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/tests/magi/TableExample.java')
-rw-r--r--src/com/itmill/toolkit/tests/magi/TableExample.java72
1 files changed, 0 insertions, 72 deletions
diff --git a/src/com/itmill/toolkit/tests/magi/TableExample.java b/src/com/itmill/toolkit/tests/magi/TableExample.java
deleted file mode 100644
index f600f6b788..0000000000
--- a/src/com/itmill/toolkit/tests/magi/TableExample.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-@ITMillApache2LicenseForJavaFiles@
- */
-
-package com.itmill.toolkit.tests.magi;
-
-import com.itmill.toolkit.data.Property;
-import com.itmill.toolkit.data.Property.ValueChangeEvent;
-import com.itmill.toolkit.ui.CustomComponent;
-import com.itmill.toolkit.ui.Label;
-import com.itmill.toolkit.ui.OrderedLayout;
-import com.itmill.toolkit.ui.Table;
-
-public class TableExample extends CustomComponent {
- /* Create the table with a caption. */
- Table table = new Table("This is my Table");
-
- /* A layout needed for the example. */
- OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
-
- /* Feedback for selecting items from the table. */
- Label current = new Label("Selected: -");
-
- TableExample() {
- setCompositionRoot(layout);
- layout.addComponent(table);
-
- /* Define the names, data types, and default values of columns. */
- table.addContainerProperty("First Name", String.class,
- "(no first name)");
- table.addContainerProperty("Last Name", String.class, "(no last name)");
- table.addContainerProperty("Year", Integer.class, null);
-
- /* We use these entries to generate random items in a table. */
- final String[] firstnames = new String[] { "Donald", "Patty", "Sally",
- "Douglas" };
- final String[] lastnames = new String[] { "Smith", "Jones", " Adams",
- "Knuth" };
-
- /* Add some items in the table and assign them an Item ID (IID). */
- for (int i = 0; i < 500; i++) {
- /* Add a randomly generated item in the Table. */
- table.addItem(new Object[] {
- firstnames[(int) (Math.random() * (firstnames.length - 0.01))],
- lastnames[(int) (Math.random() * (lastnames.length - 0.01))],
- new Integer((int) (1900 + Math.random() * 100)) },
- new Integer(i));
- }
-
- /* Set the number of items visible in the table. */
- table.setPageLength(10);
-
- /* Enable some UI features for the table. */
- table.setColumnReorderingAllowed(true);
- table.setColumnCollapsingAllowed(true);
-
- /* Allow selecting items from the table. */
- table.setSelectable(true);
-
- /* When an item is selected, the selection is sent immediately to server. */
- table.setImmediate(true);
-
- /* Handle selection change. */
- table.addListener(new Property.ValueChangeListener() {
- public void valueChange(ValueChangeEvent event) {
- current.setValue("Selected: " + table.getValue().toString());
- }
- });
-
- layout.addComponent(current);
- }
-}