]> source.dussan.org Git - vaadin-framework.git/commitdiff
Reverted mass formatting done in [5331] for book examples.
authorMarko Grönroos <magi@iki.fi>
Thu, 4 Sep 2008 08:17:50 +0000 (08:17 +0000)
committerMarko Grönroos <magi@iki.fi>
Thu, 4 Sep 2008 08:17:50 +0000 (08:17 +0000)
svn changeset:5357/svn branch:trunk

18 files changed:
src/com/itmill/toolkit/tests/book/BookTestApplication.java
src/com/itmill/toolkit/tests/book/ChatApplication.java
src/com/itmill/toolkit/tests/book/DefaultButtonExample.java
src/com/itmill/toolkit/tests/book/FormExample.java
src/com/itmill/toolkit/tests/book/FormExample2.java
src/com/itmill/toolkit/tests/book/MyDynamicResource.java
src/com/itmill/toolkit/tests/book/MyUploader.java
src/com/itmill/toolkit/tests/book/SSNField.java
src/com/itmill/toolkit/tests/book/TableCellStyle.java
src/com/itmill/toolkit/tests/book/TableEditable.java
src/com/itmill/toolkit/tests/book/TableEditableBean.java
src/com/itmill/toolkit/tests/book/TableExample.java
src/com/itmill/toolkit/tests/book/TableExample1.java
src/com/itmill/toolkit/tests/book/TableExample2.java
src/com/itmill/toolkit/tests/book/TableExample3.java
src/com/itmill/toolkit/tests/book/TableHuge.java
src/com/itmill/toolkit/tests/book/WindowOpener.java
src/com/itmill/toolkit/tests/book/WindowTestApplication.java

index 4583beb04fa3335b9d6add9598b7e7f60b22b4fe..db84225e0712e776feb5d6b3915898a01ba369da 100644 (file)
@@ -73,38 +73,36 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
     StreamResource strres;
     OrderedLayout ol;
     int getwincount = 0;
-
+    
     public void init() {
         setTheme("tests-book");
-
+        
         setMainWindow(main);
 
         // Demo the use of parameter and URI handlers
         main.addParameterHandler(new MyParameterHandler());
         main.addURIHandler(new MyURIHandler());
-
+        
         MyDynamicResource myresource = new MyDynamicResource();
         main.addParameterHandler(myresource);
         main.addURIHandler(myresource);
 
         main.addURIHandler(new BookTestURIHandler());
     }
-
+    
     class MyParameterHandler implements ParameterHandler {
         public void handleParameters(Map parameters) {
             // Print out the parameters to standard output
             for (Iterator it = parameters.keySet().iterator(); it.hasNext();) {
-                String key = (String) it.next();
+                String key   = (String) it.next();
                 String value = ((String[]) parameters.get(key))[0];
-                System.out.println("Key: " + key + ", value: " + value);
+                System.out.println("Key: "+key+", value: "+value);
             }
         }
     }
-
     class MyURIHandler implements URIHandler {
         public DownloadStream handleURI(URL context, String relativeUri) {
-            System.out.println("Context: " + context.toString()
-                    + ", relative: " + relativeUri);
+            System.out.println("Context: "+context.toString()+", relative: "+relativeUri);
             return null; // Let the Application provide the response
         }
     }
@@ -129,10 +127,10 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
                 final Window child = (Window) cwi.next();
                 main.removeWindow(child);
             }
-
+            
             // The index is listed inside a grid layout
             main.setLayout(new OrderedLayout());
-            GridLayout grid = new GridLayout(4, 4);
+            GridLayout grid = new GridLayout(4,4);
             grid.addStyleName("index");
             main.addComponent(grid);
 
@@ -141,22 +139,19 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
                         "labelcontent", "tree", "embedded", "textfield",
                         "textfieldvalidation", "datefield", "button",
                         "select/select", "select/native", "select/optiongroup",
-                        "select/twincol", "filterselect", "validator", "table",
-                        "table/select", "table/component", "table/paging",
-                        "table/editable", "upload", "link", "gridlayout",
-                        "orderedlayout", "formlayout", "form", "form/simple",
-                        "form/layout", "panel", "expandlayout",
-                        "expandlayout/root", "tabsheet", "alignment",
-                        "alignment/grid", "window", "window/opener",
+                        "select/twincol", "filterselect", "validator", "table", "table/select", "table/component", "table/paging", "table/editable",
+                        "upload", "link", "gridlayout", "orderedlayout",
+                        "formlayout", "form", "form/simple", "form/layout", "panel", "expandlayout", "expandlayout/root", "tabsheet",
+                        "alignment", "alignment/grid", "window", "window/opener",
                         "window/multiple", "classresource", "usererror",
                         "progress/window", "progress/thread", "progress",
                         "customlayout", "spacing", "margin", "clientinfo",
                         "fillinform/templates", "notification", "print",
-                        "richtextfield", "querycontainer", "menubar" };
+                        "richtextfield", "querycontainer", "menubar"};
                 for (int i = 0; i < examples.length; i++) {
-                    grid.addComponent(new Label("<a href='"
-                            + context.toString() + examples[i] + "'>"
-                            + examples[i] + "</a>", Label.CONTENT_XHTML));
+                    grid.addComponent(new Label("<a href='" + context.toString() +
+                            examples[i] + "'>" + examples[i] + "</a>",
+                            Label.CONTENT_XHTML));
                 }
                 return null;
             }
@@ -238,14 +233,13 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
             } else if (example.equals("menubar")) {
                 example_MenuBar(main, param);
             } else {
-                ; // main.addComponent(new
-                  // Label("Unknown test '"+example+"'."));
+                ; // main.addComponent(new Label("Unknown test '"+example+"'."));
             }
 
             return null;
         }
     }
-
+    
     /*
      * public Window getWindow(String name) { Window superwin =
      * super.getWindow(name); if (superwin != null) return superwin;
@@ -316,14 +310,10 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
                 new Object[] { "Venus" },
                 new Object[] { "Earth", "The Moon" },
                 new Object[] { "Mars", "Phobos", "Deimos" },
-                new Object[] { "Jupiter", "Io", "Europa", "Ganymedes",
-                        "Callisto" },
-                new Object[] { "Saturn", "Titan", "Tethys", "Dione", "Rhea",
-                        "Iapetus" },
-                new Object[] { "Uranus", "Miranda", "Ariel", "Umbriel",
-                        "Titania", "Oberon" },
-                new Object[] { "Neptune", "Triton", "Proteus", "Nereid",
-                        "Larissa" } };
+                new Object[] { "Jupiter", "Io", "Europa", "Ganymedes", "Callisto" },
+                new Object[] { "Saturn", "Titan", "Tethys", "Dione", "Rhea", "Iapetus" },
+                new Object[] { "Uranus", "Miranda", "Ariel", "Umbriel", "Titania", "Oberon" },
+                new Object[] { "Neptune", "Triton", "Proteus", "Nereid", "Larissa" } };
 
         final Tree tree = new Tree();
 
@@ -354,52 +344,48 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
                 tree.expandItemsRecursively(planet);
             }
         }
-
-        // Horizontal layout with the tree on the left and a details panel on
-        // the right.
-        final ExpandLayout horlayout = new ExpandLayout(
-                OrderedLayout.ORIENTATION_HORIZONTAL);
+        
+        // Horizontal layout with the tree on the left and a details panel on the right. 
+        final ExpandLayout horlayout = new ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
         horlayout.addStyleName("treeexample");
         horlayout.setSizeFull();
-
+        
         final Panel treepanel = new Panel("The Planets and Major Moons");
         treepanel.addComponent(tree);
         horlayout.addComponent(treepanel);
-
+        
         final Panel detailspanel = new Panel("Details");
         horlayout.addComponent(detailspanel);
         horlayout.expand(detailspanel);
-
+        
         final OrderedLayout detailslayout = new OrderedLayout();
         detailspanel.setLayout(detailslayout);
-
-        // Allow null selection - this is the default actually.
-        tree.setNullSelectionAllowed(true);
-
-        // When a tree item (planet or moon) is clicked, open the item in
-        // Details view.
-        tree.setImmediate(true);
-        tree.addListener(new ValueChangeListener() {
-            String lastselected = null;
-
-            public void valueChange(ValueChangeEvent event) {
-                String planet = (String) tree.getValue();
-
-                // Reselect a selected item if it is unselected by clicking it.
-                if (planet == null) {
-                    planet = lastselected;
-                    tree.setValue(planet);
-                }
-                lastselected = planet;
-
+        
+               // Allow null selection - this is the default actually.
+               tree.setNullSelectionAllowed(true);
+               
+               // When a tree item (planet or moon) is clicked, open the item in Details view.
+               tree.setImmediate(true);
+               tree.addListener(new ValueChangeListener() {
+                   String lastselected = null;
+                   
+                   public void valueChange(ValueChangeEvent event) {
+                       String planet = (String) tree.getValue();
+               
+                       // Reselect a selected item if it is unselected by clicking it.
+                       if (planet == null) {
+                               planet = lastselected;
+                               tree.setValue(planet);
+                       }
+                       lastselected = planet;
+                
                 detailspanel.setCaption("Details on " + planet);
                 detailslayout.removeAllComponents();
-
+                
                 // Put some stuff in the Details view.
                 detailslayout.addComponent(new Label("Where is the cat?"));
-                detailslayout.addComponent(new Label("The cat is in " + planet
-                        + "."));
-
+                detailslayout.addComponent(new Label("The cat is in " + planet + "."));
+                
             }
         });
 
@@ -541,9 +527,8 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
     }
 
     void example_DateField(Window main, String param) {
-        OrderedLayout layout = new OrderedLayout(
-                OrderedLayout.ORIENTATION_HORIZONTAL);
-
+        OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+        
         /* Create a DateField with the calendar style. */
         final DateField popupdate = new PopupDateField("Popup calendar field");
 
@@ -554,9 +539,8 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
         popupdate.setValue(new java.util.Date());
 
         /* Create a DateField with the calendar style. */
-        final DateField inlinedate = new InlineDateField(
-                "Inline calendar field");
-
+        final DateField inlinedate = new InlineDateField("Inline calendar field");
+        
         /* Set locale of the DateField to American English. */
         inlinedate.setLocale(new Locale("en", "US"));
 
@@ -578,7 +562,7 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
             form.setCaption("My Form");
             form.setRequired(true);
             main.addComponent(form);
-
+            
             TextField text = new TextField("This is a required text field");
             text.setRequired(true);
             text.setImmediate(true);
@@ -593,7 +577,7 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
             return "pagingtable";
         }
     }
-
+    
     void example_Table(Window main, String param) {
         if (param != null) {
             if (param.equals("select")) {
@@ -613,11 +597,11 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
             } else if (param.equals("paging")) {
                 PagingTable table = new PagingTable();
                 table.addContainerProperty("Column 1", String.class, null);
-                for (int i = 0; i < 100; i++)
-                    table.addItem(new Object[] { "Item " + i }, new Integer(i));
+                for (int i=0; i<100; i++)
+                    table.addItem(new Object[]{"Item "+i}, new Integer(i));
                 main.addComponent(table);
             }
-        } else
+        }else
             main.addComponent(new TableExample1());
     }
 
@@ -719,10 +703,9 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
 
     void example_GridLayout(Window main, String param) {
         if (param.equals("embedded")) {
-            final GridLayout grid = new GridLayout(3, 3);
-            for (int i = 0; i < 3 * 3; i++) {
-                ClassResource img = new ClassResource("smiley.jpg", main
-                        .getApplication());
+            final GridLayout grid = new GridLayout(3,3);
+            for (int i=0; i<3*3; i++) {
+                ClassResource img = new ClassResource("smiley.jpg", main.getApplication());
                 Embedded embedded = new Embedded("", img);
                 grid.addComponent(embedded);
             }
@@ -767,56 +750,25 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
             layout.setHeight(400, Sizeable.UNITS_PIXELS);
 
             /* Define cells and their layouts to create. */
-
-            Object cells[][] = {
-                    { new Button("Top Left"),
-                            new Integer(OrderedLayout.ALIGNMENT_LEFT),
-                            new Integer(OrderedLayout.ALIGNMENT_TOP) },
-                    {
-                            new Label("Top Center"),
-                            new Integer(
-                                    OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER),
-                            new Integer(OrderedLayout.ALIGNMENT_TOP) },
-                    { new Label("Top Right"),
-                            new Integer(OrderedLayout.ALIGNMENT_RIGHT),
-                            new Integer(OrderedLayout.ALIGNMENT_TOP) },
-                    {
-                            new Button("Center Left"),
-                            new Integer(OrderedLayout.ALIGNMENT_LEFT),
-                            new Integer(OrderedLayout.ALIGNMENT_VERTICAL_CENTER) },
-                    {
-                            new Button("Center Center"),
-                            new Integer(
-                                    OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER),
-                            new Integer(OrderedLayout.ALIGNMENT_VERTICAL_CENTER) },
-                    {
-                            new Button("Center Right"),
-                            new Integer(OrderedLayout.ALIGNMENT_RIGHT),
-                            new Integer(OrderedLayout.ALIGNMENT_VERTICAL_CENTER) },
-                    { new Button("Bottom Left"),
-                            new Integer(OrderedLayout.ALIGNMENT_LEFT),
-                            new Integer(OrderedLayout.ALIGNMENT_BOTTOM) },
-                    {
-                            new Button("Bottom Center"),
-                            new Integer(
-                                    OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER),
-                            new Integer(OrderedLayout.ALIGNMENT_BOTTOM) },
-                    { new Button("Bottom Right"),
-                            new Integer(OrderedLayout.ALIGNMENT_RIGHT),
-                            new Integer(OrderedLayout.ALIGNMENT_BOTTOM) } };
-
-            for (int i = 0; i < 9; i++) {
-                ExpandLayout celllayout = new ExpandLayout(
-                        OrderedLayout.ORIENTATION_HORIZONTAL);
-                celllayout.addComponent((Component) cells[i][0]);
-                celllayout.setComponentAlignment((Component) cells[i][0],
-                        ((Integer) cells[i][1]).intValue(),
-                        ((Integer) cells[i][2]).intValue());
-                layout.addComponent(celllayout);
-                // layout.setComponentAlignment((Component)cells[i][0],
-                // ((Integer)cells[i][1]).intValue(),
-                // ((Integer)cells[i][2]).intValue());
-            }
+            
+             Object cells[][] = {
+                     {new Button("Top Left"),      new Integer(OrderedLayout.ALIGNMENT_LEFT),              new Integer(OrderedLayout.ALIGNMENT_TOP)},
+                     {new Label ("Top Center"),    new Integer(OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER), new Integer(OrderedLayout.ALIGNMENT_TOP)},
+                     {new Label ("Top Right"),     new Integer(OrderedLayout.ALIGNMENT_RIGHT),             new Integer(OrderedLayout.ALIGNMENT_TOP)},
+                     {new Button("Center Left"),   new Integer(OrderedLayout.ALIGNMENT_LEFT),              new Integer(OrderedLayout.ALIGNMENT_VERTICAL_CENTER)},
+                     {new Button("Center Center"), new Integer(OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER), new Integer(OrderedLayout.ALIGNMENT_VERTICAL_CENTER)},
+                     {new Button("Center Right"),  new Integer(OrderedLayout.ALIGNMENT_RIGHT),             new Integer(OrderedLayout.ALIGNMENT_VERTICAL_CENTER)},
+                     {new Button("Bottom Left"),   new Integer(OrderedLayout.ALIGNMENT_LEFT),              new Integer(OrderedLayout.ALIGNMENT_BOTTOM)},
+                     {new Button("Bottom Center"), new Integer(OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER), new Integer(OrderedLayout.ALIGNMENT_BOTTOM)},
+                     {new Button("Bottom Right"),  new Integer(OrderedLayout.ALIGNMENT_RIGHT),             new Integer(OrderedLayout.ALIGNMENT_BOTTOM)}};
+             
+             for (int i=0; i<9; i++) {
+                 ExpandLayout celllayout = new ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+                 celllayout.addComponent((Component) cells[i][0]);
+                 celllayout.setComponentAlignment((Component)cells[i][0], ((Integer)cells[i][1]).intValue(), ((Integer)cells[i][2]).intValue());
+                 layout.addComponent(celllayout);
+                 //layout.setComponentAlignment((Component)cells[i][0], ((Integer)cells[i][1]).intValue(), ((Integer)cells[i][2]).intValue());
+             }
         } else {
             final Panel panel = new Panel("A Panel with a Layout");
             main.addComponent(panel);
@@ -848,94 +800,78 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
         } else if (param != null && param.equals("layout")) {
             Form form = new Form();
             form.setCaption("Form Caption");
-            form
-                    .setDescription("This is a description of the Form that is "
-                            + "displayed in the upper part of the form. You normally enter some "
-                            + "descriptive text about the form and its use here.");
-
-            // Add a field directly to the layout. This field will not be bound
-            // to
-            // the data source Item of the form.
+            form.setDescription("This is a description of the Form that is " +
+                    "displayed in the upper part of the form. You normally enter some " +
+                    "descriptive text about the form and its use here.");
+            
+            // Add a field directly to the layout. This field will not be bound to
+            // the data source Item of the form. 
             form.getLayout().addComponent(new TextField("A Field"));
-
+            
             // Add a field and bind it to an named item property.
             form.addField("another", new TextField("Another Field"));
-
-            form.setComponentError(new UserError(
-                    "This is the error indicator of the Form."));
+            
+            form.setComponentError(new UserError("This is the error indicator of the Form."));
 
             // Set the footer layout and add some text.
             form.setFooter(new OrderedLayout());
-            form
-                    .getFooter()
-                    .addComponent(
-                            new Label(
-                                    "This is the footer area of the Form. "
-                                            + "You can use any layout here. This is nice for buttons."));
-
-            // Add an Ok (commit), Reset (discard), and Cancel buttons for the
-            // form.
-            ExpandLayout okbar = new ExpandLayout(
-                    OrderedLayout.ORIENTATION_HORIZONTAL);
+            form.getFooter().addComponent(new Label("This is the footer area of the Form. "+
+                                        "You can use any layout here. This is nice for buttons."));
+            
+            // Add an Ok (commit), Reset (discard), and Cancel buttons for the form.
+            ExpandLayout okbar = new ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
             okbar.setHeight("25px");
             Button okbutton = new Button("OK", form, "commit");
             okbar.addComponent(okbutton);
-            okbar.setComponentAlignment(okbutton, ExpandLayout.ALIGNMENT_RIGHT,
-                    ExpandLayout.ALIGNMENT_TOP);
+            okbar.setComponentAlignment(okbutton, ExpandLayout.ALIGNMENT_RIGHT, ExpandLayout.ALIGNMENT_TOP);
             okbar.addComponent(new Button("Reset", form, "discard"));
             okbar.addComponent(new Button("Cancel"));
             form.getFooter().addComponent(okbar);
-
+            
             main.addComponent(form);
-        } else
+        } else 
             main.addComponent(new FormExample());
     }
 
     void example_ExpandLayout(Window main, String param) {
         if (param != null && param.equals("centered")) {
             Label widget = new Label("Here is text");
-
-            ExpandLayout layout = new ExpandLayout(
-                    OrderedLayout.ORIENTATION_HORIZONTAL);
+    
+            ExpandLayout layout = new ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
             layout.addComponent(widget);
             layout.expand(widget);
-            layout.setComponentAlignment(widget,
-                    OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER,
-                    OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
+            layout.setComponentAlignment(widget, OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER, OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
             layout.setWidth(100, Sizeable.UNITS_PERCENTAGE);
             layout.setHeight(100, Sizeable.UNITS_PERCENTAGE);
-
+    
             main.setLayout(layout);
-
+            
             return;
         } else if (param != null && param.equals("window")) {
             Window window = new Window("Progress");
             window.setHeight(100, Sizeable.UNITS_PIXELS);
             window.setWidth(200, Sizeable.UNITS_PIXELS);
             main.addWindow(window);
-
+            
             ProgressIndicator progress = new ProgressIndicator(new Float(0.4));
             progress.addStyleName("fullwidth");
             progress.setPollingInterval(1000000);
             progress.setIndeterminate(false);
-
-            ExpandLayout layout = new ExpandLayout(
-                    OrderedLayout.ORIENTATION_HORIZONTAL);
+    
+            ExpandLayout layout = new ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
             layout.setHeight(100, Sizeable.UNITS_PERCENTAGE);
-            layout.setComponentAlignment(progress,
-                    OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER,
-                    OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
+            layout.setComponentAlignment(progress, OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER, OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
             window.setLayout(layout);
             window.addComponent(progress);
-
+            
             return;
         } else if (param != null && param.equals("root")) {
             final Window mainwin = main;
-
+            
             // Layout to switch to
             final OrderedLayout expand2 = new OrderedLayout();
             expand2.addComponent(new Label("I am layout too."));
-
+            
             // Original layout
             final OrderedLayout expand1 = new OrderedLayout();
             Button switchButton = new Button("Switch to other layout");
@@ -947,7 +883,7 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
             });
             expand1.addComponent(switchButton);
             main.setLayout(expand1);
-
+            
             return;
         } else if (param != null && param.equals("size")) {
             ExpandLayout layout = new ExpandLayout();
@@ -956,10 +892,8 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
 
             Button button = new Button("This is a button in middle of nowhere");
             layout.addComponent(button);
-            layout.setComponentAlignment(button,
-                    OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER,
-                    OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
-
+            layout.setComponentAlignment(button, OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER, OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
+            
             return;
         }
 
@@ -979,8 +913,8 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
             /*
              * FIXME Java 5 -> 1.4 for (int i=0; i<5; i++)
              * table.addContainerProperty("col "+(i+1), Integer.class, 0); for
-             * (int j=0; j<20; j++) table.addItem(new Object[]{1j,2j,3j,4j,5j},
-             * j);
+             * (int j=0; j<20; j++) table.addItem(new
+             * Object[]{1*j,2*j,3*j,4*j,5*j}, j);
              */
             layout.addComponent(table);
 
@@ -1017,24 +951,20 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
             // ("images/Mercury_small.png", this)));
         } else if (param.equals("expanding")) {
             // Create the layout
-            ExpandLayout expanding = new ExpandLayout(
-                    OrderedLayout.ORIENTATION_VERTICAL);
-
+            ExpandLayout expanding = new ExpandLayout(OrderedLayout.ORIENTATION_VERTICAL);
+            
             // It is important to set the expanding layout as the root layout
             // of the containing window, in this case the main window, and not
             // use addComponent(), which would place the layout inside the
             // default root layout.
             main.setLayout(expanding);
-
+            
             // Create a tab sheet that fills the expanding layout
             final TabSheet tabsheet = new TabSheet();
-            tabsheet.addTab(new Label("Contents of the first tab"),
-                    "First Tab", null);
-            tabsheet.addTab(new Label("Contents of the second tab"),
-                    "Second Tab", null);
-            tabsheet.addTab(new Label("Contents of the third tab"),
-                    "Third tab", null);
-
+            tabsheet.addTab(new Label("Contents of the first tab"), "First Tab", null);
+            tabsheet.addTab(new Label("Contents of the second tab"), "Second Tab", null);
+            tabsheet.addTab(new Label("Contents of the third tab"), "Third tab", null);
+            
             // Set the tabsheet to scale to full size inside its container
             tabsheet.setWidth(100, Sizeable.UNITS_PERCENTAGE);
             tabsheet.setHeight(100, Sizeable.UNITS_PERCENTAGE);
@@ -1046,27 +976,23 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
             expanding.expand(tabsheet);
         } else if (param.equals("ordered")) {
             // Create the layout
-            OrderedLayout layout = new OrderedLayout(
-                    OrderedLayout.ORIENTATION_VERTICAL);
-
+            OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
+            
             // It is important to set the expanding layout as the root layout
             // of the containing window, in this case the main window, and not
             // use addComponent(), which would place the layout inside the
             // default root layout.
             main.setLayout(layout);
-
+            
             // Create a tab sheet that fills the expanding layout
             final TabSheet tabsheet = new TabSheet();
-            tabsheet.addTab(new Label("Contents of the first tab"),
-                    "First Tab", null);
-            tabsheet.addTab(new Label("Contents of the second tab"),
-                    "Second Tab", null);
-            tabsheet.addTab(new Label("Contents of the third tab"),
-                    "Third tab", null);
-
+            tabsheet.addTab(new Label("Contents of the first tab"), "First Tab", null);
+            tabsheet.addTab(new Label("Contents of the second tab"), "Second Tab", null);
+            tabsheet.addTab(new Label("Contents of the third tab"), "Third tab", null);
+            
             // Set the tabsheet to scale to full size inside its container
             tabsheet.setWidth(100, Sizeable.UNITS_PERCENTAGE);
-            // tabsheet().setHeight(100, Sizeable.UNITS_PERCENTAGE);
+            //tabsheet().setHeight(100, Sizeable.UNITS_PERCENTAGE);
 
             // Add the tab sheet to the layout as usual
             layout.addComponent(tabsheet);
@@ -1139,45 +1065,43 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
         main.addComponent(new Embedded("This is Embedded", new ClassResource(
                 "smiley.jpg", main.getApplication())));
     }
-
+    
     void example_ProgressIndicator(final Window main, String param) {
         if (param != null) {
             if (param.equals("thread")) {
 
                 // Create the indicator
-                final ProgressIndicator indicator = new ProgressIndicator(
-                        new Float(0.0));
+                final ProgressIndicator indicator = new ProgressIndicator(new Float(0.0));
                 main.addComponent(indicator);
-
+                
                 // Set polling frequency to 0.5 seconds.
                 indicator.setPollingInterval(1000);
-
-                // indicator.addStyleName("invisible");
+                
+                //indicator.addStyleName("invisible");
                 final Label text = new Label("-- Not running --");
                 main.addComponent(text);
-
+                
                 // Add a button to start the progress
                 final Button button = new Button("Click to start");
                 main.addComponent(button);
-
+        
                 // Another thread to do some work
                 class WorkThread extends Thread {
-                    public void run() {
+                    public void run () {
                         double current = 0.0;
                         while (true) {
                             // Do some "heavy work"
                             try {
                                 sleep(50); // Sleep for 50 milliseconds
-                            } catch (InterruptedException e) {
-                            }
-
+                            } catch (InterruptedException e) {}
+                            
                             // Grow the progress value until it reaches 1.0.
                             current += 0.01;
-                            if (current > 1.0)
+                            if (current>1.0)
                                 indicator.setValue(new Float(1.0));
-                            else
+                            else 
                                 indicator.setValue(new Float(current));
-
+                            
                             // After the progress is full for a while, stop.
                             if (current > 1.2) {
                                 // Restore the state to initial.
@@ -1188,20 +1112,19 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
                         }
                     }
                 }
-
+                
                 // Clicking the button creates and runs a work thread
                 button.addListener(new Button.ClickListener() {
                     public void buttonClick(ClickEvent event) {
                         final WorkThread thread = new WorkThread();
                         thread.start();
-
+                        
                         // The button hides until the work is done.
                         button.setVisible(false);
                     }
                 });
             } else if (param.equals("window")) {
-                // Create a table in the main window to hold items added in the
-                // second window
+                // Create a table in the main window to hold items added in the second window
                 final Table table = new Table();
                 table.setPageLength(5);
                 table.setWidth(100, Sizeable.UNITS_PERCENTAGE);
@@ -1214,38 +1137,33 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
                 main.getApplication().addWindow(adderWindow);
 
                 // Create selection component to add items to the table
-                final NativeSelect select = new NativeSelect(
-                        "Select item to add");
+                final NativeSelect select = new NativeSelect("Select item to add");
                 select.setImmediate(true);
                 adderWindow.addComponent(select);
-
+                
                 // Add some items to the selection
-                String items[] = new String[] { "-- Select --", "Mercury",
-                        "Venus", "Earth", "Mars", "Jupiter", "Saturn",
-                        "Uranus", "Neptune" };
-                for (int i = 0; i < items.length; i++)
+                String items[] = new String[]{"-- Select --", "Mercury", "Venus", 
+                        "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"};
+                for (int i=0; i<items.length; i++)
                     select.addItem(items[i]);
                 select.setNullSelectionItemId(items[0]);
-
+                
                 // When an item is selected in the second window, add
                 // table in the main window
                 select.addListener(new ValueChangeListener() {
                     public void valueChange(ValueChangeEvent event) {
-                        // If the selected value is something else but null
-                        // selection item.
+                        // If the selected value is something else but null selection item.
                         if (select.getValue() != null) {
-                            // Add the selected item to the table in the main
-                            // window
-                            table.addItem(new Object[] { select.getValue() },
-                                    new Integer(table.size()));
+                            // Add the selected item to the table in the main window
+                            table.addItem(new Object[]{select.getValue()}, new Integer(table.size()));
                         }
                     }
                 });
 
                 // Link to open the selection window
                 Link link = new Link("Click to open second window",
-                        new ExternalResource(adderWindow.getURL()), "_new", 50,
-                        200, Link.TARGET_BORDER_DEFAULT);
+                                     new ExternalResource(adderWindow.getURL()),
+                                     "_new", 50, 200, Link.TARGET_BORDER_DEFAULT);
                 main.addComponent(link);
 
                 // Enable polling to update the main window
@@ -1253,53 +1171,41 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
                 poller.addStyleName("invisible");
                 main.addComponent(poller);
             } else if (param.equals("centered")) {
-                /*
-                 * GridLayout grid = new GridLayout(3,3); main.setLayout(grid);
-                 * grid().setWidth(100, Sizeable.UNITS_PERCENTAGE);
-                 * 
-                 * ExpandLayout layout2 = new
-                 * ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
-                 * layout2().setWidth(50, Sizeable.UNITS_PERCENTAGE);
-                 * 
-                 * ProgressIndicator poller = new ProgressIndicator(new
-                 * Float(0.4)); poller.setPollingInterval(1000000);
-                 * poller.setIndeterminate(false); layout2.addComponent(poller);
-                 * 
-                 * grid.addComponent(layout2, 1, 1);
-                 */
-
-                // ExpandLayout layout2 = new
-                // ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
-                /*
-                 * ProgressIndicator poller = new ProgressIndicator(new
-                 * Float(0.4)); poller.setPollingInterval(1000000);
-                 * poller.setIndeterminate(false);
-                 */
-                /*
-                 * layout2.addComponent(poller); layout2().setWidth(50,
-                 * Sizeable.UNITS_PERCENTAGE);
-                 */
-
-                // layout.setComponentAlignment(poller,
-                // OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER,
-                // OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
-                /*
-                 * GridLayout grid = new GridLayout(1,1);
-                 * grid.addComponent(layout2, 0, 0); grid().setWidth(100,
-                 * Sizeable.UNITS_PERCENTAGE);
-                 */
-
-                /*
-                 * GridLayout layout = new GridLayout(1,1);
-                 * //OrderedLayout.ORIENTATION_HORIZONTAL);
-                 * layout.addComponent(poller); //layout.expand(poller);
-                 * layout.setComponentAlignment(poller,
-                 * OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER,
-                 * OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
-                 * layout().setWidth(100, Sizeable.UNITS_PERCENTAGE);
-                 * layout().setHeight(100, Sizeable.UNITS_PERCENTAGE);
-                 */
-
+/*                GridLayout grid = new GridLayout(3,3);
+                main.setLayout(grid);
+                grid().setWidth(100, Sizeable.UNITS_PERCENTAGE);
+                
+                ExpandLayout layout2 = new ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+                layout2().setWidth(50, Sizeable.UNITS_PERCENTAGE);
+
+                ProgressIndicator poller = new ProgressIndicator(new Float(0.4));
+                poller.setPollingInterval(1000000);
+                poller.setIndeterminate(false);
+                layout2.addComponent(poller);
+
+                grid.addComponent(layout2, 1, 1);
+                */
+
+                //ExpandLayout layout2 = new ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+                
+                /*ProgressIndicator poller = new ProgressIndicator(new Float(0.4));
+                poller.setPollingInterval(1000000);
+                poller.setIndeterminate(false);*/
+                /*layout2.addComponent(poller);
+                layout2().setWidth(50, Sizeable.UNITS_PERCENTAGE);*/
+                
+                //layout.setComponentAlignment(poller, OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER, OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
+                /*GridLayout grid = new GridLayout(1,1);
+                grid.addComponent(layout2, 0, 0);
+                grid().setWidth(100, Sizeable.UNITS_PERCENTAGE);*/
+                
+                /*GridLayout layout = new GridLayout(1,1); //OrderedLayout.ORIENTATION_HORIZONTAL);
+                layout.addComponent(poller);
+                //layout.expand(poller);
+                layout.setComponentAlignment(poller, OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER, OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
+                layout().setWidth(100, Sizeable.UNITS_PERCENTAGE);
+                layout().setHeight(100, Sizeable.UNITS_PERCENTAGE);*/
+                
             }
         } else {
             ProgressIndicator poller = new ProgressIndicator(new Float(0.0));
@@ -1308,30 +1214,30 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
             main.addComponent(poller);
         }
     }
-
+    
     void example_CustomLayout(final Window main, String param) {
         Window sub = new Window("Login");
         sub.setModal(true);
         main.addWindow(sub);
-
+        
         // Create the custom layout and set it as the root layout of
         // the containing window.
         final CustomLayout custom = new CustomLayout("layoutname");
         sub.setLayout(custom);
-
+        
         // Create components and bind them to the location tags
         // in the custom layout.
         TextField username = new TextField();
         custom.addComponent(username, "username");
-
+        
         TextField password = new TextField();
         custom.addComponent(password, "password");
-
+        
         final Button ok = new Button("Login");
         custom.addComponent(ok, "okbutton");
-
+        
         final Button deny = new Button("No can do!");
-
+        
         Button.ClickListener listener = new Button.ClickListener() {
             public void buttonClick(ClickEvent event) {
                 // Switch between ok and deny
@@ -1342,9 +1248,9 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
                     System.out.println("Changing to ok button.");
                     custom.addComponent(ok, "okbutton");
                 }
-            }
-        };
-
+             } 
+         };
+        
         ok.addListener(listener);
         deny.addListener(listener);
     }
@@ -1353,56 +1259,51 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
         OrderedLayout containinglayout = new OrderedLayout();
         main.setLayout(containinglayout);
 
-        GridLayout grid = new GridLayout(4, 3);
+        GridLayout grid = new GridLayout(4,3);
         grid.addStyleName("spacingexample");
         containinglayout.addComponent(grid);
         grid.addComponent(new Label(""), 0, 0);
         grid.addComponent(new Label(""), 1, 0);
-
-        grid.addComponent(new Label("No spacing:"), 0, 1);
-        OrderedLayout layout1 = new OrderedLayout(
-                OrderedLayout.ORIENTATION_HORIZONTAL);
-        grid.addComponent(layout1, 1, 1);
+        
+        grid.addComponent(new Label("No spacing:"),0,1);
+        OrderedLayout layout1 = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+        grid.addComponent(layout1,1,1);
         layout1.addStyleName("spacingexample");
         layout1.addComponent(new Button("Component 1"));
         layout1.addComponent(new Button("Component 2"));
         layout1.addComponent(new Button("Component 3"));
-
+        
         grid.addComponent(new Label("Horizontal spacing:"), 0, 2);
-        OrderedLayout layout2 = new OrderedLayout(
-                OrderedLayout.ORIENTATION_HORIZONTAL);
-        grid.addComponent(layout2, 1, 2);
+        OrderedLayout layout2 = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+        grid.addComponent(layout2,1,2);
         layout2.addStyleName("spacingexample");
         layout2.setSpacing(true);
         layout2.addComponent(new Button("Component 1"));
         layout2.addComponent(new Button("Component 2"));
         layout2.addComponent(new Button("Component 3"));
 
-        grid.addComponent(new Label("No spacing:"), 2, 0);
-        OrderedLayout layout3 = new OrderedLayout(
-                OrderedLayout.ORIENTATION_VERTICAL);
-        grid.addComponent(layout3, 2, 1, 2, 2);
+        grid.addComponent(new Label("No spacing:"),2,0);
+        OrderedLayout layout3 = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
+        grid.addComponent(layout3,2,1,2,2);
         layout3.addStyleName("spacingexample");
         layout3.addComponent(new Button("Component 1"));
         layout3.addComponent(new Button("Component 2"));
         layout3.addComponent(new Button("Component 3"));
 
-        grid.addComponent(new Label("Vertical spacing:"), 3, 0);
-        OrderedLayout layout4 = new OrderedLayout(
-                OrderedLayout.ORIENTATION_VERTICAL);
-        grid.addComponent(layout4, 3, 1, 3, 2);
+        grid.addComponent(new Label("Vertical spacing:"),3,0);
+        OrderedLayout layout4 = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
+        grid.addComponent(layout4,3,1,3,2);
         layout4.addStyleName("spacingexample");
         layout4.setSpacing(true);
         layout4.addComponent(new Button("Component 1"));
         layout4.addComponent(new Button("Component 2"));
         layout4.addComponent(new Button("Component 3"));
-    }
+}
 
     void example_Margin(final Window main, String param) {
-        OrderedLayout hor = new OrderedLayout(
-                OrderedLayout.ORIENTATION_HORIZONTAL);
+        OrderedLayout hor = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
         main.setLayout(hor);
-
+        
         OrderedLayout containinglayout = new OrderedLayout();
         hor.addComponent(containinglayout);
 
@@ -1416,16 +1317,15 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
 
         // Create a layout
         OrderedLayout layout2 = new OrderedLayout();
-        containinglayout.addComponent(new Label(
-                "Layout with a special margin element:"));
+        containinglayout.addComponent(new Label("Layout with a special margin element:"));
         containinglayout.addComponent(layout2);
-
+        
         // Set style name for the layout to allow styling it
         layout2.addStyleName("marginexample2");
-
+        
         // Have margin on all sides around the layout
         layout2.setMargin(true);
-
+        
         // Put something inside the layout
         layout2.addComponent(new Button("Component 1"));
         layout2.addComponent(new Button("Component 2"));
@@ -1435,59 +1335,55 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
     void example_ClientInfo(final Window main, String param) {
         // Get the client identification string
         WebApplicationContext context2 = (WebApplicationContext) getContext();
-        String browserApplication = context2.getBrowser()
-                .getBrowserApplication();
-
+        String browserApplication = context2.getBrowser().getBrowserApplication();
+        
         // Add a browser-dependent style name for the main window
         if (browserApplication.indexOf("Firefox/2") != -1)
             main.addStyleName("firefox2");
-
+        
         // Display the client identification string
         main.addComponent(new Label(browserApplication));
     }
 
     void example_FillInForm(final Window main, String param) {
-        if (param.equals("templates")) {
-            // Create a custom layout from the fill-in-form.html template.
-            CustomLayout fillinlayout = new CustomLayout("fill-in-form");
-
-            // The style will set the display to be "inline".
-            fillinlayout.addStyleName("fillinlayout");
-
-            // Create the fields that occur in the text.
-            TextField field1 = new TextField();
-            TextField field2 = new TextField();
-            fillinlayout.addComponent(field1, "q1");
-            fillinlayout.addComponent(field2, "q2");
-
-            main.addComponent(fillinlayout);
-        } else {
-            String fillintext = "The <q1> is mightier than <q2>.";
-            int pos = 0;
-            while (pos < fillintext.length()) {
-                int nexttag = fillintext.indexOf("<", pos);
-                if (nexttag == -1) {
-
-                }
-            }
-        }
+       if (param.equals("templates")) {        
+               // Create a custom layout from the fill-in-form.html template.
+               CustomLayout fillinlayout = new CustomLayout("fill-in-form");
+       
+               // The style will set the display to be "inline".
+               fillinlayout.addStyleName("fillinlayout");
+       
+               // Create the fields that occur in the text.
+               TextField field1 = new TextField();
+               TextField field2 = new TextField();
+               fillinlayout.addComponent(field1, "q1");
+               fillinlayout.addComponent(field2, "q2");
+       
+               main.addComponent(fillinlayout);
+       } else {
+               String fillintext = "The <q1> is mightier than <q2>.";
+               int pos = 0;
+               while (pos < fillintext.length()) {
+                       int nexttag = fillintext.indexOf("<", pos);
+                       if (nexttag == -1) {
+                               
+                       }
+               }
+       }
     }
 
     void example_Notification(final Window main, String param) {
         final Window sub1 = new Window("");
         main.addWindow(sub1);
-
+        
         sub1.showNotification("The default notification");
-
-        // Notification notif = new Notification("Title");
+        
+        //Notification notif = new Notification("Title");
     }
 
     void example_Print(final Window main, String param) {
-        if (param != null && param.equals("simple")) {
-            main
-                    .addComponent(new Label(
-                            "<input type='button' onClick='print()' value='Click to Print'/>",
-                            Label.CONTENT_XHTML));
+        if (param != null && param.equals("simple")) {        
+            main.addComponent(new Label("<input type='button' onClick='print()' value='Click to Print'/>", Label.CONTENT_XHTML));
             return;
         }
 
@@ -1498,36 +1394,33 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
             public void buttonClick(ClickEvent event) {
                 // Create a window that contains stuff you want to print.
                 Window printWindow = new Window("Window to Print");
-
+                
                 // Have some content to print.
-                printWindow.addComponent(new Label(
-                        "Here's some dynamic content."));
-
+                printWindow.addComponent(new Label("Here's some dynamic content."));
+                
                 // To execute the print() JavaScript, we need to run it
                 // from a custom layout.
                 CustomLayout scriptLayout = new CustomLayout("printpage");
-                printWindow.addComponent(scriptLayout);
-
+                printWindow.addComponent (scriptLayout);
+                
                 // Add the printing window as an application-level window.
                 main.getApplication().addWindow(printWindow);
-
+        
                 // Open the printing window as a new browser window
                 main.open(new ExternalResource(printWindow.getURL()), "_new");
-            }
+            } 
         });
 
-        // main.addComponent(new Label(
-        // "<p>Print this!</p>\n<script type='text/javascript'>print();</script>"
-        // , Label.CONTENT_XHTML));
+        //main.addComponent(new Label("<p>Print this!</p>\n<script type='text/javascript'>print();</script>", Label.CONTENT_XHTML));
     }
 
     void example_RichTextField(final Window main, String param) {
         // Create the rich text area
         final RichTextArea rtarea = new RichTextArea();
-
+        
         // Set initial content as HTML
         rtarea.setValue("<h1>Hello</h1>\n<p>This contains some text.</p>");
-
+        
         // Show the text edited in the rich text area as HTML.
         final Button show = new Button("Show HTML");
         final Label html = new Label((String) rtarea.getValue());
@@ -1546,39 +1439,33 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
         try {
             // Create a database connection
             Class.forName("org.hsqldb.jdbcDriver");
-            final Connection connection = DriverManager.getConnection(
-                    "jdbc:hsqldb:mem:qcexample", "sa", "");
-
+            final Connection connection = DriverManager.getConnection("jdbc:hsqldb:mem:qcexample", "sa", "");
+            
             // Create an example table and put some data in it.
             Statement st = connection.createStatement();
-            st
-                    .executeQuery("CREATE TABLE Prisoners (id INTEGER, name VARCHAR)");
+            st.executeQuery("CREATE TABLE Prisoners (id INTEGER, name VARCHAR)");
             st.close();
-            for (int i = 0; i < 100; i++) {
+            for (int i=0; i<100; i++) {
                 st = connection.createStatement();
-                st.executeQuery("INSERT INTO Prisoners (id, name) VALUES (" + i
-                        + ",'I am number " + (i + 1) + "')");
+                st.executeQuery("INSERT INTO Prisoners (id, name) VALUES ("+i+",'I am number "+(i+1)+"')");
                 st.close();
             }
-
+            
             // Query the database
-            final QueryContainer qc = new QueryContainer(
-                    "SELECT id,name FROM Prisoners", connection);
-
+            final QueryContainer qc = new QueryContainer("SELECT id,name FROM Prisoners", connection);
+            
             // Create a component for selecting a query result item.
             Select select = new Select("Select an item");
-
-            // The items shown in the selection component are obtained from the
-            // query.
+            
+            // The items shown in the selection component are obtained from the query.
             select.setContainerDataSource(qc);
-
-            // The item captions are obtained from a field in the query result.
+            
+            // The item captions are obtained from a field in the query result. 
             select.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
-
-            // Set the name of the field from which the item captions are
-            // obtained.
+            
+            // Set the name of the field from which the item captions are obtained.
             select.setItemCaptionPropertyId("name");
-
+        
             // When selection changes, display the selected item.
             select.setImmediate(true);
             final Label selection = new Label("Currently selected: -");
@@ -1586,19 +1473,17 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
                 public void valueChange(ValueChangeEvent event) {
                     // Get the item id of the currently selected item
                     Integer itemId = (Integer) event.getProperty().getValue();
-
-                    // Use the item ID to get the actual row from the query
-                    // result.
+                    
+                    // Use the item ID to get the actual row from the query result.
                     Item qrItem = qc.getItem(itemId);
-
+                    
                     // Display the item ID
-                    selection.setValue("Currently selected: result row "
-                            + itemId.intValue() + " (id="
-                            + qrItem.getItemProperty("id") + ", " + "name="
-                            + qrItem.getItemProperty("name") + ")");
+                    selection.setValue("Currently selected: result row "+itemId.intValue() +
+                                       " (id="+qrItem.getItemProperty("id")+", " +
+                                       "name="+qrItem.getItemProperty("name")+")");
                 }
             });
-
+            
             main.addComponent(select);
             main.addComponent(selection);
         } catch (SQLException e) {
@@ -1612,19 +1497,18 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
         // Create a menu bar
         final MenuBar menubar = new MenuBar();
         main.addComponent(menubar);
-
+        
         // A feedback component
         final Label selection = new Label("");
         main.addComponent(selection);
-
+        
         // Define a common menu command for all the menu items.
         MenuBar.Command mycommand = new MenuBar.Command() {
             public void menuSelected(MenuItem selectedItem) {
-                selection.setValue("Ordered a " + selectedItem.getText()
-                        + " from menu.");
-            }
+                selection.setValue("Ordered a " + selectedItem.getText() + " from menu.");
+            }  
         };
-
+        
         // Put some items in the menu hierarchically
         MenuBar.MenuItem beverages = menubar.addItem("Beverages", null, null);
         MenuBar.MenuItem hot_beverages = beverages.addItem("Hot", null, null);
@@ -1632,14 +1516,14 @@ public class BookTestApplication extends com.itmill.toolkit.Application {
         hot_beverages.addItem("Coffee", null, mycommand);
         MenuBar.MenuItem cold_beverages = beverages.addItem("Cold", null, null);
         cold_beverages.addItem("Milk", null, mycommand);
-
+        
         // Another top-level item
         MenuBar.MenuItem snacks = menubar.addItem("Snacks", null, null);
         snacks.addItem("Weisswurst", null, mycommand);
         snacks.addItem("Salami", null, mycommand);
-
+        
         // Yet another top-level item
         MenuBar.MenuItem services = menubar.addItem("Services", null, null);
         services.addItem("Car Service", null, mycommand);
-    }
+   }
 }
index 7ff510a26cb4dee805c815c5e42628b5ed502fe7..eaea83062cd93acd826300de204ef7bd0dfa304a 100644 (file)
@@ -1,36 +1,26 @@
 package com.itmill.toolkit.tests.book;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
+import java.util.*;
 import com.itmill.toolkit.Application;
-import com.itmill.toolkit.ui.Button;
-import com.itmill.toolkit.ui.ProgressIndicator;
-import com.itmill.toolkit.ui.Table;
-import com.itmill.toolkit.ui.TextField;
-import com.itmill.toolkit.ui.Window;
+import com.itmill.toolkit.ui.*;
 import com.itmill.toolkit.ui.Button.ClickEvent;
 
-public class ChatApplication extends Application implements
-        Button.ClickListener {
-    /*
-     * ChatApplication instances of different users. Warning: a hack, not safe,
-     * because sessions can expire.
-     */
+public class ChatApplication extends Application implements Button.ClickListener {
+    /* ChatApplication instances of different users.
+     * Warning: a hack, not safe, because sessions can expire. */
     static List users = new ArrayList();
-
+    
     /* Messages as a shared list. */
-    static List messages = new ArrayList();
-    int localSize = 0;
+    static List messages  = new ArrayList();
+    int         localSize = 0;
 
     /* User interface. */
-    Table messageTable = new Table();
-    TextField username = new TextField("Username:");
-    TextField message = new TextField("Message:");
+    Table       messageTable = new Table();
+    TextField   username     = new TextField("Username:");
+    TextField   message      = new TextField("Message:");
 
     public void init() {
-        final Window main = new Window("Chat");
+        final Window main = new Window ("Chat");
         setMainWindow(main);
         setTheme("tests-magi");
         users.add(this);
@@ -41,9 +31,9 @@ public class ChatApplication extends Application implements
         messageTable.addContainerProperty("Sender", String.class, "");
         messageTable.addContainerProperty("Message", String.class, "");
         updateTable();
-
+        
         main.addComponent(message);
-
+        
         Button send = new Button("Send");
         send.addListener(this);
         main.addComponent(send);
@@ -55,15 +45,14 @@ public class ChatApplication extends Application implements
     }
 
     public void buttonClick(ClickEvent event) {
-        synchronized (users) {
+        synchronized(users) {
             // Create the new message in the shared list.
-            messages.add(new String[] {
-                    new String((String) username.getValue()),
-                    new String((String) message.getValue()) });
+            messages.add(new String[]{new String((String) username.getValue()),
+                                      new String((String) message.getValue())});
 
             // Update the message tables for all users.
-            for (Iterator i = users.iterator(); i.hasNext();)
-                ((ChatApplication) i.next()).updateTable();
+            for (Iterator i = users.iterator();i.hasNext();) 
+                ((ChatApplication)i.next()).updateTable();
         }
     }
 
@@ -73,7 +62,7 @@ public class ChatApplication extends Application implements
 
         // Add new messages to the table
         while (localSize < messages.size())
-            messageTable.addItem((Object[]) messages.get(localSize++),
-                    new Integer(localSize - 1));
+            messageTable.addItem((Object[])messages.get(localSize++),
+                                 new Integer(localSize-1));
     }
 }
index 31db87beebc3cf86bef9e7ea12de355c5a3805da..2ed44785bd9c430bf9fc006d23bc66140935e1ee 100644 (file)
@@ -7,6 +7,7 @@ package com.itmill.toolkit.tests.book;
 import com.itmill.toolkit.event.Action;
 import com.itmill.toolkit.event.ShortcutAction;
 import com.itmill.toolkit.event.Action.Handler;
+import com.itmill.toolkit.ui.AbstractField;
 import com.itmill.toolkit.ui.Button;
 import com.itmill.toolkit.ui.CustomComponent;
 import com.itmill.toolkit.ui.FormLayout;
@@ -24,8 +25,7 @@ public class DefaultButtonExample extends CustomComponent implements Handler {
     TextField password = new TextField("Password");
     OrderedLayout buttons = new FormLayout();
 
-    // Create buttons and define their listener methods. Here we use
-    // parameterless
+    // Create buttons and define their listener methods. Here we use parameterless
     // methods so that we can use same methods for both click events and
     // keyboard actions.
     Button ok = new Button("OK", this, "okHandler");
@@ -33,12 +33,13 @@ public class DefaultButtonExample extends CustomComponent implements Handler {
 
     // Have the unmodified Enter key cause an event
     Action action_ok = new ShortcutAction("Default key",
-            ShortcutAction.KeyCode.ENTER, null);
+                                          ShortcutAction.KeyCode.ENTER,
+                                          null);
 
     // Have the C key modified with Alt cause an event
     Action action_cancel = new ShortcutAction("Alt+C",
-            ShortcutAction.KeyCode.C,
-            new int[] { ShortcutAction.ModifierKey.ALT });
+                                              ShortcutAction.KeyCode.C,
+                                              new int[] { ShortcutAction.ModifierKey.ALT });
 
     Window window = null;
 
@@ -72,7 +73,7 @@ public class DefaultButtonExample extends CustomComponent implements Handler {
      */
     public Action[] getActions(Object target, Object sender) {
         System.out.println("getActions()");
-        return new Action[] { action_ok, action_cancel };
+        return new Action[] {action_ok, action_cancel};
     }
 
     /**
@@ -88,14 +89,14 @@ public class DefaultButtonExample extends CustomComponent implements Handler {
 
     public void okHandler() {
         // Do something: report the click
-        formlayout.addComponent(new Label("OK clicked. " + "User="
-                + username.getValue() + ", password=" + password.getValue()));
+        formlayout.addComponent(new Label("OK clicked. "+
+                                          "User="+username.getValue()+
+                                          ", password="+password.getValue()));
         //  
     }
 
     public void cancelHandler() {
         // Do something: report the click
-        formlayout.addComponent(new Label("Cancel clicked. User="
-                + username.getValue() + ", password=" + password.getValue()));
+        formlayout.addComponent(new Label("Cancel clicked. User="+username.getValue()+", password="+password.getValue()));
     }
 }
index de7bb914203f30556dd9982fd66a6cee035dba54..21258880045a950953ba0e0a8e97c5fd4585b383 100644 (file)
@@ -30,9 +30,9 @@ import com.itmill.toolkit.ui.TextField;
 public class FormExample extends CustomComponent {
     /** Contact information data model. */
     public class Contact {
-        String name = "";
-        String address = "";
-        int postalCode = 20540;
+        String name       = "";
+        String address    = "";
+        int    postalCode = 20540;
         String city;
     }
 
@@ -104,10 +104,10 @@ public class FormExample extends CustomComponent {
 
             if (pid.equals("name"))
                 return new TextField("Name");
-
+            
             if (pid.equals("address"))
                 return new TextField("Street Address");
-
+            
             if (pid.equals("postalCode")) {
                 TextField field = new TextField("Postal Code");
                 field.setColumns(5);
@@ -121,8 +121,7 @@ public class FormExample extends CustomComponent {
                         return ((String) value).matches("[0-9]{5}");
                     }
 
-                    public void validate(Object value)
-                            throws InvalidValueException {
+                    public void validate(Object value) throws InvalidValueException {
                         if (!isValid(value)) {
                             throw new InvalidValueException(
                                     "Postal code must be a number 10000-99999.");
@@ -132,7 +131,7 @@ public class FormExample extends CustomComponent {
                 field.addValidator(postalCodeValidator);
                 return field;
             }
-
+            
             if (pid.equals("city")) {
                 Select select = new Select("City");
                 final String cities[] = new String[] { "Amsterdam", "Berlin",
@@ -158,8 +157,7 @@ public class FormExample extends CustomComponent {
 
         // Set form caption and description texts.
         form.setCaption("Contact Information");
-        form
-                .setDescription("Please enter valid name and address. Fields marked with * are required.");
+        form.setDescription("Please enter valid name and address. Fields marked with * are required.");
 
         // Use custom field factory to create the fields in the form.
         form.setFieldFactory(new MyFieldFactory());
@@ -193,7 +191,7 @@ public class FormExample extends CustomComponent {
         // necessary for the validation of the fields to occur immediately when
         // the input focus changes and not just on commit.
         form.setImmediate(true);
-
+        
         // Set buffering so that commit() must be called for the form
         // before input is written to the data. (Input is not written
         // immediately through).
@@ -201,8 +199,7 @@ public class FormExample extends CustomComponent {
         form.setReadThrough(false);
 
         // Add Commit and Discard controls to the form.
-        ExpandLayout footer = new ExpandLayout(
-                OrderedLayout.ORIENTATION_HORIZONTAL);
+        ExpandLayout footer = new ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
 
         // The Commit button calls form.commit().
         Button commit = new Button("Commit", form, "commit");
@@ -211,7 +208,7 @@ public class FormExample extends CustomComponent {
         Button discard = new Button("Discard", form, "discard");
         footer.addComponent(commit);
         footer.setComponentAlignment(commit, ExpandLayout.ALIGNMENT_RIGHT,
-                ExpandLayout.ALIGNMENT_TOP);
+                                     ExpandLayout.ALIGNMENT_TOP);
         footer.setHeight("25px");
         footer.addComponent(discard);
         form.setFooter(footer);
index a44ba151819e367725855c4ab207c457e269952e..8d9c0e86e28baf14680924bbd4341d75bac203d3 100644 (file)
@@ -29,7 +29,7 @@ public class FormExample2 extends CustomComponent {
     public class PersonBean {
         String name = "";
         String city = "";
-
+        
         public void setName(String name) {
             this.name = name;
         }
@@ -91,8 +91,7 @@ public class FormExample2 extends CustomComponent {
 
         // Set form caption and description texts
         form.setCaption("Contact Information");
-        form
-                .setDescription("Please specify name of the person and the city where the person lives in.");
+        form.setDescription("Please specify name of the person and the city where the person lives in.");
 
         // Use the custom field factory to create the fields in the form.
         form.setFieldFactory(new MyFieldFactory());
@@ -111,7 +110,7 @@ public class FormExample2 extends CustomComponent {
         order.add("name");
         order.add("city");
         form.setVisibleItemProperties(order);
-
+        
         form.getField("name").setRequired(true);
         form.getField("name").setRequiredError("You must enter a name.");
         form.getField("city").setRequired(true);
index 4c27700729c2e84a97112d8ae64b9a5d1e80f9fd..34ca740a8f3c304f4e9e1cd6ba20f74a6d6e98e7 100644 (file)
@@ -1,19 +1,12 @@
 package com.itmill.toolkit.tests.book;
 
-import java.awt.Color;
-import java.awt.Graphics;
+import java.awt.*;
 import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
+import java.io.*;
 import java.net.URL;
 import java.util.Map;
-
 import javax.imageio.ImageIO;
-
-import com.itmill.toolkit.terminal.DownloadStream;
-import com.itmill.toolkit.terminal.ParameterHandler;
-import com.itmill.toolkit.terminal.URIHandler;
+import com.itmill.toolkit.terminal.*;
 
 /**
  * Demonstrates handling URI parameters and the URI itself to create a dynamic
@@ -28,7 +21,7 @@ public class MyDynamicResource implements URIHandler, ParameterHandler {
     public void handleParameters(Map parameters) {
         // Get and store the passed HTTP parameter.
         if (parameters.containsKey("text"))
-            textToDisplay = ((String[]) parameters.get("text"))[0];
+            textToDisplay = ((String[])parameters.get("text"))[0]; 
     }
 
     /**
@@ -43,21 +36,20 @@ public class MyDynamicResource implements URIHandler, ParameterHandler {
         // URI handlers or the Application to handle the response.
         if (!relativeUri.startsWith("myresource"))
             return null;
-
+        
         // Create an image and draw some background on it.
-        BufferedImage image = new BufferedImage(200, 200,
-                BufferedImage.TYPE_INT_RGB);
+        BufferedImage image = new BufferedImage (200, 200, BufferedImage.TYPE_INT_RGB);
         Graphics drawable = image.getGraphics();
         drawable.setColor(Color.lightGray);
-        drawable.fillRect(0, 0, 200, 200);
+        drawable.fillRect(0,0,200,200);
         drawable.setColor(Color.yellow);
-        drawable.fillOval(25, 25, 150, 150);
+        drawable.fillOval(25,25,150,150);
         drawable.setColor(Color.blue);
-        drawable.drawRect(0, 0, 199, 199);
-
+        drawable.drawRect(0,0,199,199);
+        
         // Use the parameter to create dynamic content.
         drawable.setColor(Color.black);
-        drawable.drawString("Text: " + textToDisplay, 75, 100);
+        drawable.drawString("Text: "+textToDisplay, 75, 100);
 
         try {
             // Write the image to a buffer.
@@ -65,9 +57,8 @@ public class MyDynamicResource implements URIHandler, ParameterHandler {
             ImageIO.write(image, "png", imagebuffer);
 
             // Return a stream from the buffer.
-            ByteArrayInputStream istream = new ByteArrayInputStream(imagebuffer
-                    .toByteArray());
-            return new DownloadStream(istream, null, null);
+            ByteArrayInputStream istream = new ByteArrayInputStream(imagebuffer.toByteArray());
+            return new DownloadStream (istream,null,null);
         } catch (IOException e) {
             return null;
         }
index 2702bbf087397a94ace6dfa9224b9a97c299f8a2..a9215f09b5b25653463f47cba57631a727da9d24 100644 (file)
@@ -9,17 +9,13 @@ import java.io.FileOutputStream;
 import java.io.OutputStream;
 
 import com.itmill.toolkit.terminal.FileResource;
-import com.itmill.toolkit.ui.CustomComponent;
-import com.itmill.toolkit.ui.Embedded;
-import com.itmill.toolkit.ui.Label;
-import com.itmill.toolkit.ui.Panel;
-import com.itmill.toolkit.ui.Upload;
+import com.itmill.toolkit.ui.*;
 
-public class MyUploader extends CustomComponent implements
-        Upload.SucceededListener, Upload.FailedListener, Upload.Receiver {
-    Panel root; // Root element for contained components.
-    Panel imagePanel; // Panel that contains the uploaded image.
-    File file; // File to write to.
+public class MyUploader extends CustomComponent
+implements Upload.SucceededListener, Upload.FailedListener, Upload.Receiver {
+    Panel root;         // Root element for contained components.
+    Panel imagePanel;   // Panel that contains the uploaded image.
+    File  file;         // File to write to.
 
     MyUploader() {
         root = new Panel("My Upload Component");
@@ -34,8 +30,7 @@ public class MyUploader extends CustomComponent implements
         upload.addListener((Upload.FailedListener) this);
 
         root.addComponent(upload);
-        root.addComponent(new Label(
-                "Click 'Browse' to select a file and then click 'Upload'."));
+        root.addComponent(new Label("Click 'Browse' to select a file and then click 'Upload'."));
 
         // Create a panel for displaying the uploaded file (image).
         imagePanel = new Panel("Uploaded image");
@@ -64,10 +59,9 @@ public class MyUploader extends CustomComponent implements
         // Log the upload on screen.
         root.addComponent(new Label("File " + event.getFilename()
                 + " of type '" + event.getMIMEType() + "' uploaded."));
-
+        
         // Display the uploaded file in the image panel.
-        final FileResource imageResource = new FileResource(file,
-                getApplication());
+        final FileResource imageResource = new FileResource(file, getApplication());
         imagePanel.removeAllComponents();
         imagePanel.addComponent(new Embedded("", imageResource));
     }
index 9b5a39380b367c971c722f319c840ed4b1e9d83e..0659ebb91045a8bed04b4cecf39e5885ec10cdac 100644 (file)
@@ -4,6 +4,8 @@
 
 package com.itmill.toolkit.tests.book;
 
+import java.text.MessageFormat;
+
 import com.itmill.toolkit.data.Property;
 import com.itmill.toolkit.data.Validator;
 import com.itmill.toolkit.data.Property.ValueChangeEvent;
@@ -17,8 +19,7 @@ import com.itmill.toolkit.ui.TextField;
 public class SSNField extends CustomComponent implements
         Property.ValueChangeListener {
     OrderedLayout layout = new FormLayout();
-    // new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL); //;new
-    // FormLayout();
+    // new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL); //;new FormLayout();
     TextField myfield;
     Label myerror;
 
@@ -39,7 +40,7 @@ public class SSNField extends CustomComponent implements
         public void validate(Object value) throws InvalidValueException {
             final String ssn = (String) value;
             if (ssn.length() == 0)
-                return;
+               return;
 
             if (ssn.length() != 11)
                 throw new InvalidValueException("Invalid SSN length");
@@ -65,10 +66,8 @@ public class SSNField extends CustomComponent implements
         /* Create and set the validator object for the field. */
         myfield.addValidator(new SSNValidator());
 
-        /*
-         * ValueChageEvent will be generated immediately when the component
-         * loses focus.
-         */
+        /* ValueChageEvent will be generated immediately when the component
+           loses focus. */
         myfield.setImmediate(true);
 
         /* Listen for ValueChangeEvent events. */
index 29190f0f3dce1d39152e73975cd0518a71b377e2..ddb8872a130968382d95fa6f880dbf06c0e7438a 100644 (file)
@@ -11,48 +11,42 @@ public class TableCellStyle extends CustomComponent {
     public TableCellStyle() {
         Table table = new Table("Table with Cell Styles");
         table.addStyleName("checkerboard");
-
+        
         // Add some columns in the table. In this example, the property IDs
         // of the container are integers so we can determine the column number
         // easily.
-        table.addContainerProperty("0", String.class, null, "", null, null); // Row
-                                                                             // header
-        for (int i = 0; i < 8; i++)
-            table.addContainerProperty("" + (i + 1), String.class, null, String
-                    .valueOf((char) (65 + i)), null, null);
-
+        table.addContainerProperty("0", String.class, null, "", null, null); // Row header
+        for (int i=0; i<8; i++)
+            table.addContainerProperty(""+(i+1), String.class, null,
+                                       String.valueOf((char) (65+i)), null, null);
+        
         // Add some items in the table.
-        table.addItem(new Object[] { "1", "R", "N", "B", "Q", "K", "B", "N",
-                "R" }, new Integer(0));
-        table.addItem(new Object[] { "2", "P", "P", "P", "P", "P", "P", "P",
-                "P" }, new Integer(1));
-        for (int i = 2; i < 6; i++)
-            table.addItem(new Object[] { String.valueOf(i + 1), "", "", "", "",
-                    "", "", "", "" }, new Integer(i));
-        table.addItem(new Object[] { "7", "P", "P", "P", "P", "P", "P", "P",
-                "P" }, new Integer(6));
-        table.addItem(new Object[] { "8", "R", "N", "B", "Q", "K", "B", "N",
-                "R" }, new Integer(7));
+        table.addItem(new Object[]{"1", "R", "N", "B", "Q", "K", "B", "N", "R"}, new Integer(0));
+        table.addItem(new Object[]{"2", "P", "P", "P", "P", "P", "P", "P", "P"}, new Integer(1));
+        for (int i=2; i<6; i++)
+            table.addItem(new Object[]{String.valueOf(i+1), "", "", "", "", "", "", "", ""}, new Integer(i));
+        table.addItem(new Object[]{"7", "P", "P", "P", "P", "P", "P", "P", "P"}, new Integer(6));
+        table.addItem(new Object[]{"8", "R", "N", "B", "Q", "K", "B", "N", "R"}, new Integer(7));
         table.setPageLength(8);
-
+        
         // Set cell style generator
         table.setCellStyleGenerator(new Table.CellStyleGenerator() {
             public String getStyle(Object itemId, Object propertyId) {
-                int row = ((Integer) itemId).intValue();
-                int col = Integer.parseInt((String) propertyId);
-
+                int row = ((Integer)itemId).intValue();
+                int col = Integer.parseInt((String)propertyId);
+                
                 // The first column.
                 if (col == 0)
                     return "rowheader";
-
+                
                 // Other cells.
-                if ((row + col) % 2 == 1)
+                if ((row+col)%2 == 1)
                     return "black";
                 else
                     return "white";
             }
         });
-
+        
         setCompositionRoot(table);
     }
 }
index 5941d474ba3b190c257682faf33bd299f886f0b1..76c4f4e100d283ba628e7ce8077dcff2b2af00b8 100644 (file)
@@ -10,45 +10,50 @@ import java.util.GregorianCalendar;
 
 import com.itmill.toolkit.data.Property;
 import com.itmill.toolkit.data.Property.ValueChangeEvent;
+import com.itmill.toolkit.ui.Button;
 import com.itmill.toolkit.ui.CheckBox;
 import com.itmill.toolkit.ui.CustomComponent;
+import com.itmill.toolkit.ui.Label;
 import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.RichTextArea;
 import com.itmill.toolkit.ui.Table;
+import com.itmill.toolkit.ui.TextField;
+import com.itmill.toolkit.ui.Button.ClickEvent;
 
 public class TableEditable extends CustomComponent {
     /* A layout needed for the example. */
     OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
-
+    
     TableEditable() {
         setCompositionRoot(layout);
 
         // Create a table. It is by default not editable.
         final Table table = new Table();
-
+        
         // Define the names and data types of columns.
-        table.addContainerProperty("Date", Date.class, null);
-        table.addContainerProperty("Work", Boolean.class, null);
-        table.addContainerProperty("Comments", String.class, null);
-
+        table.addContainerProperty("Date",     Date.class,  null);
+        table.addContainerProperty("Work",     Boolean.class, null);
+        table.addContainerProperty("Comments", String.class,  null);
+        
         // Add a few items in the table.
-        for (int i = 0; i < 100; i++) {
-            Calendar calendar = new GregorianCalendar(2008, 0, 1);
+        for (int i=0; i<100; i++) {
+            Calendar calendar = new GregorianCalendar(2008,0,1);
             calendar.add(Calendar.DAY_OF_YEAR, i);
-
+            
             // Create the table row.
-            table.addItem(new Object[] { calendar.getTime(),
-                    new Boolean(false), "" }, new Integer(i)); // Item
-                                                               // identifier
+            table.addItem(new Object[] {calendar.getTime(),
+                                        new Boolean(false),
+                                        ""},
+                          new Integer(i)); // Item identifier
         }
-
+        
         table.setPageLength(8);
         layout.addComponent(table);
-
+        
         final CheckBox switchEditable = new CheckBox("Editable");
         switchEditable.addListener(new Property.ValueChangeListener() {
             public void valueChange(ValueChangeEvent event) {
-                table.setEditable(((Boolean) event.getProperty().getValue())
-                        .booleanValue());
+                table.setEditable(((Boolean)event.getProperty().getValue()).booleanValue());
             }
         });
         switchEditable.setImmediate(true);
index f8fd7ebd8fba893933d7c849b8c0e74ebbe35075..1029eabee299b1445dda2fb8610ae4ce20403dab 100644 (file)
@@ -22,29 +22,29 @@ import com.itmill.toolkit.ui.OrderedLayout;
 import com.itmill.toolkit.ui.Table;
 
 /**
- * Shows how to bind a bean to a table and make it editable.
+ *  Shows how to bind a bean to a table and make it editable. 
  */
 public class TableEditableBean extends CustomComponent {
     /**
      * Let's have a simple example bean.
      */
-    public class MyBean {
-        boolean selected;
-        String text;
-
-        public MyBean() {
-            this.selected = false;
-            this.text = "";
-        }
-
-        public boolean isSelected() {
-            System.out.println("isSelected() called: " + selected);
+       public class MyBean {
+               boolean selected;
+               String  text;
+               
+               public MyBean() {
+                       this.selected = false;
+                       this.text     = "";
+               }
+
+               public boolean isSelected() {
+                   System.out.println("isSelected() called: " + selected);
             return selected;
         }
 
         public void setSelected(boolean selected) {
             this.selected = selected;
-            System.out.println("setSelected1(" + selected + ") called.");
+            System.out.println("setSelected1("+selected+") called.");
         }
 
         public String getText() {
@@ -54,26 +54,26 @@ public class TableEditableBean extends CustomComponent {
 
         public void setText(String text) {
             this.text = text;
-            System.out.println("setText(" + text + ") called.");
+            System.out.println("setText("+text+") called.");
         }
-    };
+       };
 
     /**
      * Custom field factory that sets the fields as immediate for debugging
      * purposes. This is not normally necessary, unless you want to have some
      * interaction that requires it.
      */
-    public class MyFieldFactory extends BaseFieldFactory {
-        public Field createField(Class type, Component uiContext) {
-            // Let the BaseFieldFactory create the fields
-            Field field = super.createField(type, uiContext);
-
-            // ...and just set them as immediate
-            ((AbstractField) field).setImmediate(true);
-
+       public class MyFieldFactory extends BaseFieldFactory {
+           public Field createField(Class type, Component uiContext) {
+               // Let the BaseFieldFactory create the fields
+               Field field = super.createField(type, uiContext);
+               
+               // ...and just set them as immediate
+               ((AbstractField)field).setImmediate(true);
+               
             return field;
-        }
-    }
+           }
+       }
 
     /**
      * This is a custom container that allows adding BeanItems inside it. The
@@ -83,13 +83,13 @@ public class TableEditableBean extends CustomComponent {
      * Most of the interface methods are implemented with just dummy
      * implementations, as they are not needed in this example.
      */
-    public class MyContainer implements Container {
+       public class MyContainer implements Container {
         Item[] items;
-        int current = 0;
-
-        public MyContainer() {
-            items = new Item[100]; // Yeah this is just a test
-        }
+        int    current = 0;
+           
+           public MyContainer() {
+               items = new Item[100]; // Yeah this is just a test
+           }
 
         public boolean addContainerProperty(Object propertyId, Class type,
                 Object defaultValue) throws UnsupportedOperationException {
@@ -105,8 +105,8 @@ public class TableEditableBean extends CustomComponent {
         }
 
         /**
-         * This addItem method is specific for this container and allows adding
-         * BeanItem objects. The BeanItems must be bound to MyBean objects.
+         *  This addItem method is specific for this container and allows adding
+         *  BeanItem objects. The BeanItems must be bound to MyBean objects.   
          */
         public void addItem(BeanItem item) throws UnsupportedOperationException {
             items[current++] = item;
@@ -114,7 +114,7 @@ public class TableEditableBean extends CustomComponent {
 
         public boolean containsId(Object itemId) {
             if (itemId instanceof Integer) {
-                int pos = ((Integer) itemId).intValue();
+                int pos = ((Integer)itemId).intValue();
                 if (pos >= 0 && pos < 100)
                     return items[pos] != null;
             }
@@ -128,10 +128,10 @@ public class TableEditableBean extends CustomComponent {
          */
         public Property getContainerProperty(Object itemId, Object propertyId) {
             if (itemId instanceof Integer) {
-                int pos = ((Integer) itemId).intValue();
+                int pos = ((Integer)itemId).intValue();
                 if (pos >= 0 && pos < 100) {
                     Item item = items[pos];
-
+                    
                     // The BeanItem provides the property objects for the items.
                     return item.getItemProperty(propertyId);
                 }
@@ -143,14 +143,14 @@ public class TableEditableBean extends CustomComponent {
         public Collection getContainerPropertyIds() {
             // This container can contain only BeanItems bound to MyBeans.
             Item item = new BeanItem(new MyBean());
-
+            
             // The BeanItem knows how to get the property names from the bean.
             return item.getItemPropertyIds();
         }
 
         public Item getItem(Object itemId) {
             if (itemId instanceof Integer) {
-                int pos = ((Integer) itemId).intValue();
+                int pos = ((Integer)itemId).intValue();
                 if (pos >= 0 && pos < 100)
                     return items[pos];
             }
@@ -159,7 +159,7 @@ public class TableEditableBean extends CustomComponent {
 
         public Collection getItemIds() {
             Vector ids = new Vector();
-            for (int i = 0; i < 100; i++)
+            for (int i=0; i<100; i++)
                 ids.add(Integer.valueOf(i));
             return ids;
         }
@@ -185,51 +185,48 @@ public class TableEditableBean extends CustomComponent {
         public int size() {
             return current;
         }
-
-    }
+           
+       }
 
     TableEditableBean() {
         /* A layout needed for the example. */
-        OrderedLayout layout = new OrderedLayout(
-                OrderedLayout.ORIENTATION_VERTICAL);
+        OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
         setCompositionRoot(layout);
 
         // Create a table. It is by default not editable.
         final Table table = new Table();
         layout.addComponent(table);
         table.setPageLength(8);
-
+        
         // Use the custom container as the data source
         MyContainer myContainer = new MyContainer();
         table.setContainerDataSource(myContainer);
-
+        
         // Add a few items in the table.
-        for (int i = 0; i < 5; i++) {
+        for (int i=0; i<5; i++) {
             // Create the bean
-            MyBean item = new MyBean();
-            item.setText("MyBean " + i);
-
-            // Have an Item that is bound to the bean
-            BeanItem bitem = new BeanItem(item);
-
-            // Add the item directly to the container using the custom addItem()
+               MyBean item = new MyBean();
+               item.setText("MyBean " + i);
+               
+               // Have an Item that is bound to the bean
+               BeanItem bitem = new BeanItem(item);
+               
+               // Add the item directly to the container using the custom addItem()
             // method. We could otherwise add it to the Table as well, but
             // the Container interface of Table does not allow adding items
-            // as such, just item IDs.
-            myContainer.addItem(bitem);
+               // as such, just item IDs.
+               myContainer.addItem(bitem);
         }
-
+        
         // Use custom field factory that sets the checkboxes in immediate mode.
         // This is just for debugging purposes and is not normally necessary.
         table.setFieldFactory(new MyFieldFactory());
 
-        // Have a check box to switch the table between normal and editable
-        // mode.
+        // Have a check box to switch the table between normal and editable mode.
         final CheckBox switchEditable = new CheckBox("Editable");
         switchEditable.addListener(new Property.ValueChangeListener() {
             public void valueChange(ValueChangeEvent event) {
-                table.setEditable(((Boolean) event.getProperty().getValue())
-                        .booleanValue());
+                table.setEditable(((Boolean)event.getProperty().getValue()).booleanValue());
             }
         });
         switchEditable.setImmediate(true);
index 4d888eaeae72653a9ca4ace39fca74c8d81cfa3b..80c5dad3b0c3e418cd9456b893eced295c613cef 100644 (file)
@@ -26,28 +26,22 @@ public class TableExample extends CustomComponent {
         layout.addComponent(table);
 
         /* Define the names, data types, and default values of columns. */
-        table.addContainerProperty("First Name", String.class,
-                "(no first name)");
-        table.addContainerProperty("Last Name", String.class, "(no last name)");
-        table.addContainerProperty("Year", Integer.class, null);
+        table.addContainerProperty("First Name", String.class,  "(no first name)");
+        table.addContainerProperty("Last Name",  String.class,  "(no last name)");
+        table.addContainerProperty("Year",       Integer.class, null);
 
         /* We use these entries to generate random items in a table. */
-        final String[] firstnames = new String[] { "Donald", "Patty", "Sally",
-                "Douglas" };
-        final String[] lastnames = new String[] { "Smith", "Jones", "Adams",
-                "Knuth" };
+        final String[] firstnames = new String[] { "Donald", "Patty", "Sally", "Douglas" };
+        final String[] lastnames  = new String[] { "Smith", "Jones", "Adams", "Knuth" };
 
         /* Add some items in the table and assign them an Item ID (IID). */
         for (int i = 0; i < 1000; i++) {
             /* Add a randomly generated item in the Table. */
-            table
-                    .addItem(
-                            new Object[] {
-                                    firstnames[(int) (Math.random() * (firstnames.length - 0.01))],
-                                    lastnames[(int) (Math.random() * (lastnames.length - 0.01))],
-                                    new Integer(
-                                            (int) (1900 + Math.random() * 100)) },
-                            new Integer(i));
+            table.addItem(new Object[] {
+                        firstnames[(int) (Math.random() * (firstnames.length - 0.01))],
+                        lastnames[(int) (Math.random() * (lastnames.length - 0.01))],
+                        new Integer((int) (1900 + Math.random() * 100)) },
+                    new Integer(i));
         }
 
         /* Set the number of items visible in the table. */
@@ -59,20 +53,17 @@ public class TableExample extends CustomComponent {
 
         /* Allow selecting items from the table. */
         table.setSelectable(true);
-
-        /*
-         * When an item is selected, the selection is sent immediately to
-         * server.
-         */
+        
+        /* When an item is selected, the selection is sent immediately to server. */
         table.setImmediate(true);
-
+        
         /* Handle selection change. */
         table.addListener(new Property.ValueChangeListener() {
             public void valueChange(ValueChangeEvent event) {
                 current.setValue("Selected: " + table.getValue().toString());
             }
         });
-
+        
         layout.addComponent(current);
     }
 }
index cf9ad1d438d248519390c9b5d04708c96734f1cf..52d1513394942a7216e2a4715e3b2b6121063605 100644 (file)
@@ -17,29 +17,21 @@ public class TableExample1 extends CustomComponent {
 
         /* Create the table with a caption. */
         Table table = new Table("This is my Table");
-
-        /*
-         * Define the names and data types of columns. The "default value"
-         * parameter is meaningless here.
-         */
-        table.addContainerProperty("First Name", String.class, null);
-        table.addContainerProperty("Last Name", String.class, null);
-        table.addContainerProperty("Year", Integer.class, null);
+        
+        /* Define the names and data types of columns.
+         * The "default value" parameter is meaningless here. */
+        table.addContainerProperty("First Name", String.class,  null);
+        table.addContainerProperty("Last Name",  String.class,  null);
+        table.addContainerProperty("Year",       Integer.class, null);
 
         /* Add a few items in the table. */
-        table.addItem(new Object[] { "Nicolaus", "Copernicus",
-                new Integer(1473) }, new Integer(1));
-        table.addItem(new Object[] { "Tycho", "Brahe", new Integer(1546) },
-                new Integer(2));
-        table.addItem(new Object[] { "Giordano", "Bruno", new Integer(1548) },
-                new Integer(3));
-        table.addItem(new Object[] { "Galileo", "Galilei", new Integer(1564) },
-                new Integer(4));
-        table.addItem(new Object[] { "Johannes", "Kepler", new Integer(1571) },
-                new Integer(5));
-        table.addItem(new Object[] { "Isaac", "Newton", new Integer(1643) },
-                new Integer(6));
-
+        table.addItem(new Object[] {"Nicolaus","Copernicus",new Integer(1473)}, new Integer(1));
+        table.addItem(new Object[] {"Tycho",   "Brahe",     new Integer(1546)}, new Integer(2));
+        table.addItem(new Object[] {"Giordano","Bruno",     new Integer(1548)}, new Integer(3));
+        table.addItem(new Object[] {"Galileo", "Galilei",   new Integer(1564)}, new Integer(4));
+        table.addItem(new Object[] {"Johannes","Kepler",    new Integer(1571)}, new Integer(5));
+        table.addItem(new Object[] {"Isaac",   "Newton",    new Integer(1643)}, new Integer(6));
+        
         /* Set number of visible rows. */
         table.setPageLength(5);
 
index 3472300123eb0cda28a94d2c50ba80e297fa1be8..f82c96c68d70e7bc32883faf31bb85992ade8aae 100644 (file)
@@ -14,45 +14,34 @@ import com.itmill.toolkit.ui.Table;
 public class TableExample2 extends CustomComponent {
     /* A layout needed for the example. */
     OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
-
+    
     TableExample2() {
         setCompositionRoot(layout);
 
         /* Create the table with a caption. */
         final Table table = new Table();
-
-        /*
-         * Define the names and data types of columns. The "default value"
-         * parameter is meaningless here.
-         */
-        table.addContainerProperty("First Name", String.class, null);
-        table.addContainerProperty("Last Name", String.class, null);
-        table.addContainerProperty("Year", Integer.class, null);
+        
+        /* Define the names and data types of columns.
+         * The "default value" parameter is meaningless here. */
+        table.addContainerProperty("First Name", String.class,  null);
+        table.addContainerProperty("Last Name",  String.class,  null);
+        table.addContainerProperty("Year",       Integer.class, null);
 
         /* Add a few items in the table. */
-        table.addItem(new Object[] { "Nicolaus", "Copernicus",
-                new Integer(1473) }, new Integer(1));
-        table.addItem(new Object[] { "Tycho", "Brahe", new Integer(1546) },
-                new Integer(2));
-        table.addItem(new Object[] { "Giordano", "Bruno", new Integer(1548) },
-                new Integer(3));
-        table.addItem(new Object[] { "Galileo", "Galilei", new Integer(1564) },
-                new Integer(4));
-        table.addItem(new Object[] { "Johannes", "Kepler", new Integer(1571) },
-                new Integer(5));
-        table.addItem(new Object[] { "Isaac", "Newton", new Integer(1643) },
-                new Integer(6));
-
+        table.addItem(new Object[] {"Nicolaus","Copernicus",new Integer(1473)}, new Integer(1));
+        table.addItem(new Object[] {"Tycho",   "Brahe",     new Integer(1546)}, new Integer(2));
+        table.addItem(new Object[] {"Giordano","Bruno",     new Integer(1548)}, new Integer(3));
+        table.addItem(new Object[] {"Galileo", "Galilei",   new Integer(1564)}, new Integer(4));
+        table.addItem(new Object[] {"Johannes","Kepler",    new Integer(1571)}, new Integer(5));
+        table.addItem(new Object[] {"Isaac",   "Newton",    new Integer(1643)}, new Integer(6));
+        
         /* Set number of visible rows. */
         table.setPageLength(5);
 
         /* Allow selecting items from the table. */
         table.setSelectable(true);
-
-        /*
-         * When an item is selected, the selection is sent immediately to
-         * server.
-         */
+        
+        /* When an item is selected, the selection is sent immediately to server. */
         table.setImmediate(true);
 
         /* Feedback from selection. */
index 152d0ed4c90a0d2b277d1ff0d620c1ddc3a49535..cf20a8bf49e950706d9ce8a4b61d1f8afbc30558 100644 (file)
@@ -4,11 +4,14 @@
 
 package com.itmill.toolkit.tests.book;
 
+import com.itmill.toolkit.data.Property;
+import com.itmill.toolkit.data.Property.ValueChangeEvent;
 import com.itmill.toolkit.ui.Button;
 import com.itmill.toolkit.ui.CheckBox;
 import com.itmill.toolkit.ui.CustomComponent;
 import com.itmill.toolkit.ui.Label;
 import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.RichTextArea;
 import com.itmill.toolkit.ui.Table;
 import com.itmill.toolkit.ui.TextField;
 import com.itmill.toolkit.ui.Button.ClickEvent;
@@ -16,41 +19,37 @@ import com.itmill.toolkit.ui.Button.ClickEvent;
 public class TableExample3 extends CustomComponent {
     /* A layout needed for the example. */
     OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
-
+    
     TableExample3() {
         setCompositionRoot(layout);
 
-        // Create a table and add a style to allow setting the row height in
-        // theme.
+        // Create a table and add a style to allow setting the row height in theme.
         final Table table = new Table();
         table.addStyleName("components-inside");
-
-        /*
-         * Define the names and data types of columns. The "default value"
-         * parameter is meaningless here.
-         */
-        table.addContainerProperty("Sum", Label.class, null);
-        table.addContainerProperty("Is Transferred", CheckBox.class, null);
-        table.addContainerProperty("Comments", TextField.class, null);
-        table.addContainerProperty("Details", Button.class, null);
-
+        
+        /* Define the names and data types of columns.
+         * The "default value" parameter is meaningless here. */
+        table.addContainerProperty("Sum",            Label.class,     null);
+        table.addContainerProperty("Is Transferred", CheckBox.class,  null);
+        table.addContainerProperty("Comments",       TextField.class, null);
+        table.addContainerProperty("Details",        Button.class,    null);
+        
         /* Add a few items in the table. */
-        for (int i = 0; i < 100; i++) {
+        for (int i=0; i<100; i++) {
             // Create the fields for the current table row
-            Label sumField = new Label(String.format(
-                    "Sum is <b>$%04.2f</b><br/><i>(VAT incl.)</i>",
-                    new Object[] { new Double(Math.random() * 1000) }),
-                    Label.CONTENT_XHTML);
+            Label sumField = new Label(String.format("Sum is <b>$%04.2f</b><br/><i>(VAT incl.)</i>",
+                                  new Object[] {new Double(Math.random()*1000)}),
+                                  Label.CONTENT_XHTML);
             CheckBox transferredField = new CheckBox("is transferred");
-
+            
             // Multiline text field. This required modifying the height of the
             // table row.
             TextField commentsField = new TextField();
             commentsField.setRows(3);
-
+            
             // The Table item identifier for the row.
             Integer itemId = new Integer(i);
-
+            
             // Create a button and handle its click. A Button does not know
             // the item it is contained in, so we have to store the item
             // ID as user-defined data.
@@ -59,16 +58,16 @@ public class TableExample3 extends CustomComponent {
             detailsField.addListener(new Button.ClickListener() {
                 public void buttonClick(ClickEvent event) {
                     // Get the item identifier from the user-defined data.
-                    Integer itemId = (Integer) event.getButton().getData();
-                    getWindow().showNotification(
-                            "Link " + itemId.intValue() + " clicked.");
-                }
+                    Integer itemId = (Integer)event.getButton().getData();
+                    getWindow().showNotification("Link "+itemId.intValue()+" clicked.");
+                } 
             });
             detailsField.addStyleName("link");
-
+            
             // Create the table row.
-            table.addItem(new Object[] { sumField, transferredField,
-                    commentsField, detailsField }, itemId);
+            table.addItem(new Object[] {sumField, transferredField,
+                                        commentsField, detailsField},
+                          itemId);
         }
 
         // Show just three rows because they are so high.
@@ -76,8 +75,8 @@ public class TableExample3 extends CustomComponent {
 
         // Initially show the 50th item in the top of the table.
         table.setCurrentPageFirstItemIndex(50);
-        // table.setCurrentPageFirstItemId(initial);
-
+        //table.setCurrentPageFirstItemId(initial);
+        
         layout.addComponent(table);
     }
 }
index 82975634c1ab6af6552d42da077549710b9ee74d..411153dc18132fcce732062466a879f107758341 100644 (file)
@@ -23,9 +23,9 @@ public class TableHuge extends CustomComponent {
      * This is a virtual container that generates the items on the fly when
      * requested.
      */
-    public class HugeContainer implements Container, Indexed {
+    public class HugeContainer implements Container,Indexed {
         int numberofitems;
-
+        
         public HugeContainer(int numberofitems) {
             this.numberofitems = numberofitems;
         }
@@ -68,8 +68,7 @@ public class TableHuge extends CustomComponent {
             if (itemId instanceof Integer) {
                 int pos = ((Integer) itemId).intValue();
                 if (pos >= 0 && pos < numberofitems) {
-                    return new ObjectProperty("This is the item " + pos
-                            + " in the huge table");
+                    return new ObjectProperty("This is the item "+pos+" in the huge table");
                 }
             }
             return null;
@@ -84,11 +83,10 @@ public class TableHuge extends CustomComponent {
 
         public Item getItem(Object itemId) {
             if (itemId instanceof Integer) {
-                int pos = ((Integer) itemId).intValue();
+                int pos = ((Integer)itemId).intValue();
                 if (pos >= 0 && pos < numberofitems) {
                     Item item = new PropertysetItem();
-                    item.addItemProperty("id", new ObjectProperty(
-                            "This is the item " + pos + " in the huge table"));
+                    item.addItemProperty("id", new ObjectProperty("This is the item "+pos+" in the huge table"));
                     return item;
                 }
             }
@@ -162,25 +160,25 @@ public class TableHuge extends CustomComponent {
         }
 
         public boolean isLastId(Object itemId) {
-            return ((Integer) itemId).intValue() == (numberofitems - 1);
+            return ((Integer) itemId).intValue() == (numberofitems-1);
         }
 
         public Object lastItemId() {
-            return new Integer(numberofitems - 1);
+            return new Integer(numberofitems-1);
         }
 
         public Object nextItemId(Object itemId) {
             int pos = indexOfId(itemId);
-            if (pos >= numberofitems - 1)
+            if (pos >= numberofitems-1)
                 return null;
-            return getIdByIndex(pos + 1);
+            return getIdByIndex(pos+1);
         }
 
         public Object prevItemId(Object itemId) {
             int pos = indexOfId(itemId);
             if (pos <= 0)
                 return null;
-            return getIdByIndex(pos - 1);
+            return getIdByIndex(pos-1);
         }
     }
 
@@ -188,7 +186,7 @@ public class TableHuge extends CustomComponent {
         Table table = new Table("HUGE table, REALLY HUGE");
         table.setContainerDataSource(new HugeContainer(500000));
         table.setPageLength(20);
-
+        
         setCompositionRoot(table);
     }
 }
index 002538ae7d6f04266a8cbff67cda5a7d949b0e93..5e5f673fa7c427b79e17196f17c8ef5f8e06ccda 100644 (file)
@@ -12,25 +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();
-
+        
         openbutton = new Button("Open Window", this, "openButtonClick");
         explanation = new Label("Explanation");
         layout.addComponent(openbutton);
         layout.addComponent(explanation);
-
+        
         setCompositionRoot(layout);
     }
 
index 7e97e8d6bf4108d38dc509c966ec4de1087af2c6..0affc7a4f66b12766a445073c822fa723091384d 100644 (file)
@@ -11,8 +11,8 @@ import com.itmill.toolkit.ui.Window;
 import com.itmill.toolkit.ui.Button.ClickEvent;
 
 public class WindowTestApplication extends Application {
-    Window anotherpage = null;
-    HashMap windows = new HashMap();
+    Window  anotherpage = null;
+    HashMap windows     = new HashMap();
 
     public void init() {
         final Window main = new Window("Window Test Application");
@@ -36,40 +36,37 @@ public class WindowTestApplication extends Application {
                 new Button.ClickListener() {
                     public void buttonClick(ClickEvent event) {
                         // Open the window.
-                        main.open(new ExternalResource(mywindow.getURL()),
-                                "_new");
+                        main.open(new ExternalResource(mywindow.getURL()), "_new");
                     }
                 }));
 
         /* Add a link to the second window. */
         Link link = new Link("Click to open second window",
-                new ExternalResource(mywindow.getURL()));
+                             new ExternalResource(mywindow.getURL()));
         link.setTargetName("_new");
         main.addComponent(link);
 
         // Add the link manually inside a Label.
-        main.addComponent(new Label("Second window: <a href='"
-                + mywindow.getURL() + "' target='_new'>click to open</a>",
-                Label.CONTENT_XHTML));
-        main.addComponent(new Label(
-                "The second window can be accessed through URL: "
-                        + mywindow.getURL()));
+        main.addComponent(new Label("Second window: <a href='" + mywindow.getURL()
+                                    + "' target='_new'>click to open</a>",
+                                    Label.CONTENT_XHTML));
+        main.addComponent(new Label("The second window can be accessed through URL: "
+                                    + mywindow.getURL()));
 
         // Add links to windows that do not yet exist, but are created
         // dynamically when the URL is called.
         main.addComponent(new Label("URLs to open item windows:"));
         final String[] items = new String[] { "mercury", "venus", "earth",
                 "mars", "jupiter", "saturn", "uranus", "neptune" };
-
+        
         for (int inx = 0; inx < items.length; inx++) {
             String item = items[inx];
 
-            // We do not create window objects here, but just links to the
-            // windows
+            // We do not create window objects here, but just links to the windows
             String windowUrl = getURL() + "planet-" + item;
-            main.addComponent(new Label("A window about '" + item
-                    + "': <a href='" + windowUrl + "' target='_new'>"
-                    + windowUrl + "</a>", Label.CONTENT_XHTML));
+            main.addComponent(new Label("A window about '" + item + "': <a href='" + 
+                                        windowUrl + "' target='_new'>" + windowUrl + 
+                                        "</a>", Label.CONTENT_XHTML));
         }
     }
 
@@ -79,9 +76,8 @@ public class WindowTestApplication extends Application {
             if (!windows.containsKey(planetName)) {
                 // Create the window object on the fly.
                 Window newWindow = new Window("Yet Another Page");
-                newWindow.addComponent(new Label(
-                        "This window contains details about " + planetName
-                                + "."));
+                newWindow.addComponent(new Label("This window contains details about " +
+                                                 planetName + "."));
                 windows.put(planetName, newWindow);
 
                 // We must add the window to the application, it is not done