aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/automatedtests/featurebrowser/EmbeddedBrowserExample.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/featurebrowser/EmbeddedBrowserExample.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/featurebrowser/EmbeddedBrowserExample.java')
-rw-r--r--src/com/itmill/toolkit/automatedtests/featurebrowser/EmbeddedBrowserExample.java74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/automatedtests/featurebrowser/EmbeddedBrowserExample.java b/src/com/itmill/toolkit/automatedtests/featurebrowser/EmbeddedBrowserExample.java
new file mode 100644
index 0000000000..2134c8cff3
--- /dev/null
+++ b/src/com/itmill/toolkit/automatedtests/featurebrowser/EmbeddedBrowserExample.java
@@ -0,0 +1,74 @@
+/*
+@ITMillApache2LicenseForJavaFiles@
+ */
+
+package com.itmill.toolkit.automatedtests.featurebrowser;
+
+import com.itmill.toolkit.data.Property.ValueChangeEvent;
+import com.itmill.toolkit.terminal.ExternalResource;
+import com.itmill.toolkit.ui.Embedded;
+import com.itmill.toolkit.ui.ExpandLayout;
+import com.itmill.toolkit.ui.Select;
+
+/**
+ * Demonstrates the use of Embedded and "suggesting" Select by creating a simple
+ * web-browser. Note: does not check for recursion.
+ *
+ * @author IT Mill Ltd.
+ * @see com.itmill.toolkit.ui.Window
+ */
+public class EmbeddedBrowserExample extends ExpandLayout implements
+ Select.ValueChangeListener {
+
+ // Default URL to open.
+ private static final String DEFAULT_URL = "http://www.itmill.com/index_itmill_toolkit.htm";
+
+ // The embedded page
+ Embedded emb = new Embedded();
+
+ public EmbeddedBrowserExample() {
+ this(new String[] { DEFAULT_URL,
+ "http://www.itmill.com/index_developers.htm",
+ "http://toolkit.itmill.com/demo/doc/api/",
+ "http://www.itmill.com/manual/index.html" });
+ }
+
+ public EmbeddedBrowserExample(String[] urls) {
+ setSizeFull();
+
+ // create the address combobox
+ final Select select = new Select();
+ // allow input
+ select.setNewItemsAllowed(true);
+ // no empty selection
+ select.setNullSelectionAllowed(false);
+ // no 'go' -button clicking necessary
+ select.setImmediate(true);
+ // add some pre-configured URLs
+ for (int i = 0; i < urls.length; i++) {
+ select.addItem(urls[i]);
+ }
+ // add to layout
+ addComponent(select);
+ // add listener and select initial URL
+ select.addListener(this);
+ select.setValue(urls[0]);
+
+ // configure the embedded and add to layout
+ emb.setType(Embedded.TYPE_BROWSER);
+ addComponent(emb);
+ // make the embedded as large as possible
+ expand(emb);
+
+ }
+
+ public void valueChange(ValueChangeEvent event) {
+ final String url = (String) event.getProperty().getValue();
+ if (url != null) {
+ // the selected url has changed, let's go there
+ emb.setSource(new ExternalResource(url));
+ }
+
+ }
+
+}