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/WindowingExample.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/WindowingExample.java')
-rw-r--r-- | src/com/itmill/toolkit/automatedtests/featurebrowser/WindowingExample.java | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/automatedtests/featurebrowser/WindowingExample.java b/src/com/itmill/toolkit/automatedtests/featurebrowser/WindowingExample.java new file mode 100644 index 0000000000..9da87d87a6 --- /dev/null +++ b/src/com/itmill/toolkit/automatedtests/featurebrowser/WindowingExample.java @@ -0,0 +1,104 @@ +/*
+@ITMillApache2LicenseForJavaFiles@
+ */
+
+package com.itmill.toolkit.automatedtests.featurebrowser;
+
+import java.net.URL;
+
+import com.itmill.toolkit.terminal.ExternalResource;
+import com.itmill.toolkit.ui.Button;
+import com.itmill.toolkit.ui.CustomComponent;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Window;
+import com.itmill.toolkit.ui.Button.ClickEvent;
+
+/**
+ * @author marc
+ *
+ */
+public class WindowingExample extends CustomComponent {
+
+ public static final String txt = "<p>There are two main types of windows: application-level windows, and"
+ + "\"subwindows\". </p><p> A subwindow is rendered as a \"inline\" popup window"
+ + " within the (native) browser window to which it was added. You can create"
+ + " a subwindow by creating a new Window and adding it to a application-level window, for instance"
+ + " your main window. </p><p> In contrast, you create a application-level window by"
+ + " creating a new Window and adding it to the Application. Application-level"
+ + " windows are not shown by default - you need to open a browser window for"
+ + " the url representing the window. You can think of the application-level"
+ + " windows as separate views into your application - and a way to create a"
+ + " \"native\" browser window. </p><p> Depending on your needs, it's also"
+ + " possible to create a new window instance (with it's own internal state)"
+ + " for each new (native) browser window, or you can share the same instance"
+ + " (and state) between several browser windows (the latter is most useful"
+ + " for read-only views).</p>";
+
+ private URL windowUrl = null;
+
+ public WindowingExample() {
+ final OrderedLayout main = new OrderedLayout();
+ main.setMargin(true);
+ setCompositionRoot(main);
+
+ final Label l = new Label(txt);
+ l.setContentMode(Label.CONTENT_XHTML);
+ main.addComponent(l);
+
+ main.addComponent(new Button("Create a new subwindow",
+ new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ final Window w = new Window("Subwindow");
+ final Label l = new Label(txt);
+ l.setContentMode(Label.CONTENT_XHTML);
+ w.addComponent(l);
+ getApplication().getMainWindow().addWindow(w);
+ }
+ }));
+ main.addComponent(new Button("Create a new modal window",
+ new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ final Window w = new Window("Modal window");
+ w.setModal(true);
+ final Label l = new Label(txt);
+ l.setContentMode(Label.CONTENT_XHTML);
+ w.addComponent(l);
+ getApplication().getMainWindow().addWindow(w);
+ }
+ }));
+ main.addComponent(new Button(
+ "Open a application-level window, with shared state",
+ new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ if (windowUrl == null) {
+ final Window w = new Window("Subwindow");
+ final Label l = new Label(txt);
+ l.setContentMode(Label.CONTENT_XHTML);
+ w.addComponent(l);
+ getApplication().addWindow(w);
+ windowUrl = w.getURL();
+ }
+ getApplication().getMainWindow().open(
+ new ExternalResource(windowUrl), "_new");
+ }
+ }));
+ main.addComponent(new Button(
+ "Create a new application-level window, with it's own state",
+ new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ final Window w = new Window("Subwindow");
+ getApplication().addWindow(w);
+ final Label l = new Label(
+ "Each opened window has its own"
+ + " name, and is accessed trough its own uri.");
+ l.setCaption("Window " + w.getName());
+ w.addComponent(l);
+ getApplication().getMainWindow().open(
+ new ExternalResource(w.getURL()), "_new");
+ }
+ }));
+
+ }
+
+}
|