diff options
author | Jani Laakso <jani.laakso@itmill.com> | 2008-04-07 15:38:15 +0000 |
---|---|---|
committer | Jani Laakso <jani.laakso@itmill.com> | 2008-04-07 15:38:15 +0000 |
commit | f51577b7567821f8bb13ecaa60eb101f708e6147 (patch) | |
tree | 10cef62ed79d94aba6e83d76f0b753f1f3cc1410 /src/com/itmill/toolkit/automatedtests/featurebrowser/ComboBoxExample.java | |
parent | 638fe9899be27b8f4f92dc4750f813c1210ecb1f (diff) | |
download | vaadin-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/featurebrowser/ComboBoxExample.java')
-rw-r--r-- | src/com/itmill/toolkit/automatedtests/featurebrowser/ComboBoxExample.java | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/automatedtests/featurebrowser/ComboBoxExample.java b/src/com/itmill/toolkit/automatedtests/featurebrowser/ComboBoxExample.java new file mode 100644 index 0000000000..03271a98e3 --- /dev/null +++ b/src/com/itmill/toolkit/automatedtests/featurebrowser/ComboBoxExample.java @@ -0,0 +1,73 @@ +/* +@ITMillApache2LicenseForJavaFiles@ + */ + +package com.itmill.toolkit.automatedtests.featurebrowser; + +import java.util.Random; + +import com.itmill.toolkit.ui.ComboBox; +import com.itmill.toolkit.ui.CustomComponent; +import com.itmill.toolkit.ui.OrderedLayout; +import com.itmill.toolkit.ui.AbstractSelect.Filtering; + +/** + * + */ +public class ComboBoxExample extends CustomComponent { + + private static final String[] firstnames = new String[] { "John", "Mary", + "Joe", "Sarah", "Jeff", "Jane", "Peter", "Marc", "Robert", "Paula", + "Lenny", "Kenny", "Nathan", "Nicole", "Laura", "Jos", "Josie", + "Linus" }; + + private static final String[] lastnames = new String[] { "Torvalds", + "Smith", "Adams", "Black", "Wilson", "Richards", "Thompson", + "McGoff", "Halas", "Jones", "Beck", "Sheridan", "Picard", "Hill", + "Fielding", "Einstein" }; + + public ComboBoxExample() { + final OrderedLayout main = new OrderedLayout(); + main.setMargin(true); + setCompositionRoot(main); + + // starts-with filter + final ComboBox s1 = new ComboBox("Select with starts-with filter"); + s1.setDebugId("ComboBoxStartFilter"); + s1.setFilteringMode(Filtering.FILTERINGMODE_STARTSWITH); + s1.setColumns(20); + Random r = new Random(5); + for (int i = 0; i < 105; i++) { + s1 + .addItem(firstnames[(int) (r.nextDouble() * (firstnames.length - 1))] + + " " + + lastnames[(int) (r.nextDouble() * (lastnames.length - 1))]); + } + s1.setImmediate(true); + main.addComponent(s1); + + // contains filter + final ComboBox s2 = new ComboBox("Select with contains filter"); + s2.setDebugId("ComboBoxContainsFilter"); + s2.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS); + s2.setColumns(20); + for (int i = 0; i < 500; i++) { + s2 + .addItem(firstnames[(int) (r.nextDouble() * (firstnames.length - 1))] + + " " + + lastnames[(int) (r.nextDouble() * (lastnames.length - 1))]); + } + s2.setImmediate(true); + main.addComponent(s2); + + // initially empty + final ComboBox s3 = new ComboBox("Initially empty; enter your own"); + s3.setDebugId("EmptyComboBox"); + s3.setColumns(20); + s3.setImmediate(true); + s3.setNewItemsAllowed(true); + main.addComponent(s3); + + } + +} |