aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2008-01-07 12:48:26 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2008-01-07 12:48:26 +0000
commitcf3b3594e1d02fa2f5ab591a94c65a0611ba1ff3 (patch)
tree2c0a7d171b281ddbdd17ff9313c4dfcb7fdc4540 /src
parent4a0b5b2ea8a437bcf27689c5024266aefd2ceb09 (diff)
downloadvaadin-framework-cf3b3594e1d02fa2f5ab591a94c65a0611ba1ff3.tar.gz
vaadin-framework-cf3b3594e1d02fa2f5ab591a94c65a0611ba1ff3.zip
Some changes to help testing tools testing with FeatureBrowser
svn changeset:3387/svn branch:trunk
Diffstat (limited to 'src')
-rw-r--r--src/com/itmill/toolkit/demo/featurebrowser/ComboBoxExample.java11
-rw-r--r--src/com/itmill/toolkit/demo/featurebrowser/FeatureBrowser.java3
-rw-r--r--src/com/itmill/toolkit/demo/featurebrowser/TableExample.java10
-rw-r--r--src/com/itmill/toolkit/demo/featurebrowser/TreeExample.java1
4 files changed, 18 insertions, 7 deletions
diff --git a/src/com/itmill/toolkit/demo/featurebrowser/ComboBoxExample.java b/src/com/itmill/toolkit/demo/featurebrowser/ComboBoxExample.java
index b7a02f3161..df8fa688d7 100644
--- a/src/com/itmill/toolkit/demo/featurebrowser/ComboBoxExample.java
+++ b/src/com/itmill/toolkit/demo/featurebrowser/ComboBoxExample.java
@@ -4,6 +4,8 @@
package com.itmill.toolkit.demo.featurebrowser;
+import java.util.Random;
+
import com.itmill.toolkit.ui.ComboBox;
import com.itmill.toolkit.ui.CustomComponent;
import com.itmill.toolkit.ui.OrderedLayout;
@@ -33,11 +35,12 @@ public class ComboBoxExample extends CustomComponent {
final ComboBox s1 = new ComboBox("Select with starts-with filter");
s1.setFilteringMode(Filtering.FILTERINGMODE_STARTSWITH);
s1.setColumns(20);
+ Random r = new Random(5);
for (int i = 0; i < 105; i++) {
s1
- .addItem(firstnames[(int) (Math.random() * (firstnames.length - 1))]
+ .addItem(firstnames[(int) (r.nextDouble() * (firstnames.length - 1))]
+ " "
- + lastnames[(int) (Math.random() * (lastnames.length - 1))]);
+ + lastnames[(int) (r.nextDouble() * (lastnames.length - 1))]);
}
s1.setImmediate(true);
main.addComponent(s1);
@@ -48,9 +51,9 @@ public class ComboBoxExample extends CustomComponent {
s2.setColumns(20);
for (int i = 0; i < 500; i++) {
s2
- .addItem(firstnames[(int) (Math.random() * (firstnames.length - 1))]
+ .addItem(firstnames[(int) (r.nextDouble() * (firstnames.length - 1))]
+ " "
- + lastnames[(int) (Math.random() * (lastnames.length - 1))]);
+ + lastnames[(int) (r.nextDouble() * (lastnames.length - 1))]);
}
s2.setImmediate(true);
main.addComponent(s2);
diff --git a/src/com/itmill/toolkit/demo/featurebrowser/FeatureBrowser.java b/src/com/itmill/toolkit/demo/featurebrowser/FeatureBrowser.java
index 81cd281ae2..e55acf1ddc 100644
--- a/src/com/itmill/toolkit/demo/featurebrowser/FeatureBrowser.java
+++ b/src/com/itmill/toolkit/demo/featurebrowser/FeatureBrowser.java
@@ -103,6 +103,7 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
};
public void init() {
+
// Need to set a theme for ThemeResources to work
setTheme("example");
@@ -143,6 +144,7 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
}
tree = new Tree();
+ tree.setDebugId("PID_S_menu");
tree.setSelectable(true);
tree.setMultiSelect(false);
tree.setNullSelectionAllowed(false);
@@ -243,6 +245,7 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
OrderedLayout.ALIGNMENT_TOP);
ts = new TabSheet();
+ ts.setDebugId("PIS_S_TS");
ts.getSize().setSizeFull();
ts.addTab(new Label(""), "Choose example", null);
exp.addComponent(ts);
diff --git a/src/com/itmill/toolkit/demo/featurebrowser/TableExample.java b/src/com/itmill/toolkit/demo/featurebrowser/TableExample.java
index 94674ace8c..c71513cf49 100644
--- a/src/com/itmill/toolkit/demo/featurebrowser/TableExample.java
+++ b/src/com/itmill/toolkit/demo/featurebrowser/TableExample.java
@@ -5,6 +5,7 @@
package com.itmill.toolkit.demo.featurebrowser;
import java.util.Iterator;
+import java.util.Random;
import java.util.Set;
import com.itmill.toolkit.data.Item;
@@ -56,6 +57,7 @@ public class TableExample extends CustomComponent implements Action.Handler,
// "source" table with bells & whistlesenabled
source = new Table("All creatures");
+ source.setDebugId("PID_S_ALLC");
source.setPageLength(7);
source.getSize().setWidth(550);
source.setColumnCollapsingAllowed(true);
@@ -142,10 +144,12 @@ public class TableExample extends CustomComponent implements Action.Handler,
final String[] ki = new String[] { "Jumping", "Walking", "Sleeping",
"Skipping", "Dancing" };
+ Random r = new Random(5);
+
for (int i = 0; i < 100; i++) {
- final String s = sp[(int) (Math.random() * sp.length)];
- final String t = ty[(int) (Math.random() * ty.length)];
- final String k = ki[(int) (Math.random() * ki.length)];
+ final String s = sp[(int) (r.nextDouble() * sp.length)];
+ final String t = ty[(int) (r.nextDouble() * ty.length)];
+ final String k = ki[(int) (r.nextDouble() * ki.length)];
table.addItem(new Object[] { s, t, k, Boolean.FALSE }, new Integer(
i));
}
diff --git a/src/com/itmill/toolkit/demo/featurebrowser/TreeExample.java b/src/com/itmill/toolkit/demo/featurebrowser/TreeExample.java
index fb9f0a34ff..ac2c964db8 100644
--- a/src/com/itmill/toolkit/demo/featurebrowser/TreeExample.java
+++ b/src/com/itmill/toolkit/demo/featurebrowser/TreeExample.java
@@ -50,6 +50,7 @@ public class TreeExample extends CustomComponent implements Action.Handler,
p.addComponent(new Label(desc));
// Tree with a few items
tree = new Tree();
+ tree.setDebugId("PID_S_testtree");
tree.setImmediate(true);
// we'll use a property for caption instead of the item id ("value"),
// so that multiple items can have the same caption