]> source.dussan.org Git - vaadin-framework.git/commitdiff
Reformatted window opener example code.
authorMarko Grönroos <magi@iki.fi>
Fri, 29 Aug 2008 10:46:59 +0000 (10:46 +0000)
committerMarko Grönroos <magi@iki.fi>
Fri, 29 Aug 2008 10:46:59 +0000 (10:46 +0000)
svn changeset:5300/svn branch:trunk

src/com/itmill/toolkit/tests/book/WindowOpener.java

index b37d28108dda854b50335bb76a41eff467c80a0e..5e5f673fa7c427b79e17196f17c8ef5f8e06ccda 100644 (file)
@@ -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);