diff options
Diffstat (limited to 'src/com/itmill/toolkit/automatedtests/featurebrowser/WindowingExample.java')
-rw-r--r-- | src/com/itmill/toolkit/automatedtests/featurebrowser/WindowingExample.java | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/src/com/itmill/toolkit/automatedtests/featurebrowser/WindowingExample.java b/src/com/itmill/toolkit/automatedtests/featurebrowser/WindowingExample.java index 9da87d87a6..6c46853dca 100644 --- a/src/com/itmill/toolkit/automatedtests/featurebrowser/WindowingExample.java +++ b/src/com/itmill/toolkit/automatedtests/featurebrowser/WindowingExample.java @@ -10,7 +10,7 @@ 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.VerticalLayout;
import com.itmill.toolkit.ui.Window;
import com.itmill.toolkit.ui.Button.ClickEvent;
@@ -20,16 +20,16 @@ import com.itmill.toolkit.ui.Button.ClickEvent; */
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"
+ public static final String txt = "<p>There are two main types of windows: application-level windows, and "
+ + "\"sub windows\".</p><p>A sub window 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"
+ + " a sub window 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"
+ + " \"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"
@@ -38,7 +38,7 @@ public class WindowingExample extends CustomComponent { private URL windowUrl = null;
public WindowingExample() {
- final OrderedLayout main = new OrderedLayout();
+ final VerticalLayout main = new VerticalLayout();
main.setMargin(true);
setCompositionRoot(main);
@@ -46,29 +46,33 @@ public class WindowingExample extends CustomComponent { l.setContentMode(Label.CONTENT_XHTML);
main.addComponent(l);
- main.addComponent(new Button("Create a new subwindow",
+ Button b = new Button("Create a new subwindow",
new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
final Window w = new Window("Subwindow");
+ w.setWidth("50%");
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",
+ });
+ b.setStyleName(Button.STYLE_LINK);
+ main.addComponent(b);
+ b = new Button("Create a new modal window", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ final Window w = new Window("Modal window");
+ w.setWidth("50%");
+ w.setModal(true);
+ final Label l = new Label(txt);
+ l.setContentMode(Label.CONTENT_XHTML);
+ w.addComponent(l);
+ getApplication().getMainWindow().addWindow(w);
+ }
+ });
+ b.setStyleName(Button.STYLE_LINK);
+ main.addComponent(b);
+ b = new Button("Open a application-level window, with shared state",
new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
if (windowUrl == null) {
@@ -82,8 +86,10 @@ public class WindowingExample extends CustomComponent { getApplication().getMainWindow().open(
new ExternalResource(windowUrl), "_new");
}
- }));
- main.addComponent(new Button(
+ });
+ b.setStyleName(Button.STYLE_LINK);
+ main.addComponent(b);
+ b = new Button(
"Create a new application-level window, with it's own state",
new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
@@ -97,7 +103,9 @@ public class WindowingExample extends CustomComponent { getApplication().getMainWindow().open(
new ExternalResource(w.getURL()), "_new");
}
- }));
+ });
+ b.setStyleName(Button.STYLE_LINK);
+ main.addComponent(b);
}
|