Some changes to help testing tools testing with FeatureBrowser

svn changeset:3387/svn branch:trunk
This commit is contained in:
Matti Tahvonen 2008-01-07 12:48:26 +00:00
parent 4a0b5b2ea8
commit cf3b3594e1
4 changed files with 18 additions and 7 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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));
}

View File

@ -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