aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarko Grönroos <magi@iki.fi>2008-08-29 10:46:59 +0000
committerMarko Grönroos <magi@iki.fi>2008-08-29 10:46:59 +0000
commit26a5b04e606c36b57d870a2b4b0f0eb71d7a0cd7 (patch)
tree6a77fe26a49543fdb4824ce5539138f8a47059cd
parent86963f5d438db623b6cbec97c0dd822c213321a2 (diff)
downloadvaadin-framework-26a5b04e606c36b57d870a2b4b0f0eb71d7a0cd7.tar.gz
vaadin-framework-26a5b04e606c36b57d870a2b4b0f0eb71d7a0cd7.zip
Reformatted window opener example code.
svn changeset:5300/svn branch:trunk
-rw-r--r--src/com/itmill/toolkit/tests/book/WindowOpener.java29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/com/itmill/toolkit/tests/book/WindowOpener.java b/src/com/itmill/toolkit/tests/book/WindowOpener.java
index b37d28108d..5e5f673fa7 100644
--- a/src/com/itmill/toolkit/tests/book/WindowOpener.java
+++ b/src/com/itmill/toolkit/tests/book/WindowOpener.java
@@ -12,22 +12,25 @@ import com.itmill.toolkit.ui.Window;
import com.itmill.toolkit.ui.Window.CloseEvent;
/** Component contains a button that allows opening a window. */
-public class WindowOpener extends CustomComponent implements
- Window.CloseListener {
- Window mainwindow; // Reference to main window
- Window mywindow; // The window to be opened
- Button openbutton; // Button for opening the window
+public class WindowOpener extends CustomComponent
+ implements Window.CloseListener {
+ Window mainwindow; // Reference to main window
+ Window mywindow; // The window to be opened
+ Button openbutton; // Button for opening the window
Button closebutton; // A button in the window
- Label explanation; // A descriptive text
+ Label explanation; // A descriptive text
public WindowOpener(String label, Window main) {
mainwindow = main;
/* The component consists of a button that opens the window. */
final OrderedLayout layout = new OrderedLayout();
- layout.addComponent(openbutton = new Button("Open Window", this,
- "openButtonClick"));
- layout.addComponent(explanation = new Label("Explanation"));
+
+ openbutton = new Button("Open Window", this, "openButtonClick");
+ explanation = new Label("Explanation");
+ layout.addComponent(openbutton);
+ layout.addComponent(explanation);
+
setCompositionRoot(layout);
}
@@ -35,6 +38,11 @@ public class WindowOpener extends CustomComponent implements
public void openButtonClick(Button.ClickEvent event) {
/* Create a new window. */
mywindow = new Window("My Dialog");
+ mywindow.setPositionX(200);
+ mywindow.setPositionY(100);
+
+ /* Add the window inside the main window. */
+ mainwindow.addWindow(mywindow);
/* Listen for close events for the window. */
mywindow.addListener(this);
@@ -44,9 +52,6 @@ public class WindowOpener extends CustomComponent implements
closebutton = new Button("Close", this, "closeButtonClick");
mywindow.addComponent(closebutton);
- /* Add the window inside the main window. */
- mainwindow.addWindow(mywindow);
-
/* Allow opening only one window at a time. */
openbutton.setEnabled(false);