]> source.dussan.org Git - vaadin-framework.git/commitdiff
Formatted project using Eclipse Galileo SR1
authorArtur Signell <artur.signell@itmill.com>
Tue, 12 Jan 2010 14:30:00 +0000 (14:30 +0000)
committerArtur Signell <artur.signell@itmill.com>
Tue, 12 Jan 2010 14:30:00 +0000 (14:30 +0000)
svn changeset:10696/svn branch:6.2

49 files changed:
src/com/vaadin/data/util/ObjectProperty.java
src/com/vaadin/data/validator/AbstractStringValidator.java
src/com/vaadin/data/validator/AbstractValidator.java
src/com/vaadin/data/validator/EmailValidator.java
src/com/vaadin/event/FieldEvents.java
src/com/vaadin/event/MethodEventSource.java
src/com/vaadin/launcher/util/BrowserLauncher.java
src/com/vaadin/terminal/Resource.java
src/com/vaadin/terminal/Sizeable.java
src/com/vaadin/terminal/Terminal.java
src/com/vaadin/terminal/gwt/client/Paintable.java
src/com/vaadin/terminal/gwt/client/ui/MenuBar.java
src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java
src/com/vaadin/terminal/gwt/client/ui/VPopupCalendar.java
src/com/vaadin/terminal/gwt/client/ui/VPopupView.java
src/com/vaadin/terminal/gwt/client/ui/VUriFragmentUtility.java
src/com/vaadin/terminal/gwt/client/ui/layout/ChildComponentContainer.java
src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextToolbar.java
src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
src/com/vaadin/terminal/gwt/server/AbstractWebApplicationContext.java
src/com/vaadin/terminal/gwt/server/ApplicationPortlet.java
src/com/vaadin/terminal/gwt/server/ApplicationRunnerServlet.java
src/com/vaadin/terminal/gwt/server/Constants.java
src/com/vaadin/terminal/gwt/server/HttpServletRequestListener.java
src/com/vaadin/terminal/gwt/server/HttpUploadStream.java
src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java
src/com/vaadin/terminal/gwt/server/PortletCommunicationManager.java
src/com/vaadin/terminal/gwt/server/RestrictedRenderResponse.java
src/com/vaadin/terminal/gwt/server/WebBrowser.java
src/com/vaadin/terminal/gwt/widgetsetutils/WidgetSetBuilder.java
src/com/vaadin/ui/BaseFieldFactory.java
tests/src/com/vaadin/automatedtests/featurebrowser/GeneratedColumnExample.java
tests/src/com/vaadin/automatedtests/robustness/Robustness.java
tests/src/com/vaadin/tests/BasicRandomTest.java
tests/src/com/vaadin/tests/Parameters.java
tests/src/com/vaadin/tests/TestBench.java
tests/src/com/vaadin/tests/book/BookTestApplication.java
tests/src/com/vaadin/tests/book/DefaultButtonExample.java
tests/src/com/vaadin/tests/book/TabSheetExample.java
tests/src/com/vaadin/tests/book/TableCellStyle.java
tests/src/com/vaadin/tests/book/TableEditable.java
tests/src/com/vaadin/tests/components/orderedlayout/ReplaceComponentNPE.java
tests/src/com/vaadin/tests/components/splitpanel/SplitPanelExtraScrollbars.java
tests/src/com/vaadin/tests/components/textfield/IE6Cursor.java
tests/src/com/vaadin/tests/components/textfield/TextFieldInLayoutInTable.java
tests/src/com/vaadin/tests/featurebrowser/FeatureUpload.java
tests/src/com/vaadin/tests/robustness/Robustness.java
tests/src/com/vaadin/tests/server/TransactionListenersConcurrency.java
tests/src/com/vaadin/tests/tickets/Ticket1365.java

index 6d58b2d92d09400289c2d78359fb0e3b4355fc62..8993b74a1ef7e0d73bf5d54974a651c61255d65a 100644 (file)
@@ -11,8 +11,8 @@ import com.vaadin.data.Property;
 
 /**
  * A simple data object containing one typed value. This class is a
- * straightforward implementation of the the
- * {@link com.vaadin.data.Property} interface.
+ * straightforward implementation of the the {@link com.vaadin.data.Property}
+ * interface.
  * 
  * @author IT Mill Ltd.
  * @version
index 7d08c69f29dc3eaf1a3bff409cca78156f79afc5..a81d48b6f5ec96927a345277edcef5e68525f68a 100644 (file)
@@ -2,8 +2,7 @@ package com.vaadin.data.validator;
 \r
 /**\r
  * Validator base class for validating strings. See\r
- * {@link com.vaadin.data.validator.AbstractValidator} for more\r
- * information.\r
+ * {@link com.vaadin.data.validator.AbstractValidator} for more information.\r
  * \r
  * <p>\r
  * If the validation fails, the exception thrown contains the error message with\r
index 5cfc8a57e8d3fe2f96ae3abc055e37d4c131cad0..94222049a9b5f0204735e54e87ec809ad4cffdd2 100644 (file)
@@ -3,8 +3,8 @@ package com.vaadin.data.validator;
 import com.vaadin.data.Validator;\r
 \r
 /**\r
- * Default Validator base class. See\r
- * {@link com.vaadin.data.validator.Validator} for more information.\r
+ * Default Validator base class. See {@link com.vaadin.data.validator.Validator}\r
+ * for more information.\r
  * <p>\r
  * If the validation fails, the exception thrown contains the error message with\r
  * its argument 0 replaced with the toString() of the object being validated.\r
index edb7c8ce8019d5c53cfa4329951254a36bd03cbc..24bfb166d6478e59b2156203578f909173dc5db6 100644 (file)
@@ -5,8 +5,8 @@ package com.vaadin.data.validator;
  * complete according to RFC 822 but handles the vast majority of valid e-mail\r
  * addresses correctly.\r
  * \r
- * See {@link com.vaadin.data.validator.AbstractStringValidator} for\r
- * more information.\r
+ * See {@link com.vaadin.data.validator.AbstractStringValidator} for more\r
+ * information.\r
  * \r
  * @author IT Mill Ltd.\r
  * @version\r
index b298590a8cec933eaa51d765574fe7aec827f502..0280aebb76a7ef62bcfa18d40da80a48a4aa6fca 100644 (file)
@@ -23,6 +23,7 @@ public interface FieldEvents {
      * class really will send the events, or if it just defines the methods to\r
      * be able to implement an interface.\r
      * </p>\r
+     * \r
      * @since 6.2\r
      * @see FocusListener\r
      * @see FocusEvent\r
@@ -60,6 +61,7 @@ public interface FieldEvents {
      * class really will send the events, or if it just defines the methods to\r
      * be able to implement an interface.\r
      * </p>\r
+     * \r
      * @since 6.2\r
      * @see BlurListener\r
      * @see BlurEvent\r
index 3fd8ef68be532e8e1d313a31247ba1fa8fcdeeb6..680aaad4b839478a568ff658b7bc1e8133059f36 100644 (file)
@@ -14,8 +14,7 @@ import java.lang.reflect.Method;
  * 
  * <p>
  * For more information on the inheritable event mechanism see the
- * {@link com.vaadin.event com.vaadin.event package
- * documentation}.
+ * {@link com.vaadin.event com.vaadin.event package documentation}.
  * </p>
  * 
  * @author IT Mill Ltd.
@@ -35,8 +34,7 @@ public interface MethodEventSource extends Serializable {
      * 
      * <p>
      * For more information on the inheritable event mechanism see the
-     * {@link com.vaadin.event com.vaadin.event package
-     * documentation}.
+     * {@link com.vaadin.event com.vaadin.event package documentation}.
      * </p>
      * 
      * @param eventType
@@ -69,8 +67,7 @@ public interface MethodEventSource extends Serializable {
      * 
      * <p>
      * For more information on the inheritable event mechanism see the
-     * {@link com.vaadin.event com.vaadin.event package
-     * documentation}.
+     * {@link com.vaadin.event com.vaadin.event package documentation}.
      * </p>
      * 
      * @param eventType
@@ -95,8 +92,7 @@ public interface MethodEventSource extends Serializable {
      * 
      * <p>
      * For more information on the inheritable event mechanism see the
-     * {@link com.vaadin.event com.vaadin.event package
-     * documentation}.
+     * {@link com.vaadin.event com.vaadin.event package documentation}.
      * </p>
      * 
      * @param eventType
@@ -114,8 +110,7 @@ public interface MethodEventSource extends Serializable {
      * 
      * <p>
      * For more information on the inheritable event mechanism see the
-     * {@link com.vaadin.event com.vaadin.event package
-     * documentation}.
+     * {@link com.vaadin.event com.vaadin.event package documentation}.
      * </p>
      * 
      * @param eventType
@@ -145,8 +140,7 @@ public interface MethodEventSource extends Serializable {
      * 
      * <p>
      * For more information on the inheritable event mechanism see the
-     * {@link com.vaadin.event com.vaadin.event package
-     * documentation}.
+     * {@link com.vaadin.event com.vaadin.event package documentation}.
      * </p>
      * 
      * @param eventType
index 9775bdc48e79220070fc6beefd7f64a0a749cc3e..f30a717cf6f7d53db545a6581a7975b557ee1be2 100644 (file)
@@ -35,33 +35,35 @@ public class BrowserLauncher {
             // See if the default browser is Konqueror by resolving the symlink.\r
             boolean isDefaultKonqueror = false;\r
             try {\r
-               // Find out the location of the x-www-browser link from path.\r
-               Process process = runtime.exec("which x-www-browser");\r
-               BufferedInputStream ins = new BufferedInputStream(process.getInputStream());\r
-               BufferedReader bufreader = new BufferedReader(new InputStreamReader(ins));\r
-               String defaultLinkPath = bufreader.readLine();\r
-               ins.close();\r
-\r
-               // The path is null if the link did not exist.\r
-               if (defaultLinkPath != null) {\r
-                       // See if the default browser is Konqueror.\r
-                       File file = new File(defaultLinkPath);\r
-                       String canonical = file.getCanonicalPath();\r
-                       if (canonical.indexOf("konqueror") != -1)\r
-                               isDefaultKonqueror = true;\r
-               }\r
+                // Find out the location of the x-www-browser link from path.\r
+                Process process = runtime.exec("which x-www-browser");\r
+                BufferedInputStream ins = new BufferedInputStream(process\r
+                        .getInputStream());\r
+                BufferedReader bufreader = new BufferedReader(\r
+                        new InputStreamReader(ins));\r
+                String defaultLinkPath = bufreader.readLine();\r
+                ins.close();\r
+\r
+                // The path is null if the link did not exist.\r
+                if (defaultLinkPath != null) {\r
+                    // See if the default browser is Konqueror.\r
+                    File file = new File(defaultLinkPath);\r
+                    String canonical = file.getCanonicalPath();\r
+                    if (canonical.indexOf("konqueror") != -1)\r
+                        isDefaultKonqueror = true;\r
+                }\r
             } catch (IOException e1) {\r
-               // The symlink was probably not found, so this is ok.\r
+                // The symlink was probably not found, so this is ok.\r
             }\r
 \r
             // Try x-www-browser, which is symlink to the default browser,\r
             // except if we found that it is Konqueror.\r
             if (!started && !isDefaultKonqueror) {\r
-               try {\r
-                       runtime.exec("x-www-browser " + url);\r
-                       started = true;\r
-               } catch (final IOException e) {\r
-               }\r
+                try {\r
+                    runtime.exec("x-www-browser " + url);\r
+                    started = true;\r
+                } catch (final IOException e) {\r
+                }\r
             }\r
 \r
             // Try firefox\r
index 07753aad168ba94b89e5cebe17b1883f2e8d9a06..2aee741f01c02ebb2a2426ab68c8b26a0e8472fe 100644 (file)
@@ -15,7 +15,7 @@ import java.io.Serializable;
  * @VERSION@
  * @since 3.0
  */
-public interface Resource extends Serializable{
+public interface Resource extends Serializable {
 
     /**
      * Gets the MIME type of the resource.
index 6c18f746f2be56e2208fdf0b8757442a41261b8a..0504451e198f0d66dd8aee2b0cc383f0c6a43208 100644 (file)
@@ -15,7 +15,7 @@ import java.io.Serializable;
  * @VERSION@
  * @since 3.0
  */
-public interface Sizeable extends Serializable{
+public interface Sizeable extends Serializable {
 
     /**
      * Unit code representing pixels.
index 4494bdc144ac716a2e903534c8fe591c8f7b2ff7..2ce013f6be3eae2d8da847be06f403bb81c0dd2e 100644 (file)
@@ -40,7 +40,7 @@ public interface Terminal extends Serializable {
     /**
      * Terminal error event.
      */
-    public interface ErrorEvent extends Serializable{
+    public interface ErrorEvent extends Serializable {
 
         /**
          * Gets the contained throwable.
@@ -52,7 +52,7 @@ public interface Terminal extends Serializable {
     /**
      * Terminal error listener interface.
      */
-    public interface ErrorListener extends Serializable{
+    public interface ErrorListener extends Serializable {
 
         /**
          * Invoked when terminal error occurs.
index 54713bd5b732ad73e065e83b50e6968f8d1ff78e..0cf557182992eea605367c7ef14ae061e023a84b 100644 (file)
@@ -8,7 +8,7 @@ package com.vaadin.terminal.gwt.client;
  * An interface used by client-side widgets or paintable parts to receive
  * updates from the corresponding server-side components in the form of
  * {@link UIDL}.
- *
+ * 
  * Updates can be sent back to the server using the
  * {@link ApplicationConnection#updateVariable()} methods.
  */
index f950014ad7212f4e4a15f7c2a134780bedf13911..5d10044d646be924fe93fa775d4d17175a5769af 100644 (file)
@@ -42,9 +42,13 @@ import com.google.gwt.user.client.ui.Widget;
  * <img class='gallery' src='MenuBar.png'/>
  * </p>
  * 
- * <h3>CSS Style Rules</h3> <ul class='css'> <li>.gwt-MenuBar { the menu bar
- * itself }</li> <li>.gwt-MenuBar .gwt-MenuItem { menu items }</li> <li>
- * .gwt-MenuBar .gwt-MenuItem-selected { selected menu items }</li> </ul>
+ * <h3>CSS Style Rules</h3>
+ * <ul class='css'>
+ * <li>.gwt-MenuBar { the menu bar itself }</li>
+ * <li>.gwt-MenuBar .gwt-MenuItem { menu items }</li>
+ * <li>
+ * .gwt-MenuBar .gwt-MenuItem-selected { selected menu items }</li>
+ * </ul>
  * 
  * <p>
  * <h3>Example</h3>
index ac23ad9c681bacc3a583c4579da806cc5c875b50..74c1a683e236aa4427db9d06ed54313bcab6bb96 100644 (file)
@@ -263,7 +263,7 @@ public class VCalendarPanel extends FlexTable implements MouseListener {
     }\r
 \r
     /**\r
-     *\r
+     * \r
      * @param forceRedraw\r
      *            Build all from scratch, in case of e.g. locale changes\r
      */\r
@@ -447,8 +447,8 @@ public class VCalendarPanel extends FlexTable implements MouseListener {
             Object sender = event.getSource();\r
             Cell cell = cal.days.getCellForEvent(event);\r
             if (sender != cal.days || cell == null || cell.getRowIndex() < 1\r
-                    || cell.getRowIndex() > 6\r
-                    || !cal.datefield.isEnabled() || cal.datefield.isReadonly()) {\r
+                    || cell.getRowIndex() > 6 || !cal.datefield.isEnabled()\r
+                    || cal.datefield.isReadonly()) {\r
                 return;\r
             }\r
 \r
@@ -540,7 +540,7 @@ public class VCalendarPanel extends FlexTable implements MouseListener {
 \r
     /**\r
      * Sets focus to Calendar panel.\r
-     *\r
+     * \r
      * @param focus\r
      */\r
     public void setFocus(boolean focus) {\r
index 0f269722de8fa9640641a515929a77721f8da010..8d83e8b2b54745afea345b9d3c3691c8ef1dcaad 100644 (file)
@@ -93,7 +93,7 @@ public class VPopupCalendar extends VTextualDate implements Paintable, Field,
                     boolean overflowRight = false;\r
                     if (l + +w + extraSpace > browserWindowWidth) {\r
                         overflowRight = true;\r
-                        // Part of the popup is outside the browser window \r
+                        // Part of the popup is outside the browser window\r
                         // (to the right)\r
                         l = browserWindowWidth - w - extraSpace;\r
                     }\r
index 866ca99a0fc0ed76628b90eca75b184402362b0f..807c144b33f8bf0113e4ea976913db5f63154f69 100644 (file)
@@ -153,12 +153,12 @@ public class VPopupView extends HTML implements Container, Iterable<Widget> {
     /**
      * Determines the correct position for a popup and displays the popup at
      * that position.
-     *
+     * 
      * By default, the popup is shown centered relative to its host component,
      * ensuring it is visible on the screen if possible.
-     *
+     * 
      * Can be overridden to customize the popup position.
-     *
+     * 
      * @param popup
      */
     protected void showPopup(final CustomPopup popup) {
index f0d571e741e533f0204ce57e79217faf4151ec72..bf57d23585fed112c965233eb3f88b976b0957b2 100644 (file)
@@ -14,7 +14,7 @@ import com.vaadin.terminal.gwt.client.UIDL;
 /**
  * Client side implementation for UriFragmentUtility. Uses GWT's History object
  * as an implementation.
- *
+ * 
  */
 public class VUriFragmentUtility extends Widget implements Paintable,
         ValueChangeHandler<String> {
index ccda36ff8eea8fe3871d94460557768ae746fd51..a29c915c526bf3d7e34ba2425c55b321376040b1 100644 (file)
@@ -40,7 +40,7 @@ public class ChildComponentContainer extends Panel {
     private int captionHeight = 0;
 
     /**
-     *
+     * 
      * Padding added to the container when it is larger than the component.
      */
     private Size containerExpansion = new Size(0, 0);
@@ -189,14 +189,14 @@ public class ChildComponentContainer extends Panel {
         /*
          * Must remove width specification from container before rendering to
          * allow components to grow in horizontal direction.
-         *
+         * 
          * For fixed width layouts we specify the width directly so that height
          * is automatically calculated correctly (e.g. for Labels).
          */
         /*
          * This should no longer be needed (after #2563) as all components are
          * such that they can be rendered inside a 0x0 DIV.
-         *
+         * 
          * The exception seems to be complex components (Tree and Table) on
          * Opera (#3444).
          */
@@ -611,7 +611,7 @@ public class ChildComponentContainer extends Panel {
     /**
      * Return true if the size of the widget has been specified in the selected
      * orientation.
-     *
+     * 
      * @return
      */
     public boolean widgetHasSizeSpecified(int orientation) {
@@ -654,7 +654,7 @@ public class ChildComponentContainer extends Panel {
     /**
      * Sets the normalized expand ratio of this slot. The fraction that this
      * slot will use of "excess space".
-     *
+     * 
      * @param expandRatio
      */
     public void setNormalizedExpandRatio(double expandRatio) {
index a6754a04b035e8ac48cd3c94f987b3406ac00ffe..5b224dc68901aabbd821158ffdcfaf21b87bc6e4 100644 (file)
@@ -319,7 +319,7 @@ public class VRichTextToolbar extends Composite {
 
     /**
      * Creates a new toolbar that drives the given rich text area.
-     *
+     * 
      * @param richText
      *            the rich text area to be controlled
      */
index eda9670ff72657800dad8df6812fcd21a043b72a..428a9b38b9f9b69b36234bf1eba3e9f847b944b3 100644 (file)
@@ -51,7 +51,7 @@ import com.vaadin.ui.Window;
 
 /**
  * TODO Document me!
- *
+ * 
  * @author peholmst
  */
 public abstract class AbstractApplicationPortlet extends GenericPortlet
@@ -136,7 +136,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
 
     /**
      * Gets an application property value.
-     *
+     * 
      * @param parameterName
      *            the Name or the parameter.
      * @return String value or null if not found
@@ -157,7 +157,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
 
     /**
      * Gets an system property value.
-     *
+     * 
      * @param parameterName
      *            the Name or the parameter.
      * @return String value or null if not found
@@ -186,7 +186,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
 
     /**
      * Gets an application or system property value.
-     *
+     * 
      * @param parameterName
      *            the Name or the parameter.
      * @param defaultValue
@@ -217,7 +217,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
      * Return the URL from where static files, e.g. the widgetset and the theme,
      * are served. In a standard configuration the VAADIN folder inside the
      * returned folder is what is used for widgetsets and themes.
-     *
+     * 
      * @param request
      * @return The location of static resources (inside which there should be a
      *         VAADIN directory). Does not end with a slash (/).
@@ -292,7 +292,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
     /**
      * Returns true if the servlet is running in production mode. Production
      * mode disables all debug facilities.
-     *
+     * 
      * @return true if in production mode, false if in debug mode
      */
     public boolean isProductionMode() {
@@ -655,15 +655,15 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
      * application with window names identical to the portlet mode names.
      * Alternatively, a PortletListener can change the application main window
      * contents.
-     *
+     * 
      * To implement custom portlet modes, subclass the portlet class and
      * implement a method annotated with {@link RenderMode} for the custom mode,
      * calling {@link #handleRequest(PortletRequest, PortletResponse)} directly
      * from it.
-     *
+     * 
      * Note that the portlet class in the portlet configuration needs to be
      * changed when overriding methods of this class.
-     *
+     * 
      * @param request
      * @param response
      * @throws PortletException
@@ -677,7 +677,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
 
     /**
      * Handle a request for the "edit" portlet mode.
-     *
+     * 
      * @see #doView(RenderRequest, RenderResponse)
      */
     @Override
@@ -688,7 +688,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
 
     /**
      * Handle a request for the "help" portlet mode.
-     *
+     * 
      * @see #doView(RenderRequest, RenderResponse)
      */
     @Override
@@ -1012,7 +1012,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
 
     /**
      * Returns the theme for given request/window
-     *
+     * 
      * @param request
      * @param window
      * @return
@@ -1063,7 +1063,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
 
     /**
      * Get system messages from the current application class
-     *
+     * 
      * @return
      */
     protected SystemMessages getSystemMessages() {
@@ -1136,7 +1136,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
      * Send notification to client's application. Used to notify client of
      * critical errors and session expiration due to long inactivity. Server has
      * no knowledge of what application client refers to.
-     *
+     * 
      * @param request
      *            the Portlet request instance.
      * @param response
index 39d660c05b107b0aa5239a15f790c7f91408246b..d74eb99ec7c1ad06299b9ad315b9723f54d3c78e 100644 (file)
@@ -43,7 +43,7 @@ public abstract class AbstractWebApplicationContext implements
 \r
     /**\r
      * Sends a notification that a transaction is starting.\r
-     *\r
+     * \r
      * @param application\r
      *            The application associated with the transaction.\r
      * @param request\r
@@ -59,7 +59,7 @@ public abstract class AbstractWebApplicationContext implements
 \r
     /**\r
      * Sends a notification that a transaction has ended.\r
-     *\r
+     * \r
      * @param application\r
      *            The application associated with the transaction.\r
      * @param request\r
@@ -130,11 +130,11 @@ public abstract class AbstractWebApplicationContext implements
 \r
     /**\r
      * Get the web browser associated with this application context.\r
-     *\r
+     * \r
      * Because application context is related to the http session and server\r
      * maintains one session per browser-instance, each context has exactly one\r
      * web browser associated with it.\r
-     *\r
+     * \r
      * @return\r
      */\r
     public WebBrowser getBrowser() {\r
@@ -150,8 +150,8 @@ public abstract class AbstractWebApplicationContext implements
         applicationToAjaxAppMgrMap.remove(application);\r
     }\r
 \r
-    public String generateApplicationResourceURL(\r
-            ApplicationResource resource, String mapKey) {\r
+    public String generateApplicationResourceURL(ApplicationResource resource,\r
+            String mapKey) {\r
 \r
         final String filename = resource.getFilename();\r
         if (filename == null) {\r
index c865121a3c274420539082352f7801cbbd58496c..1340bee3c7b3f2c778fe421aaad02c2234cd957e 100644 (file)
@@ -182,7 +182,7 @@ public class ApplicationPortlet implements Portlet, Serializable {
                      * servlet to extend the session lifetime after each Vaadin\r
                      * request. This hack can be removed when supporting portlet\r
                      * 2.0 and resourceRequests.\r
-                     *\r
+                     * \r
                      * TODO make this configurable, this is not necessary with\r
                      * some custom session configurations.\r
                      */\r
index 07b0f84338a679cf85c627171d887903d13376ff..62aebf949a666597a3d3efb0dde2c4d3b77eebcf 100644 (file)
@@ -89,7 +89,7 @@ public class ApplicationRunnerServlet extends AbstractApplicationServlet {
 
     /**
      * Parses application runner URIs.
-     *
+     * 
      * If request URL is e.g.
      * http://localhost:8080/vaadin/run/com.vaadin.demo.Calc then
      * <ul>
@@ -97,7 +97,7 @@ public class ApplicationRunnerServlet extends AbstractApplicationServlet {
      * <li>Runner servlet=run</li>
      * <li>Vaadin application=com.vaadin.demo.Calc</li>
      * </ul>
-     *
+     * 
      * @param request
      * @return string array containing widgetset URI, application URI and
      *         context, runner, application classname
index a2825de87ac12dd5f23297e7a1a52f9c4ae08d55..06ad23cf21183122ae80052e5f7a90422894ca80 100644 (file)
@@ -2,9 +2,9 @@ package com.vaadin.terminal.gwt.server;
 
 /**
  * TODO Document me!
- *
+ * 
  * @author peholmst
- *
+ * 
  */
 public interface Constants {
 
index 4d57e1f3956a57309617a7296a1f0581d8a034d5..5fa0703f4754455c405995005e42bc3b0d846d15 100644 (file)
@@ -24,7 +24,7 @@ import com.vaadin.terminal.Terminal;
  * <p>
  * Alternatives for implementing similar features are are Servlet {@link Filter}
  * s and {@link TransactionListener}s in Vaadin.
- *
+ * 
  * @since 6.2
  * @see PortletRequestListener
  */
@@ -33,7 +33,7 @@ public interface HttpServletRequestListener extends Serializable {
     /**
      * This method is called before {@link Terminal} applies the request to
      * Application.
-     *
+     * 
      * @param request
      * @param response
      */
@@ -42,7 +42,7 @@ public interface HttpServletRequestListener extends Serializable {
 
     /**
      * This method is called at the end of each request.
-     *
+     * 
      * @param request
      * @param response
      */
index c9e3c77cada7843e3993f0065d772466f8a1e92f..40b5d4100425d48e28723b6c8085df21606d27ac 100644 (file)
@@ -15,8 +15,7 @@ import java.io.InputStream;
  * @since 5.0
  */
 @SuppressWarnings("serial")
-public class HttpUploadStream implements
-        com.vaadin.terminal.UploadStream {
+public class HttpUploadStream implements com.vaadin.terminal.UploadStream {
 
     /**
      * Holds value of property variableName.
index 8effcb6c65491afc079523730c2961dabcea659c..ab1b1da81f99f13d13324daf74b83434dba09698 100644 (file)
@@ -34,10 +34,10 @@ import com.vaadin.ui.Window;
 
 /**
  * TODO Write documentation, fix JavaDoc tags.
- *
+ * 
  * This is automatically registered as a {@link HttpSessionBindingListener} when
  * {@link PortletSession#setAttribute()} is called with the context as value.
- *
+ * 
  * @author peholmst
  */
 @SuppressWarnings("serial")
@@ -144,7 +144,8 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext {
         Set<PortletListener> listeners = portletListeners.get(app);
         if (listeners != null) {
             for (PortletListener l : listeners) {
-                l.handleRenderRequest(request, new RestrictedRenderResponse(response));
+                l.handleRenderRequest(request, new RestrictedRenderResponse(
+                        response));
             }
         }
     }
@@ -154,8 +155,8 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext {
         String key = request.getParameter(ActionRequest.ACTION_NAME);
         if (eventActionDestinationMap.containsKey(key)) {
             // this action request is only to send queued portlet events
-            response.setEvent(eventActionDestinationMap.get(key), eventActionValueMap
-                    .get(key));
+            response.setEvent(eventActionDestinationMap.get(key),
+                    eventActionValueMap.get(key));
             // cleanup
             eventActionDestinationMap.remove(key);
             eventActionValueMap.remove(key);
@@ -214,9 +215,9 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext {
 
     /**
      * This is for use by {@link AbstractApplicationPortlet} only.
-     *
+     * 
      * TODO cleaner implementation, now "semi-static"!
-     *
+     * 
      * @param mimeResponse
      */
     void setResponse(PortletResponse response) {
@@ -224,8 +225,7 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext {
     }
 
     @Override
-    public String generateApplicationResourceURL(
-            ApplicationResource resource,
+    public String generateApplicationResourceURL(ApplicationResource resource,
             String mapKey) {
         if (response instanceof MimeResponse) {
             ResourceURL resourceURL = ((MimeResponse) response)
@@ -245,7 +245,7 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext {
 
     /**
      * Creates a new action URL.
-     *
+     * 
      * @param action
      * @return action URL or null if called outside a MimeRequest (outside a
      *         UIDL request or similar)
@@ -263,16 +263,16 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext {
 
     /**
      * Sends a portlet event to the indicated destination.
-     *
+     * 
      * Internally, an action may be created and opened, as an event cannot be
      * sent directly from all types of requests.
-     *
+     * 
      * The event destinations and values need to be kept in the context until
      * sent. Any memory leaks if the action fails are limited to the session.
-     *
+     * 
      * Event names for events sent and received by a portlet need to be declared
      * in portlet.xml .
-     *
+     * 
      * @param window
      *            a window in which a temporary action URL can be opened if
      *            necessary
@@ -310,16 +310,16 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext {
 
     /**
      * Sets a shared portlet parameter.
-     *
+     * 
      * Internally, an action may be created and opened, as shared parameters
      * cannot be set directly from all types of requests.
-     *
+     * 
      * The parameters and values need to be kept in the context until sent. Any
      * memory leaks if the action fails are limited to the session.
-     *
+     * 
      * Shared parameters set or read by a portlet need to be declared in
      * portlet.xml .
-     *
+     * 
      * @param window
      *            a window in which a temporary action URL can be opened if
      *            necessary
@@ -356,9 +356,9 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext {
 
     /**
      * Sets the portlet mode. This may trigger a new render request.
-     *
+     * 
      * Portlet modes used by a portlet need to be declared in portlet.xml .
-     *
+     * 
      * @param window
      *            a window in which the render URL can be opened if necessary
      * @param portletMode
index 092bc4c55ec6150adec8e5719875abca0d81d485..3a5cd90f7cbc5715bb1c0b16406a593e1b29d718 100644 (file)
@@ -24,9 +24,9 @@ import com.vaadin.ui.Window;
 
 /**
  * TODO document me!
- *
+ * 
  * @author peholmst
- *
+ * 
  */
 @SuppressWarnings("serial")
 public class PortletCommunicationManager extends AbstractCommunicationManager {
@@ -168,7 +168,7 @@ public class PortletCommunicationManager extends AbstractCommunicationManager {
         /**
          * Find the application window to use based on the portlet mode. For
          * internal use only, not in the {@link Callback} interface.
-         *
+         * 
          * @param request
          * @param application
          * @return
index 95458d59d96dc72bbe9b25edb66ba08a10fcc03e..201797968e473c30e3240c73a369ffc0efdb0de9 100644 (file)
@@ -19,12 +19,11 @@ import org.w3c.dom.Element;
 \r
 /**\r
  * Read-only wrapper for a {@link RenderResponse}.\r
- *\r
+ * \r
  * Only for use by {@link PortletApplicationContext} and\r
  * {@link PortletApplicationContext2}.\r
  */\r
-class RestrictedRenderResponse implements RenderResponse,\r
-        Serializable {\r
+class RestrictedRenderResponse implements RenderResponse, Serializable {\r
 \r
     private RenderResponse response;\r
 \r
@@ -115,8 +114,7 @@ class RestrictedRenderResponse implements RenderResponse,
         response.setTitle(title);\r
     }\r
 \r
-    public void setNextPossiblePortletModes(\r
-            Collection<PortletMode> portletModes) {\r
+    public void setNextPossiblePortletModes(Collection<PortletMode> portletModes) {\r
         // NOP\r
         // TODO throw?\r
     }\r
index a3fcfafb1fc4ed742fcb3aeb8a2c9d93a777f2d8..1fb4cbba749fc00c3e2b440029ac43c40490fb88 100644 (file)
@@ -20,7 +20,7 @@ public class WebBrowser implements Terminal {
 
     /**
      * There is no default-theme for this terminal type.
-     *
+     * 
      * @return Allways returns null.
      */
     public String getDefaultTheme() {
@@ -29,7 +29,7 @@ public class WebBrowser implements Terminal {
 
     /**
      * Get the height of the users display in pixels.
-     *
+     * 
      */
     public int getScreenHeight() {
         return screenHeight;
@@ -37,7 +37,7 @@ public class WebBrowser implements Terminal {
 
     /**
      * Get the width of the users display in pixels.
-     *
+     * 
      */
     public int getScreenWidth() {
         return screenWidth;
@@ -45,7 +45,7 @@ public class WebBrowser implements Terminal {
 
     /**
      * Get the browser user-agent string.
-     *
+     * 
      * @return
      */
     public String getBrowserApplication() {
@@ -78,7 +78,7 @@ public class WebBrowser implements Terminal {
     /**
      * Get the IP-address of the web browser. If the application is running
      * inside a portlet, this method will return null.
-     *
+     * 
      * @return IP-address in 1.12.123.123 -format
      */
     public String getAddress() {
index c2c47f76a2c3a228fbcc30c565b6261c186694c0..5b760b3b18b94c821491b3c62d00ade0606f6ae4 100644 (file)
@@ -20,11 +20,11 @@ import java.util.regex.Pattern;
 /**
  * Helper class to update widgetsets GWT module configuration file. Can be used
  * command line or via IDE tools.
- *
+ * 
  * <p>
  * If module definition file contains text "WS Compiler: manually edited", tool
  * will skip editing file.
- *
+ * 
  */
 public class WidgetSetBuilder {
 
index 0be76ab2b39a80bfc64563fd8e5168aca6f9758c..50478f43103a98c6350a2bae9cd880f46a071ad5 100644 (file)
@@ -11,9 +11,10 @@ import com.vaadin.data.Property;
 /**
  * Default implementation of the the following Field types are used by default:
  * <p>
- * <b>Boolean</b>: Button(switchMode:true).<br/> <b>Date</b>:
- * DateField(resolution: day).<br/> <b>Item</b>: Form. <br/> <b>default field
- * type</b>: TextField.
+ * <b>Boolean</b>: Button(switchMode:true).<br/>
+ * <b>Date</b>: DateField(resolution: day).<br/>
+ * <b>Item</b>: Form. <br/>
+ * <b>default field type</b>: TextField.
  * <p>
  * 
  * @author IT Mill Ltd.
index 095af6c02d6dbbab549f385a59f3d77d07f24963..09887152862037855d4155ae9197ab78c8c77662 100644 (file)
@@ -455,8 +455,8 @@ public class GeneratedColumnExample extends CustomComponent {
                         null);
         table.addContainerProperty("quantity", Double.class, null,
                 "Quantity (l)", null, null);
-        table.addContainerProperty("price", Double.class, null, "Price (€/l)",
-                null, null);
+        table.addContainerProperty("price", Double.class, null,
+                "Price (€/l)", null, null);
         table.addContainerProperty("total", Double.class, null, "Total (€)",
                 null, null);
         table.addContainerProperty("consumption", Double.class, null,
index 13add217cdbdeffac72be8870565bca0454c06ca..1e8a3766f2396b3219d46485f25ae777580c5868 100644 (file)
@@ -12,8 +12,8 @@ import com.vaadin.ui.Label;
 import com.vaadin.ui.Window;
 import com.vaadin.ui.Button.ClickEvent;
 
-public abstract class Robustness extends com.vaadin.Application
-        implements Button.ClickListener {
+public abstract class Robustness extends com.vaadin.Application implements
+        Button.ClickListener {
 
     static int totalCount = 0;
 
index f78b0ca6737a376f14edae1102872588de91dc85..20b531449289ed4a91746cd1589f57db222f87fc 100644 (file)
@@ -340,8 +340,7 @@ public class BasicRandomTest extends com.vaadin.Application implements
      * ErrorEvents are printed to default error stream and not in GUI.
      */
     @Override
-    public void terminalError(
-            com.vaadin.terminal.Terminal.ErrorEvent event) {
+    public void terminalError(com.vaadin.terminal.Terminal.ErrorEvent event) {
         final Throwable e = event.getThrowable();
         System.err.println(getUser().toString() + " terminalError: "
                 + e.toString());
index 6d887b03ad845d43127061c61059cc7171f0ab2d..bb026a8955952850a9e27167db491ebf2579b36f 100644 (file)
@@ -26,8 +26,8 @@ import com.vaadin.ui.Window;
  * 
  * @since 3.1.1
  */
-public class Parameters extends com.vaadin.Application implements
-        URIHandler, ParameterHandler {
+public class Parameters extends com.vaadin.Application implements URIHandler,
+        ParameterHandler {
 
     private final Label context = new Label();
 
index a77e60fa65a4d64f1fd6ea1f05e8c4dd898c0831..c3d7155b504b83d1007c5ed6cfac273664c05bfa 100644 (file)
@@ -41,292 +41,291 @@ import com.vaadin.ui.UriFragmentUtility.FragmentChangedEvent;
  * 
  */
 public class TestBench extends com.vaadin.Application implements
-               Property.ValueChangeListener {
-
-       // Add here packages which are used for finding testable classes
-       String[] testablePackages = { "com.vaadin.tests",
-                       "com.vaadin.demo", "com.vaadin.demo.colorpicker",
-                       "com.vaadin.demo.reservation",
-                       "com.vaadin.demo.features",
-                       "com.vaadin.tests.tickets", "com.vaadin.tests.book" };
-
-       HierarchicalContainer testables = new HierarchicalContainer();
-
-       Window mainWindow = new Window("TestBench window");
-
-       // Main layout consists of tree menu and body layout
-       SplitPanel mainLayout = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);
-
-       Tree menu;
-
-       Panel bodyLayout = new Panel();
-
-       HashMap itemCaptions = new HashMap();
-
-       @Override
-       public void init() {
-
-               // Add testable classes to hierarchical container
-               for (int p = 0; p < testablePackages.length; p++) {
-                       testables.addItem(testablePackages[p]);
-                       try {
-                               final List testableClasses = getTestableClassesForPackage(testablePackages[p]);
-                               for (final Iterator it = testableClasses.iterator(); it
-                                               .hasNext();) {
-                                       final Class t = (Class) it.next();
-                                       // ignore TestBench itself
-                                       if (t.equals(TestBench.class)) {
-                                               continue;
-                                       }
-                                       try {
-                                               testables.addItem(t);
-                                               itemCaptions.put(t, t.getName());
-                                               testables.setParent(t, testablePackages[p]);
-                                               testables.setChildrenAllowed(t, false);
-                                               continue;
-                                       } catch (final Exception e) {
-                                               try {
-                                                       testables.addItem(t);
-                                                       itemCaptions.put(t, t.getName());
-                                                       testables.setParent(t, testablePackages[p]);
-                                                       testables.setChildrenAllowed(t, false);
-                                                       continue;
-                                               } catch (final Exception e1) {
-                                                       e1.printStackTrace();
-                                               }
-                                       }
-                               }
-                       } catch (final Exception e) {
-                               e.printStackTrace();
-                       }
-               }
-
-               menu = new Tree("Testables", testables);
-
-               for (final Iterator i = itemCaptions.keySet().iterator(); i.hasNext();) {
-                       final Class testable = (Class) i.next();
-                       // simplify captions
-                       final String name = testable.getName().substring(
-                                       testable.getName().lastIndexOf('.') + 1);
-                       menu.setItemCaption(testable, name);
-               }
-               // expand all root items
-               for (final Iterator i = menu.rootItemIds().iterator(); i.hasNext();) {
-                       menu.expandItemsRecursively(i.next());
-               }
-
-               menu.addListener(this);
-               menu.setImmediate(true);
-               menu.setNullSelectionAllowed(false);
-               VerticalLayout lo = new VerticalLayout();
-               lo.addComponent(menu);
-
-               UriFragmentUtility uri = new UriFragmentUtility();
-               lo.addComponent(uri);
-
-               uri.addListener(new UriFragmentUtility.FragmentChangedListener() {
-                       public void fragmentChanged(FragmentChangedEvent source) {
-                               String fragment = source.getUriFragmentUtility().getFragment();
-                               if (fragment != null && !"".equals(fragment)) {
-                                       // try to find a proper test class
-
-                                       // exact match
-                                       Iterator iterator = menu.getItemIds().iterator();
-                                       while (iterator.hasNext()) {
-                                               Object next = iterator.next();
-                                               if (next instanceof Class) {
-                                                       Class c = (Class) next;
-                                                       String string = c.getName();
-                                                       if (string.equals(fragment)) {
-                                                               menu.setValue(c);
-                                                               mainLayout.setSplitPosition(0);
-                                                               return;
-                                                       }
-                                               }
-                                       }
-
-                                       // simple name match
-                                       iterator = menu.getItemIds().iterator();
-                                       while (iterator.hasNext()) {
-                                               Object next = iterator.next();
-                                               if (next instanceof Class) {
-                                                       Class c = (Class) next;
-                                                       String string = c.getSimpleName();
-                                                       if (string.equals(fragment)) {
-                                                               menu.setValue(c);
-                                                               mainLayout.setSplitPosition(0);
-                                                               return;
-                                                       }
-                                               }
-                                       }
-                                       // ticket match
-                                       iterator = menu.getItemIds().iterator();
-                                       while (iterator.hasNext()) {
-                                               Object next = iterator.next();
-                                               if (next instanceof Class) {
-                                                       Class c = (Class) next;
-                                                       String string = c.getSimpleName();
-                                                       if (string.startsWith("Ticket" + fragment)) {
-                                                               menu.setValue(c);
-                                                               mainLayout.setSplitPosition(0);
-                                                               return;
-                                                       }
-                                               }
-                                       }
-
-                                       // just partly mach lowercase
-                                       iterator = menu.getItemIds().iterator();
-                                       while (iterator.hasNext()) {
-                                               Object next = iterator.next();
-                                               if (next instanceof Class) {
-                                                       Class c = (Class) next;
-                                                       String string = c.getSimpleName();
-                                                       if (string.toLowerCase().contains(
-                                                                       fragment.toLowerCase())) {
-                                                               menu.setValue(c);
-                                                               mainLayout.setSplitPosition(0);
-                                                               return;
-                                                       }
-                                               }
-                                       }
-
-                                       getMainWindow().showNotification(
-                                                       "No potential matc for #" + fragment);
-
-                               }
-
-                       }
-               });
-
-               mainLayout.addComponent(lo);
-
-               bodyLayout.addStyleName("light");
-               bodyLayout.setSizeFull();
-               bodyLayout.setLayout(new ExpandLayout());
-
-               mainLayout.addComponent(bodyLayout);
-
-               mainLayout.setSplitPosition(30);
-
-               mainWindow.setLayout(mainLayout);
-
-               setMainWindow(mainWindow);
-       }
-
-       private Component createTestable(Class c) {
-               try {
-                       final Application app = (Application) c.newInstance();
-                       app.init();
-                       Layout lo = app.getMainWindow().getLayout();
-                       lo.setParent(null);
-                       return lo;
-               } catch (final Exception e) {
-                       try {
-                               final CustomComponent cc = (CustomComponent) c.newInstance();
-                               cc.setSizeFull();
-                               return cc;
-                       } catch (final Exception e1) {
-                               e1.printStackTrace();
-                               VerticalLayout lo = new VerticalLayout();
-                               lo.addComponent(new Label(
-                                               "Cannot create application / custom component: "
-                                                               + e1.toString()));
-
-                               Link l = new Link("Try opening via app runner",
-                                               new ExternalResource("../run/" + c.getName()));
-                               lo.addComponent(l);
-
-                               return lo;
-                       }
-               }
-       }
-
-       // Handle menu selection and update body
-       public void valueChange(Property.ValueChangeEvent event) {
-               bodyLayout.removeAllComponents();
-               bodyLayout.setCaption(null);
-
-               final Object o = menu.getValue();
-               if (o != null && o instanceof Class) {
-                       final Class c = (Class) o;
-                       final String title = c.getName();
-                       bodyLayout.setCaption(title);
-                       bodyLayout.addComponent(createTestable(c));
-               } else {
-                       // NOP node selected or deselected tree item
-               }
-       }
-
-       /**
-        * Return all testable classes within given package. Class is considered
-        * testable if it's superclass is Application or CustomComponent.
-        * 
-        * @param packageName
-        * @return
-        * @throws ClassNotFoundException
-        */
-       public static List getTestableClassesForPackage(String packageName)
-                       throws Exception {
-               final ArrayList directories = new ArrayList();
-               try {
-                       final ClassLoader cld = Thread.currentThread()
-                                       .getContextClassLoader();
-                       if (cld == null) {
-                               throw new ClassNotFoundException("Can't get class loader.");
-                       }
-                       final String path = packageName.replace('.', '/');
-                       // Ask for all resources for the path
-                       final Enumeration resources = cld.getResources(path);
-                       while (resources.hasMoreElements()) {
-                               final URL url = (URL) resources.nextElement();
-                               directories.add(new File(url.getFile()));
-                       }
-               } catch (final Exception x) {
-                       throw new Exception(packageName
-                                       + " does not appear to be a valid package.");
-               }
-
-               final ArrayList classes = new ArrayList();
-               // For every directory identified capture all the .class files
-               for (final Iterator it = directories.iterator(); it.hasNext();) {
-                       final File directory = (File) it.next();
-                       if (directory.exists()) {
-                               // Get the list of the files contained in the package
-                               final String[] files = directory.list();
-                               for (int j = 0; j < files.length; j++) {
-                                       // we are only interested in .class files
-                                       if (files[j].endsWith(".class")) {
-                                               // removes the .class extension
-                                               final String p = packageName + '.'
-                                                               + files[j].substring(0, files[j].length() - 6);
-                                               final Class c = Class.forName(p);
-                                               if (c.getSuperclass() != null) {
-                                                       if ((c.getSuperclass()
-                                                                       .equals(com.vaadin.Application.class))) {
-                                                               classes.add(c);
-                                                       } else if ((c.getSuperclass()
-                                                                       .equals(com.vaadin.ui.CustomComponent.class))) {
-                                                               classes.add(c);
-                                                       }
-                                               }
-
-                                               // for (int i = 0; i < c.getInterfaces().length; i++) {
-                                               // Class cc = c.getInterfaces()[i];
-                                               // if (c.getInterfaces()[i].equals(Testable.class)) {
-                                               // // Class is testable
-                                               // classes.add(c);
-                                               // }
-                                               // }
-                                       }
-                               }
-                       } else {
-                               throw new ClassNotFoundException(packageName + " ("
-                                               + directory.getPath()
-                                               + ") does not appear to be a valid package");
-                       }
-               }
-
-               return classes;
-       }
+        Property.ValueChangeListener {
+
+    // Add here packages which are used for finding testable classes
+    String[] testablePackages = { "com.vaadin.tests", "com.vaadin.demo",
+            "com.vaadin.demo.colorpicker", "com.vaadin.demo.reservation",
+            "com.vaadin.demo.features", "com.vaadin.tests.tickets",
+            "com.vaadin.tests.book" };
+
+    HierarchicalContainer testables = new HierarchicalContainer();
+
+    Window mainWindow = new Window("TestBench window");
+
+    // Main layout consists of tree menu and body layout
+    SplitPanel mainLayout = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);
+
+    Tree menu;
+
+    Panel bodyLayout = new Panel();
+
+    HashMap itemCaptions = new HashMap();
+
+    @Override
+    public void init() {
+
+        // Add testable classes to hierarchical container
+        for (int p = 0; p < testablePackages.length; p++) {
+            testables.addItem(testablePackages[p]);
+            try {
+                final List testableClasses = getTestableClassesForPackage(testablePackages[p]);
+                for (final Iterator it = testableClasses.iterator(); it
+                        .hasNext();) {
+                    final Class t = (Class) it.next();
+                    // ignore TestBench itself
+                    if (t.equals(TestBench.class)) {
+                        continue;
+                    }
+                    try {
+                        testables.addItem(t);
+                        itemCaptions.put(t, t.getName());
+                        testables.setParent(t, testablePackages[p]);
+                        testables.setChildrenAllowed(t, false);
+                        continue;
+                    } catch (final Exception e) {
+                        try {
+                            testables.addItem(t);
+                            itemCaptions.put(t, t.getName());
+                            testables.setParent(t, testablePackages[p]);
+                            testables.setChildrenAllowed(t, false);
+                            continue;
+                        } catch (final Exception e1) {
+                            e1.printStackTrace();
+                        }
+                    }
+                }
+            } catch (final Exception e) {
+                e.printStackTrace();
+            }
+        }
+
+        menu = new Tree("Testables", testables);
+
+        for (final Iterator i = itemCaptions.keySet().iterator(); i.hasNext();) {
+            final Class testable = (Class) i.next();
+            // simplify captions
+            final String name = testable.getName().substring(
+                    testable.getName().lastIndexOf('.') + 1);
+            menu.setItemCaption(testable, name);
+        }
+        // expand all root items
+        for (final Iterator i = menu.rootItemIds().iterator(); i.hasNext();) {
+            menu.expandItemsRecursively(i.next());
+        }
+
+        menu.addListener(this);
+        menu.setImmediate(true);
+        menu.setNullSelectionAllowed(false);
+        VerticalLayout lo = new VerticalLayout();
+        lo.addComponent(menu);
+
+        UriFragmentUtility uri = new UriFragmentUtility();
+        lo.addComponent(uri);
+
+        uri.addListener(new UriFragmentUtility.FragmentChangedListener() {
+            public void fragmentChanged(FragmentChangedEvent source) {
+                String fragment = source.getUriFragmentUtility().getFragment();
+                if (fragment != null && !"".equals(fragment)) {
+                    // try to find a proper test class
+
+                    // exact match
+                    Iterator iterator = menu.getItemIds().iterator();
+                    while (iterator.hasNext()) {
+                        Object next = iterator.next();
+                        if (next instanceof Class) {
+                            Class c = (Class) next;
+                            String string = c.getName();
+                            if (string.equals(fragment)) {
+                                menu.setValue(c);
+                                mainLayout.setSplitPosition(0);
+                                return;
+                            }
+                        }
+                    }
+
+                    // simple name match
+                    iterator = menu.getItemIds().iterator();
+                    while (iterator.hasNext()) {
+                        Object next = iterator.next();
+                        if (next instanceof Class) {
+                            Class c = (Class) next;
+                            String string = c.getSimpleName();
+                            if (string.equals(fragment)) {
+                                menu.setValue(c);
+                                mainLayout.setSplitPosition(0);
+                                return;
+                            }
+                        }
+                    }
+                    // ticket match
+                    iterator = menu.getItemIds().iterator();
+                    while (iterator.hasNext()) {
+                        Object next = iterator.next();
+                        if (next instanceof Class) {
+                            Class c = (Class) next;
+                            String string = c.getSimpleName();
+                            if (string.startsWith("Ticket" + fragment)) {
+                                menu.setValue(c);
+                                mainLayout.setSplitPosition(0);
+                                return;
+                            }
+                        }
+                    }
+
+                    // just partly mach lowercase
+                    iterator = menu.getItemIds().iterator();
+                    while (iterator.hasNext()) {
+                        Object next = iterator.next();
+                        if (next instanceof Class) {
+                            Class c = (Class) next;
+                            String string = c.getSimpleName();
+                            if (string.toLowerCase().contains(
+                                    fragment.toLowerCase())) {
+                                menu.setValue(c);
+                                mainLayout.setSplitPosition(0);
+                                return;
+                            }
+                        }
+                    }
+
+                    getMainWindow().showNotification(
+                            "No potential matc for #" + fragment);
+
+                }
+
+            }
+        });
+
+        mainLayout.addComponent(lo);
+
+        bodyLayout.addStyleName("light");
+        bodyLayout.setSizeFull();
+        bodyLayout.setLayout(new ExpandLayout());
+
+        mainLayout.addComponent(bodyLayout);
+
+        mainLayout.setSplitPosition(30);
+
+        mainWindow.setLayout(mainLayout);
+
+        setMainWindow(mainWindow);
+    }
+
+    private Component createTestable(Class c) {
+        try {
+            final Application app = (Application) c.newInstance();
+            app.init();
+            Layout lo = app.getMainWindow().getLayout();
+            lo.setParent(null);
+            return lo;
+        } catch (final Exception e) {
+            try {
+                final CustomComponent cc = (CustomComponent) c.newInstance();
+                cc.setSizeFull();
+                return cc;
+            } catch (final Exception e1) {
+                e1.printStackTrace();
+                VerticalLayout lo = new VerticalLayout();
+                lo.addComponent(new Label(
+                        "Cannot create application / custom component: "
+                                + e1.toString()));
+
+                Link l = new Link("Try opening via app runner",
+                        new ExternalResource("../run/" + c.getName()));
+                lo.addComponent(l);
+
+                return lo;
+            }
+        }
+    }
+
+    // Handle menu selection and update body
+    public void valueChange(Property.ValueChangeEvent event) {
+        bodyLayout.removeAllComponents();
+        bodyLayout.setCaption(null);
+
+        final Object o = menu.getValue();
+        if (o != null && o instanceof Class) {
+            final Class c = (Class) o;
+            final String title = c.getName();
+            bodyLayout.setCaption(title);
+            bodyLayout.addComponent(createTestable(c));
+        } else {
+            // NOP node selected or deselected tree item
+        }
+    }
+
+    /**
+     * Return all testable classes within given package. Class is considered
+     * testable if it's superclass is Application or CustomComponent.
+     * 
+     * @param packageName
+     * @return
+     * @throws ClassNotFoundException
+     */
+    public static List getTestableClassesForPackage(String packageName)
+            throws Exception {
+        final ArrayList directories = new ArrayList();
+        try {
+            final ClassLoader cld = Thread.currentThread()
+                    .getContextClassLoader();
+            if (cld == null) {
+                throw new ClassNotFoundException("Can't get class loader.");
+            }
+            final String path = packageName.replace('.', '/');
+            // Ask for all resources for the path
+            final Enumeration resources = cld.getResources(path);
+            while (resources.hasMoreElements()) {
+                final URL url = (URL) resources.nextElement();
+                directories.add(new File(url.getFile()));
+            }
+        } catch (final Exception x) {
+            throw new Exception(packageName
+                    + " does not appear to be a valid package.");
+        }
+
+        final ArrayList classes = new ArrayList();
+        // For every directory identified capture all the .class files
+        for (final Iterator it = directories.iterator(); it.hasNext();) {
+            final File directory = (File) it.next();
+            if (directory.exists()) {
+                // Get the list of the files contained in the package
+                final String[] files = directory.list();
+                for (int j = 0; j < files.length; j++) {
+                    // we are only interested in .class files
+                    if (files[j].endsWith(".class")) {
+                        // removes the .class extension
+                        final String p = packageName + '.'
+                                + files[j].substring(0, files[j].length() - 6);
+                        final Class c = Class.forName(p);
+                        if (c.getSuperclass() != null) {
+                            if ((c.getSuperclass()
+                                    .equals(com.vaadin.Application.class))) {
+                                classes.add(c);
+                            } else if ((c.getSuperclass()
+                                    .equals(com.vaadin.ui.CustomComponent.class))) {
+                                classes.add(c);
+                            }
+                        }
+
+                        // for (int i = 0; i < c.getInterfaces().length; i++) {
+                        // Class cc = c.getInterfaces()[i];
+                        // if (c.getInterfaces()[i].equals(Testable.class)) {
+                        // // Class is testable
+                        // classes.add(c);
+                        // }
+                        // }
+                    }
+                }
+            } else {
+                throw new ClassNotFoundException(packageName + " ("
+                        + directory.getPath()
+                        + ") does not appear to be a valid package");
+            }
+        }
+
+        return classes;
+    }
 
 }
index 6d3b653baf1437e73aa3b5155a5cf54603173ead..1491898f3d575e74cc83c605c05dbf32e523a2a0 100644 (file)
@@ -64,1721 +64,1727 @@ import com.vaadin.ui.Layout.AlignmentHandler;
 import com.vaadin.ui.MenuBar.MenuItem;
 
 public class BookTestApplication extends com.vaadin.Application {
-       Window main = new Window("Application window");
-
-       TheButton butts1;
-       TheButtons butts2;
-       TheButtons2 butts3;
-
-       Label mylabel1;
-       Label mylabel2;
-       Label mylabel3;
-
-       StreamResource strres;
-       VerticalLayout ol;
-       int getwincount = 0;
-
-       @Override
-       public void init() {
-               setTheme("tests-book");
-
-               setMainWindow(main);
-               
-               main.getContent().setSizeFull();
-               
-               // 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 value = ((String[]) parameters.get(key))[0];
-                               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);
-                       return null; // Let the Application provide the response
-               }
-       }
-
-       class BookTestURIHandler implements URIHandler {
-               public DownloadStream handleURI(URL context, String relativeUri) {
-                       String example;
-                       String param = null;
-
-                       final int slashPos = relativeUri.indexOf("/");
-                       if (slashPos > 0) {
-                               example = relativeUri.substring(0, slashPos);
-                               param = relativeUri.substring(slashPos + 1);
-                       } else {
-                               example = relativeUri;
-                       }
-
-                       /* Remove existing components and windows. */
-                       main.removeAllComponents();
-                       final Set childwindows = main.getChildWindows();
-                       for (final Iterator cwi = childwindows.iterator(); cwi.hasNext();) {
-                               final Window child = (Window) cwi.next();
-                               main.removeWindow(child);
-                       }
-
-                       // The index is listed inside a grid layout
-                       main.setLayout(new VerticalLayout());
-                       GridLayout grid = new GridLayout(4, 4);
-                       grid.addStyleName("index");
-                       main.addComponent(grid);
-
-                       if (example.equals("index")) {
-                               final String examples[] = { "defaultbutton", "label",
-                                               "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",
-                                               "window/multiple", "classresource", "usererror",
-                                               "progress/window", "progress/thread", "progress",
-                                               "customlayout", "spacing", "margin", "clientinfo",
-                                               "fillinform/templates", "notification", "print",
-                                               "richtextfield", "querycontainer", "menubar",
-                                               "absolutelayout", "layout/intro"};
-                               for (int i = 0; i < examples.length; i++) {
-                                       grid.addComponent(new Label("<a href='"
-                                                       + context.toString() + examples[i] + "'>"
-                                                       + examples[i] + "</a>", Label.CONTENT_XHTML));
-                               }
-                               return null;
-                       }
-
-                       if (example.equals("defaultbutton")) {
-                               example_defaultButton(main, param);
-                       } else if (example.equals("label")) {
-                               example_Label(main, param);
-                       } else if (example.equals("labelcontent")) {
-                               example_LabelContent(main, param);
-                       } else if (example.equals("tree")) {
-                               example_Tree(main, param);
-                       } else if (example.equals("embedded")) {
-                               example_Embedded(main, param);
-                       } else if (example.equals("textfield")) {
-                               example_TextField(main, param);
-                       } else if (example.equals("textfieldvalidation")) {
-                               example_TextFieldValidation(main, param);
-                       } else if (example.equals("usererror")) {
-                               example_UserError(main, param);
-                       } else if (example.equals("datefield")) {
-                               example_DateField(main, param);
-                       } else if (example.equals("button")) {
-                               example_Button(main, param);
-                       } else if (example.equals("checkbox")) {
-                               example_CheckBox(main, param);
-                       } else if (example.equals("select")) {
-                               example_Select(main, param);
-                       } else if (example.equals("filterselect")) {
-                               example_FilterSelect(main, param);
-                       } else if (example.equals("validator")) {
-                               example_Validator(main, param);
-                       } else if (example.equals("table")) {
-                               example_Table(main, param);
-                       } else if (example.equals("upload")) {
-                               example_Upload(main, param);
-                       } else if (example.equals("link")) {
-                               example_Link(main, param);
-                       } else if (example.equals("gridlayout")) {
-                               example_GridLayout(main, param);
-                       } else if (example.equals("orderedlayout")) {
-                               example_OrderedLayout(main, param);
-                       } else if (example.equals("formlayout")) {
-                               example_FormLayout(main, param);
-                       } else if (example.equals("form")) {
-                               example_Form(main, param);
-                       } else if (example.equals("tabsheet")) {
-                               example_TabSheet(main, param);
-                       } else if (example.equals("panel")) {
-                               example_Panel(main, param);
-                       } else if (example.equals("expandlayout")) {
-                               example_ExpandLayout(main, param);
-                       } else if (example.equals("alignment")) {
-                               example_Alignment(main, param);
-                       } else if (example.equals("window")) {
-                               example_Window(main, param);
-                       } else if (example.equals("classresource")) {
-                               example_ClassResource(main, param);
-                       } else if (example.equals("progress")) {
-                               example_ProgressIndicator(main, param);
-                       } else if (example.equals("customlayout")) {
-                               example_CustomLayout(main, param);
-                       } else if (example.equals("spacing")) {
-                               example_Spacing(main, param);
-                       } else if (example.equals("margin")) {
-                               example_Margin(main, param);
-                       } else if (example.equals("clientinfo")) {
-                               example_ClientInfo(main, param);
-                       } else if (example.equals("fillinform")) {
-                               example_FillInForm(main, param);
-                       } else if (example.equals("notification")) {
-                               example_Notification(main, param);
-                       } else if (example.equals("print")) {
-                               example_Print(main, param);
-                       } else if (example.equals("richtextfield")) {
-                               example_RichTextArea(main, param);
-                       } else if (example.equals("querycontainer")) {
-                               example_QueryContainer(main, param);
-                       } else if (example.equals("menubar")) {
-                               example_MenuBar(main, param);
-                       } else if (example.equals("absolutelayout")) {
-                               example_AbsoluteLayout(main, param);
+    Window main = new Window("Application window");
+
+    TheButton butts1;
+    TheButtons butts2;
+    TheButtons2 butts3;
+
+    Label mylabel1;
+    Label mylabel2;
+    Label mylabel3;
+
+    StreamResource strres;
+    VerticalLayout ol;
+    int getwincount = 0;
+
+    @Override
+    public void init() {
+        setTheme("tests-book");
+
+        setMainWindow(main);
+
+        main.getContent().setSizeFull();
+
+        // 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 value = ((String[]) parameters.get(key))[0];
+                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);
+            return null; // Let the Application provide the response
+        }
+    }
+
+    class BookTestURIHandler implements URIHandler {
+        public DownloadStream handleURI(URL context, String relativeUri) {
+            String example;
+            String param = null;
+
+            final int slashPos = relativeUri.indexOf("/");
+            if (slashPos > 0) {
+                example = relativeUri.substring(0, slashPos);
+                param = relativeUri.substring(slashPos + 1);
+            } else {
+                example = relativeUri;
+            }
+
+            /* Remove existing components and windows. */
+            main.removeAllComponents();
+            final Set childwindows = main.getChildWindows();
+            for (final Iterator cwi = childwindows.iterator(); cwi.hasNext();) {
+                final Window child = (Window) cwi.next();
+                main.removeWindow(child);
+            }
+
+            // The index is listed inside a grid layout
+            main.setLayout(new VerticalLayout());
+            GridLayout grid = new GridLayout(4, 4);
+            grid.addStyleName("index");
+            main.addComponent(grid);
+
+            if (example.equals("index")) {
+                final String examples[] = { "defaultbutton", "label",
+                        "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",
+                        "window/multiple", "classresource", "usererror",
+                        "progress/window", "progress/thread", "progress",
+                        "customlayout", "spacing", "margin", "clientinfo",
+                        "fillinform/templates", "notification", "print",
+                        "richtextfield", "querycontainer", "menubar",
+                        "absolutelayout", "layout/intro" };
+                for (int i = 0; i < examples.length; i++) {
+                    grid.addComponent(new Label("<a href='"
+                            + context.toString() + examples[i] + "'>"
+                            + examples[i] + "</a>", Label.CONTENT_XHTML));
+                }
+                return null;
+            }
+
+            if (example.equals("defaultbutton")) {
+                example_defaultButton(main, param);
+            } else if (example.equals("label")) {
+                example_Label(main, param);
+            } else if (example.equals("labelcontent")) {
+                example_LabelContent(main, param);
+            } else if (example.equals("tree")) {
+                example_Tree(main, param);
+            } else if (example.equals("embedded")) {
+                example_Embedded(main, param);
+            } else if (example.equals("textfield")) {
+                example_TextField(main, param);
+            } else if (example.equals("textfieldvalidation")) {
+                example_TextFieldValidation(main, param);
+            } else if (example.equals("usererror")) {
+                example_UserError(main, param);
+            } else if (example.equals("datefield")) {
+                example_DateField(main, param);
+            } else if (example.equals("button")) {
+                example_Button(main, param);
+            } else if (example.equals("checkbox")) {
+                example_CheckBox(main, param);
+            } else if (example.equals("select")) {
+                example_Select(main, param);
+            } else if (example.equals("filterselect")) {
+                example_FilterSelect(main, param);
+            } else if (example.equals("validator")) {
+                example_Validator(main, param);
+            } else if (example.equals("table")) {
+                example_Table(main, param);
+            } else if (example.equals("upload")) {
+                example_Upload(main, param);
+            } else if (example.equals("link")) {
+                example_Link(main, param);
+            } else if (example.equals("gridlayout")) {
+                example_GridLayout(main, param);
+            } else if (example.equals("orderedlayout")) {
+                example_OrderedLayout(main, param);
+            } else if (example.equals("formlayout")) {
+                example_FormLayout(main, param);
+            } else if (example.equals("form")) {
+                example_Form(main, param);
+            } else if (example.equals("tabsheet")) {
+                example_TabSheet(main, param);
+            } else if (example.equals("panel")) {
+                example_Panel(main, param);
+            } else if (example.equals("expandlayout")) {
+                example_ExpandLayout(main, param);
+            } else if (example.equals("alignment")) {
+                example_Alignment(main, param);
+            } else if (example.equals("window")) {
+                example_Window(main, param);
+            } else if (example.equals("classresource")) {
+                example_ClassResource(main, param);
+            } else if (example.equals("progress")) {
+                example_ProgressIndicator(main, param);
+            } else if (example.equals("customlayout")) {
+                example_CustomLayout(main, param);
+            } else if (example.equals("spacing")) {
+                example_Spacing(main, param);
+            } else if (example.equals("margin")) {
+                example_Margin(main, param);
+            } else if (example.equals("clientinfo")) {
+                example_ClientInfo(main, param);
+            } else if (example.equals("fillinform")) {
+                example_FillInForm(main, param);
+            } else if (example.equals("notification")) {
+                example_Notification(main, param);
+            } else if (example.equals("print")) {
+                example_Print(main, param);
+            } else if (example.equals("richtextfield")) {
+                example_RichTextArea(main, param);
+            } else if (example.equals("querycontainer")) {
+                example_QueryContainer(main, param);
+            } else if (example.equals("menubar")) {
+                example_MenuBar(main, param);
+            } else if (example.equals("absolutelayout")) {
+                example_AbsoluteLayout(main, param);
             } else if (example.equals("layout")) {
                 example_Layout(main, param);
-                       } else {
-                               ; // main.addComponent(new
-                               // Label("Unknown test '"+example+"'."));
-                       }
-
-                       return null;
-               }
-       }
-
-       /*
-        * public Window getWindow(String name) { Window superwin =
-        * super.getWindow(name); if (superwin != null) return superwin;
-        * 
-        * main.addComponent(new Label("Request 2 for window '"+name+"'.")); if
-        * (name.equals("panel")) { Window window = new Window("Other Window " +
-        * getwincount++); example_Panel(window, null); return window; } return
-        * null; }
-        */
-       public void handleButton(Button.ClickEvent event) {
-               ol.addStyleName("myLayout2");
-       }
-
-       void example_defaultButton(Window main, String param) {
-               main.addComponent(new DefaultButtonExample());
-       }
-
-       void example_Label(Window main, String param) {
-               /* Some container for the Label. */
-               final Panel panel = new Panel("Panel Containing a Label");
-               main.addComponent(panel);
-
-               panel.addComponent(new Label(
-                               "This is a Label inside a Panel. There is enough "
-                                               + "text in the label to make the text wrap if it "
-                                               + "exceeds the width of the panel."));
-       }
-
-       void example_LabelContent(Window main, String param) {
-               final GridLayout labelgrid = new GridLayout(2, 1);
-               labelgrid.addStyleName("labelgrid");
-               labelgrid.addComponent(new Label("CONTENT_DEFAULT"));
-               labelgrid.addComponent(new Label(
-                               "This is a label in default mode: <plain text>",
-                               Label.CONTENT_DEFAULT));
-               labelgrid.addComponent(new Label("CONTENT_PREFORMATTED"));
-               labelgrid
-                               .addComponent(new Label(
-                                               "This is a preformatted label.\nThe newline character \\n breaks the line.",
-                                               Label.CONTENT_PREFORMATTED));
-               labelgrid.addComponent(new Label("CONTENT_RAW"));
-               labelgrid
-                               .addComponent(new Label(
-                                               "This is a label in raw mode.<br>It can contain, for example, unbalanced markup.",
-                                               Label.CONTENT_RAW));
-               labelgrid.addComponent(new Label("CONTENT_TEXT"));
-               labelgrid.addComponent(new Label(
-                               "This is a label in (plain) text mode", Label.CONTENT_TEXT));
-               labelgrid.addComponent(new Label("CONTENT_XHTML"));
-               labelgrid.addComponent(new Label(
-                               "<i>This</i> is an <b>XHTML<b> formatted label",
-                               Label.CONTENT_XHTML));
-               labelgrid.addComponent(new Label("CONTENT_XML"));
-               labelgrid.addComponent(new Label(
-                               "This is an <myelement>XML</myelement> formatted label",
-                               Label.CONTENT_XML));
-               main.addComponent(labelgrid);
-
-               final ClassResource labelimage = new ClassResource("smiley.jpg", this);
-               main.addComponent(new Label("Here we have an image <img src=\""
-                               + getRelativeLocation(labelimage) + "\"/> within some text.",
-                               Label.CONTENT_XHTML));
-       }
-
-       void example_Tree(Window main, String param) {
-               final Object[][] planets = new Object[][] {
-                               new Object[] { "Mercury" },
-                               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" } };
-
-               final Tree tree = new Tree();
-
-               // Add planets as root items in the tree.
-               for (int i = 0; i < planets.length; i++) {
-                       final String planet = (String) (planets[i][0]);
-                       tree.addItem(planet);
-
-                       if (planets[i].length == 1) {
-                               // The planet has no moons so make it a leaf.
-                               tree.setChildrenAllowed(planet, false);
-                       } else {
-                               // Add children (moons) under the planets.
-                               for (int j = 1; j < planets[i].length; j++) {
-                                       final String moon = (String) planets[i][j];
-
-                                       // Add the item as a regular item.
-                                       tree.addItem(moon);
-
-                                       // Set it to be a child.
-                                       tree.setParent(moon, planet);
-
-                                       // Make the moons look like leaves.
-                                       tree.setChildrenAllowed(moon, false);
-                               }
-
-                               // Expand the subtree.
-                               tree.expandItemsRecursively(planet);
-                       }
-               }
-
-               // Horizontal layout with the tree on the left and a details panel on
-               // the right.
-               final HorizontalLayout horlayout = new HorizontalLayout();
-               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.setExpandRatio(detailspanel, 1);
-
-               final VerticalLayout detailslayout = new VerticalLayout();
-               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;
-
-                               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
-                                               + "."));
-
-                       }
-               });
-
-               main.setLayout(horlayout);
-       }
-
-       void example_Select(Window main, String param) {
-               final HorizontalLayout layout = new HorizontalLayout();
-               layout.addStyleName("aligntop");
-
-               if (param.equals("twincol")) {
-                       final SelectExample select1 = new SelectExample(this, param,
-                                       "Select some items", true);
-                       layout.addComponent(select1);
-               } else if (param.equals("filter")) {
-                       final SelectExample select1 = new SelectExample(this, param,
-                                       "Enter containing substring", false);
-                       layout.addComponent(select1);
-               } else {
-                       final SelectExample select1 = new SelectExample(this, param,
-                                       "Single Selection Mode", false);
-                       final SelectExample select2 = new SelectExample(this, param,
-                                       "Multiple Selection Mode", true);
-                       layout.addComponent(select1);
-                       layout.addComponent(select2);
-               }
-               main.addComponent(layout);
-       }
-
-       void example_FilterSelect(Window main, String param) {
-               final Select select = new Select("Enter containing substring");
-               main.addComponent(select);
-
-               select
-                               .setFilteringMode(AbstractSelect.Filtering.FILTERINGMODE_CONTAINS);
-
-               /* Fill the component with some items. */
-               final String[] planets = new String[] { "Mercury", "Venus", "Earth",
-                               "Mars", "Jupiter", "Saturn", "Uranus", "Neptune" };
-
-               for (int i = 0; i < planets.length; i++) {
-                       for (int j = 0; j < planets.length; j++) {
-                               select.addItem(planets[j] + " to " + planets[i]);
-                       }
-               }
-       }
-
-       void example_TextField(Window main, String param) {
-               /* Add a single-line text field. */
-               final TextField subject = new TextField("Subject");
-               subject.setColumns(40);
-               main.addComponent(subject);
-
-               /* Add a multi-line text field. */
-               final TextField message = new TextField("Message");
-               message.setRows(7);
-               message.setColumns(40);
-               main.addComponent(message);
-       }
-
-       void example_TextFieldValidation(Window main, String param) {
-               // Create a text field with a label
-               final TextField username = new TextField("Username");
-               main.addComponent(username);
-
-               // Set visible length to 16 characters
-               username.setColumns(16);
-
-               // Set content length to minimum of 6 and maximum of 16 characters.
-               // The string also may not be null.
-               username.addValidator(new StringLengthValidator(
-                               "Must be 6 to 16 characters long", 6, 16, false));
-
-               // Setting component immediate causes a ValueChangeEvent to occur
-               // when the TextField loses focus.
-               username.setImmediate(true);
-
-               // Listen for ValueChangeEvents and handle them
-               username.addListener(new ValueChangeListener() {
-                       public void valueChange(ValueChangeEvent event) {
-                               // Get the source of the event
-                               final TextField username = (TextField) (event.getProperty());
-
-                               try {
-                                       // Validate the field value.
-                                       username.validate();
-                               } catch (final Validator.InvalidValueException e) {
-                                       // The value was not ok. The error was set.
-                               }
-                       }
-               });
-       }
-
-       void example_UserError(final Window main, String param) {
-               if (param != null) {
-                       if (param.equals("form")) {
-
-                               final FormLayout layout = new FormLayout();
-                               main.addComponent(layout);
-
-                               final TextField textfield = new TextField("Enter code");
-                               layout.addComponent(textfield);
-                               textfield.setComponentError(null);
-
-                               final Button button = new Button("Ok!");
-                               layout.addComponent(button);
-
-                               button.addListener(new Button.ClickListener() {
-                                       public void buttonClick(ClickEvent event) {
-                                               if (((String) textfield.getValue()).length() == 0) {
-                                                       textfield.setComponentError(new UserError(
-                                                                       "Must be letters and numbers."));
-                                               } else {
-                                                       textfield.setComponentError(null);
-                                               }
-                                       }
-                               });
-                       }
-               } else {
-                       main.setLayout(new HorizontalLayout());
-
-                       // Create a field.
-                       final TextField textfield = new TextField("Enter code");
-                       main.addComponent(textfield);
-
-                       // Let the component error be initially clear. (It actually is by
-                       // default.)
-                       textfield.setComponentError(null);
-
-                       // Have a button right of the field (and align it properly).
-                       final Button button = new Button("Ok!");
-                       main.addComponent(button);
-                       ((HorizontalLayout) main.getLayout()).setComponentAlignment(button,
-                                       HorizontalLayout.ALIGNMENT_LEFT,
-                                       HorizontalLayout.ALIGNMENT_BOTTOM);
-
-                       // Handle button clicks
-                       button.addListener(new Button.ClickListener() {
-                               public void buttonClick(ClickEvent event) {
-                                       // If the field value is bad, set its error.
-                                       // (Here the content must be only alphanumeric characters.)
-                                       if (!((String) textfield.getValue()).matches("^\\w*$")) {
-                                               // Put the component in error state and set the error
-                                               // message.
-                                               textfield.setComponentError(new UserError(
-                                                               "Must be letters and numbers"));
-                                       } else {
-                                               // Otherwise clear it.
-                                               textfield.setComponentError(null);
-                                       }
-                               }
-                       });
-               }
-       }
-
-       void example_DateField(Window main, String param) {
-               HorizontalLayout layout = new HorizontalLayout();
-
-               /* Create a DateField with the calendar style. */
-               final DateField popupdate = new PopupDateField("Popup calendar field");
-
-               /* Set resolution of the date/time display. */
-               popupdate.setResolution(DateField.RESOLUTION_MIN);
-
-               /* Set the date and time to present. */
-               popupdate.setValue(new java.util.Date());
-
-               /* Create a DateField with the calendar style. */
-               final DateField inlinedate = new InlineDateField(
-                               "Inline calendar field");
-
-               /* Set locale of the DateField to American English. */
-               inlinedate.setLocale(new Locale("en", "US"));
-
-               /* Set the date and time to present. */
-               inlinedate.setValue(new java.util.Date());
-
-               /* Set resolution of the date/time display. */
-               inlinedate.setResolution(DateField.RESOLUTION_MIN);
-
-               layout.addComponent(popupdate);
-               layout.addComponent(inlinedate);
-               layout.setSpacing(true);
-               main.addComponent(layout);
-       }
-
-       void example_Validator(Window main, String param) {
-               if (param != null && param.equals("required")) {
-                       Form form = new Form();
-                       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);
-                       form.getLayout().addComponent(text);
-                       return;
-               }
-               main.addComponent(new SSNField());
-       }
+            } else {
+                ; // main.addComponent(new
+                // Label("Unknown test '"+example+"'."));
+            }
+
+            return null;
+        }
+    }
+
+    /*
+     * public Window getWindow(String name) { Window superwin =
+     * super.getWindow(name); if (superwin != null) return superwin;
+     * 
+     * main.addComponent(new Label("Request 2 for window '"+name+"'.")); if
+     * (name.equals("panel")) { Window window = new Window("Other Window " +
+     * getwincount++); example_Panel(window, null); return window; } return
+     * null; }
+     */
+    public void handleButton(Button.ClickEvent event) {
+        ol.addStyleName("myLayout2");
+    }
+
+    void example_defaultButton(Window main, String param) {
+        main.addComponent(new DefaultButtonExample());
+    }
+
+    void example_Label(Window main, String param) {
+        /* Some container for the Label. */
+        final Panel panel = new Panel("Panel Containing a Label");
+        main.addComponent(panel);
+
+        panel.addComponent(new Label(
+                "This is a Label inside a Panel. There is enough "
+                        + "text in the label to make the text wrap if it "
+                        + "exceeds the width of the panel."));
+    }
+
+    void example_LabelContent(Window main, String param) {
+        final GridLayout labelgrid = new GridLayout(2, 1);
+        labelgrid.addStyleName("labelgrid");
+        labelgrid.addComponent(new Label("CONTENT_DEFAULT"));
+        labelgrid.addComponent(new Label(
+                "This is a label in default mode: <plain text>",
+                Label.CONTENT_DEFAULT));
+        labelgrid.addComponent(new Label("CONTENT_PREFORMATTED"));
+        labelgrid
+                .addComponent(new Label(
+                        "This is a preformatted label.\nThe newline character \\n breaks the line.",
+                        Label.CONTENT_PREFORMATTED));
+        labelgrid.addComponent(new Label("CONTENT_RAW"));
+        labelgrid
+                .addComponent(new Label(
+                        "This is a label in raw mode.<br>It can contain, for example, unbalanced markup.",
+                        Label.CONTENT_RAW));
+        labelgrid.addComponent(new Label("CONTENT_TEXT"));
+        labelgrid.addComponent(new Label(
+                "This is a label in (plain) text mode", Label.CONTENT_TEXT));
+        labelgrid.addComponent(new Label("CONTENT_XHTML"));
+        labelgrid.addComponent(new Label(
+                "<i>This</i> is an <b>XHTML<b> formatted label",
+                Label.CONTENT_XHTML));
+        labelgrid.addComponent(new Label("CONTENT_XML"));
+        labelgrid.addComponent(new Label(
+                "This is an <myelement>XML</myelement> formatted label",
+                Label.CONTENT_XML));
+        main.addComponent(labelgrid);
+
+        final ClassResource labelimage = new ClassResource("smiley.jpg", this);
+        main.addComponent(new Label("Here we have an image <img src=\""
+                + getRelativeLocation(labelimage) + "\"/> within some text.",
+                Label.CONTENT_XHTML));
+    }
+
+    void example_Tree(Window main, String param) {
+        final Object[][] planets = new Object[][] {
+                new Object[] { "Mercury" },
+                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" } };
+
+        final Tree tree = new Tree();
+
+        // Add planets as root items in the tree.
+        for (int i = 0; i < planets.length; i++) {
+            final String planet = (String) (planets[i][0]);
+            tree.addItem(planet);
+
+            if (planets[i].length == 1) {
+                // The planet has no moons so make it a leaf.
+                tree.setChildrenAllowed(planet, false);
+            } else {
+                // Add children (moons) under the planets.
+                for (int j = 1; j < planets[i].length; j++) {
+                    final String moon = (String) planets[i][j];
+
+                    // Add the item as a regular item.
+                    tree.addItem(moon);
+
+                    // Set it to be a child.
+                    tree.setParent(moon, planet);
+
+                    // Make the moons look like leaves.
+                    tree.setChildrenAllowed(moon, false);
+                }
+
+                // Expand the subtree.
+                tree.expandItemsRecursively(planet);
+            }
+        }
+
+        // Horizontal layout with the tree on the left and a details panel on
+        // the right.
+        final HorizontalLayout horlayout = new HorizontalLayout();
+        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.setExpandRatio(detailspanel, 1);
+
+        final VerticalLayout detailslayout = new VerticalLayout();
+        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;
+
+                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
+                        + "."));
+
+            }
+        });
+
+        main.setLayout(horlayout);
+    }
+
+    void example_Select(Window main, String param) {
+        final HorizontalLayout layout = new HorizontalLayout();
+        layout.addStyleName("aligntop");
+
+        if (param.equals("twincol")) {
+            final SelectExample select1 = new SelectExample(this, param,
+                    "Select some items", true);
+            layout.addComponent(select1);
+        } else if (param.equals("filter")) {
+            final SelectExample select1 = new SelectExample(this, param,
+                    "Enter containing substring", false);
+            layout.addComponent(select1);
+        } else {
+            final SelectExample select1 = new SelectExample(this, param,
+                    "Single Selection Mode", false);
+            final SelectExample select2 = new SelectExample(this, param,
+                    "Multiple Selection Mode", true);
+            layout.addComponent(select1);
+            layout.addComponent(select2);
+        }
+        main.addComponent(layout);
+    }
+
+    void example_FilterSelect(Window main, String param) {
+        final Select select = new Select("Enter containing substring");
+        main.addComponent(select);
+
+        select
+                .setFilteringMode(AbstractSelect.Filtering.FILTERINGMODE_CONTAINS);
+
+        /* Fill the component with some items. */
+        final String[] planets = new String[] { "Mercury", "Venus", "Earth",
+                "Mars", "Jupiter", "Saturn", "Uranus", "Neptune" };
+
+        for (int i = 0; i < planets.length; i++) {
+            for (int j = 0; j < planets.length; j++) {
+                select.addItem(planets[j] + " to " + planets[i]);
+            }
+        }
+    }
+
+    void example_TextField(Window main, String param) {
+        /* Add a single-line text field. */
+        final TextField subject = new TextField("Subject");
+        subject.setColumns(40);
+        main.addComponent(subject);
+
+        /* Add a multi-line text field. */
+        final TextField message = new TextField("Message");
+        message.setRows(7);
+        message.setColumns(40);
+        main.addComponent(message);
+    }
+
+    void example_TextFieldValidation(Window main, String param) {
+        // Create a text field with a label
+        final TextField username = new TextField("Username");
+        main.addComponent(username);
+
+        // Set visible length to 16 characters
+        username.setColumns(16);
+
+        // Set content length to minimum of 6 and maximum of 16 characters.
+        // The string also may not be null.
+        username.addValidator(new StringLengthValidator(
+                "Must be 6 to 16 characters long", 6, 16, false));
+
+        // Setting component immediate causes a ValueChangeEvent to occur
+        // when the TextField loses focus.
+        username.setImmediate(true);
+
+        // Listen for ValueChangeEvents and handle them
+        username.addListener(new ValueChangeListener() {
+            public void valueChange(ValueChangeEvent event) {
+                // Get the source of the event
+                final TextField username = (TextField) (event.getProperty());
+
+                try {
+                    // Validate the field value.
+                    username.validate();
+                } catch (final Validator.InvalidValueException e) {
+                    // The value was not ok. The error was set.
+                }
+            }
+        });
+    }
+
+    void example_UserError(final Window main, String param) {
+        if (param != null) {
+            if (param.equals("form")) {
+
+                final FormLayout layout = new FormLayout();
+                main.addComponent(layout);
+
+                final TextField textfield = new TextField("Enter code");
+                layout.addComponent(textfield);
+                textfield.setComponentError(null);
+
+                final Button button = new Button("Ok!");
+                layout.addComponent(button);
+
+                button.addListener(new Button.ClickListener() {
+                    public void buttonClick(ClickEvent event) {
+                        if (((String) textfield.getValue()).length() == 0) {
+                            textfield.setComponentError(new UserError(
+                                    "Must be letters and numbers."));
+                        } else {
+                            textfield.setComponentError(null);
+                        }
+                    }
+                });
+            }
+        } else {
+            main.setLayout(new HorizontalLayout());
+
+            // Create a field.
+            final TextField textfield = new TextField("Enter code");
+            main.addComponent(textfield);
+
+            // Let the component error be initially clear. (It actually is by
+            // default.)
+            textfield.setComponentError(null);
+
+            // Have a button right of the field (and align it properly).
+            final Button button = new Button("Ok!");
+            main.addComponent(button);
+            ((HorizontalLayout) main.getLayout()).setComponentAlignment(button,
+                    HorizontalLayout.ALIGNMENT_LEFT,
+                    HorizontalLayout.ALIGNMENT_BOTTOM);
+
+            // Handle button clicks
+            button.addListener(new Button.ClickListener() {
+                public void buttonClick(ClickEvent event) {
+                    // If the field value is bad, set its error.
+                    // (Here the content must be only alphanumeric characters.)
+                    if (!((String) textfield.getValue()).matches("^\\w*$")) {
+                        // Put the component in error state and set the error
+                        // message.
+                        textfield.setComponentError(new UserError(
+                                "Must be letters and numbers"));
+                    } else {
+                        // Otherwise clear it.
+                        textfield.setComponentError(null);
+                    }
+                }
+            });
+        }
+    }
+
+    void example_DateField(Window main, String param) {
+        HorizontalLayout layout = new HorizontalLayout();
+
+        /* Create a DateField with the calendar style. */
+        final DateField popupdate = new PopupDateField("Popup calendar field");
+
+        /* Set resolution of the date/time display. */
+        popupdate.setResolution(DateField.RESOLUTION_MIN);
+
+        /* Set the date and time to present. */
+        popupdate.setValue(new java.util.Date());
+
+        /* Create a DateField with the calendar style. */
+        final DateField inlinedate = new InlineDateField(
+                "Inline calendar field");
+
+        /* Set locale of the DateField to American English. */
+        inlinedate.setLocale(new Locale("en", "US"));
+
+        /* Set the date and time to present. */
+        inlinedate.setValue(new java.util.Date());
+
+        /* Set resolution of the date/time display. */
+        inlinedate.setResolution(DateField.RESOLUTION_MIN);
+
+        layout.addComponent(popupdate);
+        layout.addComponent(inlinedate);
+        layout.setSpacing(true);
+        main.addComponent(layout);
+    }
+
+    void example_Validator(Window main, String param) {
+        if (param != null && param.equals("required")) {
+            Form form = new Form();
+            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);
+            form.getLayout().addComponent(text);
+            return;
+        }
+        main.addComponent(new SSNField());
+    }
+
     // TODO add ClientWidget annotation if test is in use
-       class PagingTable extends Table {
-       }
-
-       void example_Table(Window main, String param) {
-               if (param != null) {
-                       if (param.equals("select")) {
-                               main.addComponent(new TableExample2());
-                       } else if (param.equals("component")) {
-                               main.addComponent(new TableExample3());
-                       } else if (param.equals("editable")) {
-                               main.addComponent(new TableEditable());
-                       } else if (param.equals("bean")) {
-                               main.addComponent(new TableEditableBean());
-                       } else if (param.equals("long")) {
-                               main.addComponent(new TableExample());
-                       } else if (param.equals("cellstyle")) {
-                               main.addComponent(new TableCellStyle());
-                       } else if (param.equals("huge")) {
-                               main.addComponent(new TableHuge());
-                       } 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));
-                               }
-                               main.addComponent(table);
-                       }
-               } else {
-                       main.addComponent(new TableExample1());
-               }
-       }
-
-       void example_Upload(Window main, String param) {
-               main.addComponent(new MyUploader());
-       }
-
-       void example_Link(Window main, String param) {
-
-               /* Create a link that opens the popup window. */
-               final Link alink = new Link();
-
-               /* Set the resource to be opened in the window. */
-               alink.setResource(new ExternalResource("http://www.vaadin.com/"));
-
-               main.addComponent(alink);
-
-               final ClassResource mydocument = new ClassResource("mydocument.pdf",
-                               this);
-               main.addComponent(new Link("The document (pdf)", mydocument));
-               main.addComponent(new Link("link to a resource", new ExternalResource(
-                               "http://www.vaadin.com/")));
-       }
-
-       void example_Button(Window main, String param) {
-               if (param != null) {
-                       if (param.equals("buttons")) {
-                               main.addComponent(new TheButton());
-                       }
-                       return;
-               }
-
-               // butts1 = new TheButton ();
-               // main.addComponent(butts1);
-
-               // butts2 = new TheButtons (main);
-               // butts3 = new TheButtons2 (main);
-
-               // Button checkbox = new Button ("This is a checkbox");
-
-               // main.addComponent(checkbox);
-               final Button button = new Button("My Button");
-               main.addComponent(button);
-       }
-
-       void example_CheckBox(Window main, String param) {
-               /* A check box with default state (not checked, i.e., false). */
-               final CheckBox checkbox1 = new CheckBox("My CheckBox");
-               checkbox1.addStyleName("mybox");
-               main.addComponent(checkbox1);
-
-               /* Another check box with explicitly set checked state. */
-               final CheckBox checkbox2 = new CheckBox("Checked CheckBox");
-               /*
-                * @TODO: Build fails here, why? checkbox2.setValue(true);
-                */
-               main.addComponent(checkbox2);
-
-               /*
-                * Make some application logic. We use anynymous listener classes here.
-                * The above references were defined as "final" to allow accessing them
-                * from inside anonymous classes.
-                */
-               checkbox1.addListener(new ValueChangeListener() {
-                       public void valueChange(ValueChangeEvent event) {
-                               /* Copy the value to the other checkbox. */
-                               checkbox2.setValue(checkbox1.getValue());
-                       }
-               });
-               checkbox2.addListener(new ValueChangeListener() {
-                       public void valueChange(ValueChangeEvent event) {
-                               /* Copy the value to the other checkbox. */
-                               checkbox1.setValue(checkbox2.getValue());
-                       }
-               });
-       }
-
-       void example_Panel(Window main, String param) {
-               // Create a panel with a caption.
-               final Panel panel = new Panel("Contact Information");
-
-               // Create a layout inside the panel
-               final FormLayout form = new FormLayout();
-
-               // Set the layout as the root layout of the panel
-               panel.setLayout(form);
-
-               // Add some components
-               form.addComponent(new TextField("Name"));
-               form.addComponent(new TextField("Email"));
-
-               // Add the panel to the main window
-               final ClassResource icon = new ClassResource("smiley.jpg", main
-                               .getApplication());
-               form.addComponent(new Embedded("Image", icon));
-               panel.setIcon(icon);
-               panel.addComponent(form);
-               main.addComponent(panel);
-       }
-
-       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());
-                               Embedded embedded = new Embedded("", img);
-                               grid.addComponent(embedded);
-                       }
-                       main.addComponent(grid);
-                       return;
-               }
-               /* Create a 4 by 4 grid layout. */
-               final GridLayout grid = new GridLayout(4, 4);
-               grid.addStyleName("example-gridlayout");
-
-               /* Fill out the first row using the cursor. */
-               grid.addComponent(new Button("R/C 1"));
-               for (int i = 0; i < 3; i++) {
-                       grid.addComponent(new Button("Col " + (grid.getCursorX() + 1)));
-               }
-
-               /* Fill out the first column using coordinates. */
-               for (int i = 1; i < 4; i++) {
-                       grid.addComponent(new Button("Row " + i), 0, i);
-               }
-
-               /* Add some components of various shapes. */
-               grid.addComponent(new Button("3x1 button"), 1, 1, 3, 1);
-               grid.addComponent(new Label("1x2 cell"), 1, 2, 1, 3);
-               final InlineDateField date = new InlineDateField("A 2x2 date field");
-               date.setResolution(DateField.RESOLUTION_DAY);
-               grid.addComponent(date, 2, 2, 3, 3);
-
-               main.addComponent(grid);
-       }
-
-       void example_Alignment(Window main, String param) {
-               if (param.equals("grid")) {
-                       /* Create a 3 by 3 grid layout. */
-                       final GridLayout layout = new GridLayout(3, 3);
-                       // OrderedLayout layout = new
-                       // OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
-                       main.setLayout(layout);
-                       layout.addStyleName("example-alignment");
-
-                       layout.setWidth(400, Sizeable.UNITS_PIXELS);
-                       layout.setHeight(400, Sizeable.UNITS_PIXELS);
-
-                       /* Define cells and their layouts to create. */
-
-                       Object cells[][] = {
-                                       { new Button("Top Left"),
-                                                       new Integer(AlignmentHandler.ALIGNMENT_LEFT),
-                                                       new Integer(AlignmentHandler.ALIGNMENT_TOP) },
-                                       {
-                                                       new Label("Top Center"),
-                                                       new Integer(
-                                                                       AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER),
-                                                       new Integer(AlignmentHandler.ALIGNMENT_TOP) },
-                                       { new Label("Top Right"),
-                                                       new Integer(AlignmentHandler.ALIGNMENT_RIGHT),
-                                                       new Integer(AlignmentHandler.ALIGNMENT_TOP) },
-                                       {
-                                                       new Button("Center Left"),
-                                                       new Integer(AlignmentHandler.ALIGNMENT_LEFT),
-                                                       new Integer(
-                                                                       AlignmentHandler.ALIGNMENT_VERTICAL_CENTER) },
-                                       {
-                                                       new Button("Center Center"),
-                                                       new Integer(
-                                                                       AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER),
-                                                       new Integer(
-                                                                       AlignmentHandler.ALIGNMENT_VERTICAL_CENTER) },
-                                       {
-                                                       new Button("Center Right"),
-                                                       new Integer(AlignmentHandler.ALIGNMENT_RIGHT),
-                                                       new Integer(
-                                                                       AlignmentHandler.ALIGNMENT_VERTICAL_CENTER) },
-                                       { new Button("Bottom Left"),
-                                                       new Integer(AlignmentHandler.ALIGNMENT_LEFT),
-                                                       new Integer(AlignmentHandler.ALIGNMENT_BOTTOM) },
-                                       {
-                                                       new Button("Bottom Center"),
-                                                       new Integer(
-                                                                       AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER),
-                                                       new Integer(AlignmentHandler.ALIGNMENT_BOTTOM) },
-                                       { new Button("Bottom Right"),
-                                                       new Integer(AlignmentHandler.ALIGNMENT_RIGHT),
-                                                       new Integer(AlignmentHandler.ALIGNMENT_BOTTOM) } };
-
-                       for (int i = 0; i < 9; i++) {
-                               HorizontalLayout celllayout = new HorizontalLayout();
-                               celllayout.addComponent((Component) cells[i][0]);
-                               if (i == 0) {
-                                       celllayout.setExpandRatio((Component) cells[i][0], 1);
-                               }
-
-                               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);
-
-                       // panel.addComponent(new )
-               }
-       }
-
-       void example_OrderedLayout(Window main, String param) {
-               final VerticalLayout layout = new VerticalLayout();
-               layout.addComponent(new TextField("Name"));
-               layout.addComponent(new TextField("Street address"));
-               layout.addComponent(new TextField("Postal code"));
-               main.addComponent(layout);
-       }
-
-       void example_FormLayout(Window main, String param) {
-               final FormLayout layout = new FormLayout();
-               layout.addComponent(new TextField("Text Field"));
-               layout.addComponent(new CheckBox("Check Box"));
-               layout.addComponent(new Select("Select"));
-               main.addComponent(layout);
-       }
-
-       void example_Form(Window main, String param) {
-               if (param != null && param.equals("simple")) {
-                       main.addComponent(new FormExample2());
-               } 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.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."));
-
-                       // Set the footer layout and add some text.
-                       form.setFooter(new VerticalLayout());
-                       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.
-                       HorizontalLayout okbar = new HorizontalLayout();
-                       okbar.setHeight("25px");
-                       Button okbutton = new Button("OK", form, "commit");
-                       okbar.addComponent(okbutton);
-                       okbar.setExpandRatio(okbutton, 1);
-                       okbar.setComponentAlignment(okbutton,
-                                       AlignmentHandler.ALIGNMENT_RIGHT,
-                                       AlignmentHandler.ALIGNMENT_TOP);
-                       okbar.addComponent(new Button("Reset", form, "discard"));
-                       okbar.addComponent(new Button("Cancel"));
-                       form.getFooter().addComponent(okbar);
-
-                       main.addComponent(form);
-               } 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");
-
-                       HorizontalLayout layout = new HorizontalLayout();
-                       layout.addComponent(widget);
-                       layout.setExpandRatio(widget, 1);
-                       layout.setComponentAlignment(widget,
-                                       AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER,
-                                       AlignmentHandler.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);
-
-                       HorizontalLayout layout = new HorizontalLayout();
-                       layout.setHeight(100, Sizeable.UNITS_PERCENTAGE);
-                       layout.setComponentAlignment(progress,
-                                       HorizontalLayout.ALIGNMENT_HORIZONTAL_CENTER,
-                                       HorizontalLayout.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 VerticalLayout expand2 = new VerticalLayout();
-                       expand2.addComponent(new Label("I am layout too."));
-
-                       // Original layout
-                       final VerticalLayout expand1 = new VerticalLayout();
-                       Button switchButton = new Button("Switch to other layout");
-                       switchButton.addListener(new Button.ClickListener() {
-                               public void buttonClick(ClickEvent event) {
-                                       mainwin.setLayout(null);
-                                       mainwin.setLayout(expand2);
-                               }
-                       });
-                       expand1.addComponent(switchButton);
-                       main.setLayout(expand1);
-
-                       return;
-               } else if (param != null && param.equals("size")) {
-                       VerticalLayout layout = new VerticalLayout();
-                       layout.setSizeFull();
-                       main.setLayout(layout);
-
-                       Button button = new Button("This is a button in middle of nowhere");
-                       layout.addComponent(button);
-                       layout.setComponentAlignment(button,
-                                       VerticalLayout.ALIGNMENT_HORIZONTAL_CENTER,
-                                       VerticalLayout.ALIGNMENT_VERTICAL_CENTER);
-                       layout.setExpandRatio(button, 1.0f);
-                       return;
-               }
-
-               for (int w = 0; w < 2; w++) {
-                       final VerticalLayout layout = new VerticalLayout();
-
-                       /* Set the expanding layout as the root layout of a child window. */
-                       final Window window = new Window("A Child Window", layout);
-                       main.addWindow(window);
-
-                       /* Add some component above the expanding one. */
-                       layout.addComponent(new Label("Here be some component."));
-
-                       /* Create the expanding component. */
-                       final Table table = new Table("My Ever-Expanding Table");
-                       /*
-                        * 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);
-                        */
-                       layout.addComponent(table);
-
-                       /* Designate the table to be the expanding component. */
-                       layout.setExpandRatio(table, 1.0f);
-
-                       /* Set it to use all available area. */
-                       table.setSizeFull();
-
-                       /* Add some component below the expanding one. */
-                       final Button button2 = new Button("Ok");
-                       layout.addComponent(button2);
-                       layout.setComponentAlignment(button2,
-                                       AlignmentHandler.ALIGNMENT_RIGHT, 0);
-               }
-       }
-
-       void example_TabSheet(Window main, String param) {
-               if (param != null) {
-               if (param.equals("simple")) {
-                   // Create an empty tab sheet.
-                   TabSheet tabsheet = new TabSheet();
-                   
-                   // Create a component to put in a tab and put
-                   // some content in it.
-                   VerticalLayout myTab = new VerticalLayout();
-                   myTab.addComponent(new Label("Hello, I am a Tab!"));
-                   
-                   // Add the component to the tab sheet as a new tab.
-                   tabsheet.addTab(myTab);
-                   
-                   // Get the Tab holding the component and set its caption.
-                   tabsheet.getTab(myTab).setCaption("My Tab");
-
-               } else if (param.equals("icon")) {
-                               final TabSheet tabsheet = new TabSheet();
-       
-                               tabsheet.addTab(new Label("Contents of the first tab"),
-                                               "First Tab", new ClassResource("images/Mercury_small.png",
-                                                               main.getApplication()));
-                               tabsheet.addTab(new Label("Contents of the second tab"),
-                                               "Second Tab", new ClassResource("images/Venus_small.png",
-                                                               this));
-                               tabsheet.addTab(new Label("Contents of the third tab"),
-                                               "Third tab", new ClassResource("images/Earth_small.png",
-                                                               this));
-       
-                               main.addComponent(tabsheet);
-                               // main.addComponent(new Embedded("Emb", new ClassResource
-                               // ("images/Mercury_small.png", this)));
-                       } else if (param.equals("expanding")) {
-                               // Create the layout
-                               VerticalLayout layout = new VerticalLayout();
-       
-                               // 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);
-       
-                               // Set the tabsheet to scale to full size inside its container
-                               tabsheet.setWidth(100, Sizeable.UNITS_PERCENTAGE);
-                               tabsheet.setHeight(100, Sizeable.UNITS_PERCENTAGE);
-       
-                               // Add the tab sheet to the layout as usual
-                               layout.addComponent(tabsheet);
-       
-                               // Set the tab sheet to be the expanding component
-                               layout.setExpandRatio(tabsheet, 1);
-                       } else if (param.equals("ordered")) {
-                               // Create the layout
-                               VerticalLayout layout = new VerticalLayout();
-       
-                               // 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);
-       
-                               // Set the tabsheet to scale to full size inside its container
-                               tabsheet.setWidth(100, Sizeable.UNITS_PERCENTAGE);
-                               // tabsheet().setHeight(100, Sizeable.UNITS_PERCENTAGE);
-       
-                               // Add the tab sheet to the layout as usual
-                               layout.addComponent(tabsheet);
-                       }
-               } else {
-                       main.addComponent(new TabSheetExample());
-               }
-       }
-
-       void example_Embedded(Window main, String param) {
-               final Embedded image = new Embedded("", new ClassResource("smiley.jpg",
-                               this));
-               image.addStyleName("omaimage");
-               main.addComponent(image);
-
-               final EmbeddedButton button = new EmbeddedButton(new ClassResource(
-                               "smiley.jpg", this));
-               main.addComponent(button);
-       }
-
-       void example_Window(Window main, String param) {
-               if (param != null) {
-                       if (param.equals("opener")) {
-                               main.addComponent(new WindowOpener("Window Opener", main));
-                       } else if (param.equals("multiple")) {
-                               /* Create a new window. */
-                               final Window mywindow = new Window("Second Window");
-                               mywindow.setName("mywindow");
-                               mywindow.addComponent(new Label("This is a second window."));
-
-                               /* Add the window to the application. */
-                               main.getApplication().addWindow(mywindow);
-
-                               /* Add link to the second window in the main window. */
-                               main.addComponent(new Label("Second window: <a href='"
-                                               + mywindow.getURL() + "'>middle-click to open</a>",
-                                               Label.CONTENT_XHTML));
-                               main.addComponent(new Label(
-                                               "The second window can be accessed through URL: "
-                                                               + mywindow.getURL()));
-                       }
-                       return;
-               }
-
-               /* Create a new window. */
-               final Window mywindow = new Window("My Window");
-               mywindow.setName("mywindow");
-
-               /* Add some components in the window. */
-               mywindow.addComponent(new Label("A text label in the window."));
-               final Button okbutton = new Button("OK");
-               mywindow.addComponent(okbutton);
-
-               /* Set window size. */
-               mywindow.setHeight("200px");
-               mywindow.setWidth("400px");
-
-               /* Set window position. */
-               mywindow.setPositionX(200);
-               mywindow.setPositionY(50);
-
-               /* Add the window to the Application object. */
-               main.addWindow(mywindow);
-
-       }
-
-       void example_ClassResource(Window main, String param) {
-               final DateField df = new DateField();
-               main.addComponent(df);
-               df.setIcon(new ClassResource("smiley.jpg", main.getApplication()));
-               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));
-                               main.addComponent(indicator);
-
-                               // Set polling frequency to 0.5 seconds.
-                               indicator.setPollingInterval(1000);
-
-                               // 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 {
-                                       @Override
-                                       public void run() {
-                                               double current = 0.0;
-                                               while (true) {
-                                                       // Do some "heavy work"
-                                                       try {
-                                                               sleep(50); // Sleep for 50 milliseconds
-                                                       } catch (InterruptedException e) {
-                                                       }
-
-                                                       // Grow the progress value until it reaches 1.0.
-                                                       current += 0.01;
-                                                       if (current > 1.0) {
-                                                               indicator.setValue(new Float(1.0));
-                                                       } else {
-                                                               indicator.setValue(new Float(current));
-                                                       }
-
-                                                       // After the progress is full for a while, stop.
-                                                       if (current > 1.2) {
-                                                               // Restore the state to initial.
-                                                               indicator.setValue(new Float(0.0));
-                                                               button.setVisible(true);
-                                                               break;
-                                                       }
-                                               }
-                                       }
-                               }
-
-                               // 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
-                               final Table table = new Table();
-                               table.setPageLength(5);
-                               table.setWidth(100, Sizeable.UNITS_PERCENTAGE);
-                               table.addContainerProperty("Name", String.class, "");
-                               main.addComponent(table);
-
-                               // Create the second window
-                               final Window adderWindow = new Window("Add Items");
-                               adderWindow.setName("win-adder");
-                               main.getApplication().addWindow(adderWindow);
-
-                               // Create selection component to add items to the table
-                               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++) {
-                                       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 (select.getValue() != null) {
-                                                       // 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);
-                               main.addComponent(link);
-
-                               // Enable polling to update the main window
-                               ProgressIndicator poller = new ProgressIndicator();
-                               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,
-                               // AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER,
-                               // AlignmentHandler.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,
-                                * AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER,
-                                * AlignmentHandler.ALIGNMENT_VERTICAL_CENTER);
-                                * layout().setWidth(100, Sizeable.UNITS_PERCENTAGE);
-                                * layout().setHeight(100, Sizeable.UNITS_PERCENTAGE);
-                                */
-
-                       }
-               } else {
-                       ProgressIndicator poller = new ProgressIndicator(new Float(0.0));
-                       poller.setPollingInterval(1000000);
-                       poller.setIndeterminate(true);
-                       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
-                               if (custom.getComponent("okbutton") == ok) {
-                                       System.out.println("Changing to deny button.");
-                                       custom.addComponent(deny, "okbutton");
-                               } else {
-                                       System.out.println("Changing to ok button.");
-                                       custom.addComponent(ok, "okbutton");
-                               }
-                       }
-               };
-
-               ok.addListener(listener);
-               deny.addListener(listener);
-       }
-
-       void example_Spacing(final Window main, String param) {
-               VerticalLayout containinglayout = new VerticalLayout();
-               main.setLayout(containinglayout);
-
-               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);
-               HorizontalLayout layout1 = new HorizontalLayout();
-               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);
-               HorizontalLayout layout2 = new HorizontalLayout();
-               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);
-               VerticalLayout layout3 = new VerticalLayout();
-               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);
-               VerticalLayout layout4 = new VerticalLayout();
-               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) {
-               HorizontalLayout hor = new HorizontalLayout();
-               main.setLayout(hor);
-
-               VerticalLayout containinglayout = new VerticalLayout();
-               hor.addComponent(containinglayout);
-
-               VerticalLayout layout1 = new VerticalLayout();
-               containinglayout.addComponent(new Label("Regular layout margins:"));
-               containinglayout.addComponent(layout1);
-               layout1.addStyleName("marginexample1");
-               layout1.addComponent(new Button("Component 1"));
-               layout1.addComponent(new Button("Component 2"));
-               layout1.addComponent(new Button("Component 3"));
-
-               // Create a layout
-               VerticalLayout layout2 = new VerticalLayout();
-               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"));
-               layout2.addComponent(new Button("Component 3"));
-       }
-
-       void example_ClientInfo(final Window main, String param) {
-               // Get the client identification string
-               WebApplicationContext context2 = (WebApplicationContext) getContext();
-               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) {
-
-                               }
-                       }
-               }
-       }
-
-       void example_Notification(final Window main, String param) {
-               // final Window sub1 = new Window("");
-               // main.addWindow(sub1);
-               if (param.equals("example")) {
-                       main.showNotification("This is the caption",
-                                       "This is the description");
-                       return;
-               } else if (param.equals("type")) {
-                       main.showNotification("This is a warning",
-                                       "<br/>This is the <i>last</i> warning",
-                                       Window.Notification.TYPE_WARNING_MESSAGE);
-                       return;
-               } else if (param.equals("pos")) {
-                       // Create a notification with the default settings for a warning.
-                       Window.Notification notif = new Window.Notification("Be warned!",
-                                       "This message lurks in the top-left corner!",
-                                       Window.Notification.TYPE_WARNING_MESSAGE);
-
-                       // Set the position.
-                       notif.setPosition(Window.Notification.POSITION_TOP_LEFT);
-
-                       // Let it stay there until the user clicks it
-                       notif.setDelayMsec(-1);
-
-                       // Show it in the main window.
-                       main.showNotification(notif);
-                       return;
-               }
-
-               main.setLayout(new HorizontalLayout());
-
-               final Integer type_humanized = Window.Notification.TYPE_HUMANIZED_MESSAGE;
-               final Integer type_warning = Window.Notification.TYPE_WARNING_MESSAGE;
-               final Integer type_error = Window.Notification.TYPE_ERROR_MESSAGE;
-               final Integer type_tray = Window.Notification.TYPE_TRAY_NOTIFICATION;
-               final NativeSelect types = new NativeSelect();
-               main.addComponent(types);
-               types.addItem(type_humanized);
-               types.addItem(type_warning);
-               types.addItem(type_error);
-               types.addItem(type_tray);
-               types.setItemCaption(type_humanized, "Humanized");
-               types.setItemCaption(type_warning, "Warning");
-               types.setItemCaption(type_error, "Error");
-               types.setItemCaption(type_tray, "Tray");
-
-               Button show = new Button("Show Notification");
-               main.addComponent(show);
-
-               show.addListener(new Button.ClickListener() {
-                       public void buttonClick(ClickEvent event) {
-                               String caption = "";
-                               String description = "";
-                               switch (((Integer) types.getValue()).intValue()) {
-                               case Window.Notification.TYPE_HUMANIZED_MESSAGE:
-                                       caption = "Humanized message";
-                                       description = "<br/>For minimal annoyance";
-                                       break;
-                               case Window.Notification.TYPE_WARNING_MESSAGE:
-                                       caption = "Warning message";
-                                       description = "<br/>For notifications of medium importance";
-                                       break;
-                               case Window.Notification.TYPE_ERROR_MESSAGE:
-                                       caption = "Error message";
-                                       description = "<br/>For important notifications";
-                                       break;
-                               case Window.Notification.TYPE_TRAY_NOTIFICATION:
-                                       caption = "Tray notification";
-                                       description = "<br/>Stays up longer - but away";
-                               }
-                               // main.showNotification("The default notification");
-                               Window.Notification notif = new Window.Notification(caption,
-                                               description, (Integer) types.getValue());
-                               // notif.setPosition(Window.Notification.POSITION_TOP_LEFT);
-                               notif.setDelayMsec(-1);
-                               main.showNotification(notif);
-                       }
-               });
-
-               // 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));
-                       return;
-               }
-
-               // A button to open the printer-friendly page.
-               Button printButton = new Button("Click to Print");
-               main.addComponent(printButton);
-               printButton.addListener(new Button.ClickListener() {
-                       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."));
-
-                               // To execute the print() JavaScript, we need to run it
-                               // from a custom layout.
-                               CustomLayout scriptLayout = new CustomLayout("printpage");
-                               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));
-       }
-
-       void example_RichTextArea(final Window main, String param) {
-               main.setLayout(new HorizontalLayout());
-
-               // Create a rich text area
-               final RichTextArea rtarea = new RichTextArea();
-               rtarea.addStyleName("richtextexample");
-               // rtarea.setCaption("My Rich Text Area");
-
-               // Set initial content as HTML
-               rtarea
-                               .setValue("<h1>Hello</h1>\n<p>This rich text area 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());
-               show.addListener(new Button.ClickListener() {
-                       public void buttonClick(ClickEvent event) {
-                               html.setValue(rtarea.getValue());
-                       }
-               });
-
-               Panel rtPanel = new Panel("Rich Text Area");
-               rtPanel.addComponent(rtarea);
-               rtPanel.addComponent(show);
-
-               Panel valuePanel = new Panel("Value");
-               valuePanel.addComponent(html);
-
-               main.addComponent(rtPanel);
-               main.addComponent(valuePanel);
-       }
-
-       void example_QueryContainer(final Window main, String param) {
-               try {
-                       // Create a database connection
-                       Class.forName("org.hsqldb.jdbcDriver");
-                       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.close();
-                       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.close();
-                       }
-
-                       // Query the database
-                       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.
-                       select.setContainerDataSource(qc);
-
-                       // 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.
-                       select.setItemCaptionPropertyId("name");
-
-                       // When selection changes, display the selected item.
-                       select.setImmediate(true);
-                       final Label selection = new Label("Currently selected: -");
-                       select.addListener(new ValueChangeListener() {
-                               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.
-                                       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") + ")");
-                               }
-                       });
-
-                       main.addComponent(select);
-                       main.addComponent(selection);
-               } catch (SQLException e) {
-                       e.printStackTrace();
-               } catch (ClassNotFoundException e) {
-                       e.printStackTrace();
-               }
-       }
-
-       void example_MenuBar(final Window main, String param) {
-               // 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.");
-                       }
-               };
-
-               // Put some items in the menu hierarchically
-               MenuBar.MenuItem beverages = menubar.addItem("Beverages", null, null);
-               MenuBar.MenuItem hot_beverages = beverages.addItem("Hot", null, null);
-               hot_beverages.addItem("Tea", null, mycommand);
-               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);
-       }
-
-       void example_AbsoluteLayout(final Window main, String param) {
-               AbsoluteLayout layout = new AbsoluteLayout();
-               layout.setWidth("400px");
-               layout.setHeight("400px");
-               main.setContent(layout);
-               
-               final Button button = new Button ("This could be anywhere");
-               layout.addComponent(button, "top: 100px; left: 50px;");
-       }
+    class PagingTable extends Table {
+    }
+
+    void example_Table(Window main, String param) {
+        if (param != null) {
+            if (param.equals("select")) {
+                main.addComponent(new TableExample2());
+            } else if (param.equals("component")) {
+                main.addComponent(new TableExample3());
+            } else if (param.equals("editable")) {
+                main.addComponent(new TableEditable());
+            } else if (param.equals("bean")) {
+                main.addComponent(new TableEditableBean());
+            } else if (param.equals("long")) {
+                main.addComponent(new TableExample());
+            } else if (param.equals("cellstyle")) {
+                main.addComponent(new TableCellStyle());
+            } else if (param.equals("huge")) {
+                main.addComponent(new TableHuge());
+            } 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));
+                }
+                main.addComponent(table);
+            }
+        } else {
+            main.addComponent(new TableExample1());
+        }
+    }
+
+    void example_Upload(Window main, String param) {
+        main.addComponent(new MyUploader());
+    }
+
+    void example_Link(Window main, String param) {
+
+        /* Create a link that opens the popup window. */
+        final Link alink = new Link();
+
+        /* Set the resource to be opened in the window. */
+        alink.setResource(new ExternalResource("http://www.vaadin.com/"));
+
+        main.addComponent(alink);
+
+        final ClassResource mydocument = new ClassResource("mydocument.pdf",
+                this);
+        main.addComponent(new Link("The document (pdf)", mydocument));
+        main.addComponent(new Link("link to a resource", new ExternalResource(
+                "http://www.vaadin.com/")));
+    }
+
+    void example_Button(Window main, String param) {
+        if (param != null) {
+            if (param.equals("buttons")) {
+                main.addComponent(new TheButton());
+            }
+            return;
+        }
+
+        // butts1 = new TheButton ();
+        // main.addComponent(butts1);
+
+        // butts2 = new TheButtons (main);
+        // butts3 = new TheButtons2 (main);
+
+        // Button checkbox = new Button ("This is a checkbox");
+
+        // main.addComponent(checkbox);
+        final Button button = new Button("My Button");
+        main.addComponent(button);
+    }
+
+    void example_CheckBox(Window main, String param) {
+        /* A check box with default state (not checked, i.e., false). */
+        final CheckBox checkbox1 = new CheckBox("My CheckBox");
+        checkbox1.addStyleName("mybox");
+        main.addComponent(checkbox1);
+
+        /* Another check box with explicitly set checked state. */
+        final CheckBox checkbox2 = new CheckBox("Checked CheckBox");
+        /*
+         * @TODO: Build fails here, why? checkbox2.setValue(true);
+         */
+        main.addComponent(checkbox2);
+
+        /*
+         * Make some application logic. We use anynymous listener classes here.
+         * The above references were defined as "final" to allow accessing them
+         * from inside anonymous classes.
+         */
+        checkbox1.addListener(new ValueChangeListener() {
+            public void valueChange(ValueChangeEvent event) {
+                /* Copy the value to the other checkbox. */
+                checkbox2.setValue(checkbox1.getValue());
+            }
+        });
+        checkbox2.addListener(new ValueChangeListener() {
+            public void valueChange(ValueChangeEvent event) {
+                /* Copy the value to the other checkbox. */
+                checkbox1.setValue(checkbox2.getValue());
+            }
+        });
+    }
+
+    void example_Panel(Window main, String param) {
+        // Create a panel with a caption.
+        final Panel panel = new Panel("Contact Information");
+
+        // Create a layout inside the panel
+        final FormLayout form = new FormLayout();
+
+        // Set the layout as the root layout of the panel
+        panel.setLayout(form);
+
+        // Add some components
+        form.addComponent(new TextField("Name"));
+        form.addComponent(new TextField("Email"));
+
+        // Add the panel to the main window
+        final ClassResource icon = new ClassResource("smiley.jpg", main
+                .getApplication());
+        form.addComponent(new Embedded("Image", icon));
+        panel.setIcon(icon);
+        panel.addComponent(form);
+        main.addComponent(panel);
+    }
+
+    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());
+                Embedded embedded = new Embedded("", img);
+                grid.addComponent(embedded);
+            }
+            main.addComponent(grid);
+            return;
+        }
+        /* Create a 4 by 4 grid layout. */
+        final GridLayout grid = new GridLayout(4, 4);
+        grid.addStyleName("example-gridlayout");
+
+        /* Fill out the first row using the cursor. */
+        grid.addComponent(new Button("R/C 1"));
+        for (int i = 0; i < 3; i++) {
+            grid.addComponent(new Button("Col " + (grid.getCursorX() + 1)));
+        }
+
+        /* Fill out the first column using coordinates. */
+        for (int i = 1; i < 4; i++) {
+            grid.addComponent(new Button("Row " + i), 0, i);
+        }
+
+        /* Add some components of various shapes. */
+        grid.addComponent(new Button("3x1 button"), 1, 1, 3, 1);
+        grid.addComponent(new Label("1x2 cell"), 1, 2, 1, 3);
+        final InlineDateField date = new InlineDateField("A 2x2 date field");
+        date.setResolution(DateField.RESOLUTION_DAY);
+        grid.addComponent(date, 2, 2, 3, 3);
+
+        main.addComponent(grid);
+    }
+
+    void example_Alignment(Window main, String param) {
+        if (param.equals("grid")) {
+            /* Create a 3 by 3 grid layout. */
+            final GridLayout layout = new GridLayout(3, 3);
+            // OrderedLayout layout = new
+            // OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
+            main.setLayout(layout);
+            layout.addStyleName("example-alignment");
+
+            layout.setWidth(400, Sizeable.UNITS_PIXELS);
+            layout.setHeight(400, Sizeable.UNITS_PIXELS);
+
+            /* Define cells and their layouts to create. */
+
+            Object cells[][] = {
+                    { new Button("Top Left"),
+                            new Integer(AlignmentHandler.ALIGNMENT_LEFT),
+                            new Integer(AlignmentHandler.ALIGNMENT_TOP) },
+                    {
+                            new Label("Top Center"),
+                            new Integer(
+                                    AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER),
+                            new Integer(AlignmentHandler.ALIGNMENT_TOP) },
+                    { new Label("Top Right"),
+                            new Integer(AlignmentHandler.ALIGNMENT_RIGHT),
+                            new Integer(AlignmentHandler.ALIGNMENT_TOP) },
+                    {
+                            new Button("Center Left"),
+                            new Integer(AlignmentHandler.ALIGNMENT_LEFT),
+                            new Integer(
+                                    AlignmentHandler.ALIGNMENT_VERTICAL_CENTER) },
+                    {
+                            new Button("Center Center"),
+                            new Integer(
+                                    AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER),
+                            new Integer(
+                                    AlignmentHandler.ALIGNMENT_VERTICAL_CENTER) },
+                    {
+                            new Button("Center Right"),
+                            new Integer(AlignmentHandler.ALIGNMENT_RIGHT),
+                            new Integer(
+                                    AlignmentHandler.ALIGNMENT_VERTICAL_CENTER) },
+                    { new Button("Bottom Left"),
+                            new Integer(AlignmentHandler.ALIGNMENT_LEFT),
+                            new Integer(AlignmentHandler.ALIGNMENT_BOTTOM) },
+                    {
+                            new Button("Bottom Center"),
+                            new Integer(
+                                    AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER),
+                            new Integer(AlignmentHandler.ALIGNMENT_BOTTOM) },
+                    { new Button("Bottom Right"),
+                            new Integer(AlignmentHandler.ALIGNMENT_RIGHT),
+                            new Integer(AlignmentHandler.ALIGNMENT_BOTTOM) } };
+
+            for (int i = 0; i < 9; i++) {
+                HorizontalLayout celllayout = new HorizontalLayout();
+                celllayout.addComponent((Component) cells[i][0]);
+                if (i == 0) {
+                    celllayout.setExpandRatio((Component) cells[i][0], 1);
+                }
+
+                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);
+
+            // panel.addComponent(new )
+        }
+    }
+
+    void example_OrderedLayout(Window main, String param) {
+        final VerticalLayout layout = new VerticalLayout();
+        layout.addComponent(new TextField("Name"));
+        layout.addComponent(new TextField("Street address"));
+        layout.addComponent(new TextField("Postal code"));
+        main.addComponent(layout);
+    }
+
+    void example_FormLayout(Window main, String param) {
+        final FormLayout layout = new FormLayout();
+        layout.addComponent(new TextField("Text Field"));
+        layout.addComponent(new CheckBox("Check Box"));
+        layout.addComponent(new Select("Select"));
+        main.addComponent(layout);
+    }
+
+    void example_Form(Window main, String param) {
+        if (param != null && param.equals("simple")) {
+            main.addComponent(new FormExample2());
+        } 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.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."));
+
+            // Set the footer layout and add some text.
+            form.setFooter(new VerticalLayout());
+            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.
+            HorizontalLayout okbar = new HorizontalLayout();
+            okbar.setHeight("25px");
+            Button okbutton = new Button("OK", form, "commit");
+            okbar.addComponent(okbutton);
+            okbar.setExpandRatio(okbutton, 1);
+            okbar.setComponentAlignment(okbutton,
+                    AlignmentHandler.ALIGNMENT_RIGHT,
+                    AlignmentHandler.ALIGNMENT_TOP);
+            okbar.addComponent(new Button("Reset", form, "discard"));
+            okbar.addComponent(new Button("Cancel"));
+            form.getFooter().addComponent(okbar);
+
+            main.addComponent(form);
+        } 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");
+
+            HorizontalLayout layout = new HorizontalLayout();
+            layout.addComponent(widget);
+            layout.setExpandRatio(widget, 1);
+            layout.setComponentAlignment(widget,
+                    AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER,
+                    AlignmentHandler.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);
+
+            HorizontalLayout layout = new HorizontalLayout();
+            layout.setHeight(100, Sizeable.UNITS_PERCENTAGE);
+            layout.setComponentAlignment(progress,
+                    HorizontalLayout.ALIGNMENT_HORIZONTAL_CENTER,
+                    HorizontalLayout.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 VerticalLayout expand2 = new VerticalLayout();
+            expand2.addComponent(new Label("I am layout too."));
+
+            // Original layout
+            final VerticalLayout expand1 = new VerticalLayout();
+            Button switchButton = new Button("Switch to other layout");
+            switchButton.addListener(new Button.ClickListener() {
+                public void buttonClick(ClickEvent event) {
+                    mainwin.setLayout(null);
+                    mainwin.setLayout(expand2);
+                }
+            });
+            expand1.addComponent(switchButton);
+            main.setLayout(expand1);
+
+            return;
+        } else if (param != null && param.equals("size")) {
+            VerticalLayout layout = new VerticalLayout();
+            layout.setSizeFull();
+            main.setLayout(layout);
+
+            Button button = new Button("This is a button in middle of nowhere");
+            layout.addComponent(button);
+            layout.setComponentAlignment(button,
+                    VerticalLayout.ALIGNMENT_HORIZONTAL_CENTER,
+                    VerticalLayout.ALIGNMENT_VERTICAL_CENTER);
+            layout.setExpandRatio(button, 1.0f);
+            return;
+        }
+
+        for (int w = 0; w < 2; w++) {
+            final VerticalLayout layout = new VerticalLayout();
+
+            /* Set the expanding layout as the root layout of a child window. */
+            final Window window = new Window("A Child Window", layout);
+            main.addWindow(window);
+
+            /* Add some component above the expanding one. */
+            layout.addComponent(new Label("Here be some component."));
+
+            /* Create the expanding component. */
+            final Table table = new Table("My Ever-Expanding Table");
+            /*
+             * 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);
+             */
+            layout.addComponent(table);
+
+            /* Designate the table to be the expanding component. */
+            layout.setExpandRatio(table, 1.0f);
+
+            /* Set it to use all available area. */
+            table.setSizeFull();
+
+            /* Add some component below the expanding one. */
+            final Button button2 = new Button("Ok");
+            layout.addComponent(button2);
+            layout.setComponentAlignment(button2,
+                    AlignmentHandler.ALIGNMENT_RIGHT, 0);
+        }
+    }
+
+    void example_TabSheet(Window main, String param) {
+        if (param != null) {
+            if (param.equals("simple")) {
+                // Create an empty tab sheet.
+                TabSheet tabsheet = new TabSheet();
+
+                // Create a component to put in a tab and put
+                // some content in it.
+                VerticalLayout myTab = new VerticalLayout();
+                myTab.addComponent(new Label("Hello, I am a Tab!"));
+
+                // Add the component to the tab sheet as a new tab.
+                tabsheet.addTab(myTab);
+
+                // Get the Tab holding the component and set its caption.
+                tabsheet.getTab(myTab).setCaption("My Tab");
+
+            } else if (param.equals("icon")) {
+                final TabSheet tabsheet = new TabSheet();
+
+                tabsheet.addTab(new Label("Contents of the first tab"),
+                        "First Tab", new ClassResource(
+                                "images/Mercury_small.png", main
+                                        .getApplication()));
+                tabsheet.addTab(new Label("Contents of the second tab"),
+                        "Second Tab", new ClassResource(
+                                "images/Venus_small.png", this));
+                tabsheet.addTab(new Label("Contents of the third tab"),
+                        "Third tab", new ClassResource(
+                                "images/Earth_small.png", this));
+
+                main.addComponent(tabsheet);
+                // main.addComponent(new Embedded("Emb", new ClassResource
+                // ("images/Mercury_small.png", this)));
+            } else if (param.equals("expanding")) {
+                // Create the layout
+                VerticalLayout layout = new VerticalLayout();
+
+                // 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);
+
+                // Set the tabsheet to scale to full size inside its container
+                tabsheet.setWidth(100, Sizeable.UNITS_PERCENTAGE);
+                tabsheet.setHeight(100, Sizeable.UNITS_PERCENTAGE);
+
+                // Add the tab sheet to the layout as usual
+                layout.addComponent(tabsheet);
+
+                // Set the tab sheet to be the expanding component
+                layout.setExpandRatio(tabsheet, 1);
+            } else if (param.equals("ordered")) {
+                // Create the layout
+                VerticalLayout layout = new VerticalLayout();
+
+                // 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);
+
+                // Set the tabsheet to scale to full size inside its container
+                tabsheet.setWidth(100, Sizeable.UNITS_PERCENTAGE);
+                // tabsheet().setHeight(100, Sizeable.UNITS_PERCENTAGE);
+
+                // Add the tab sheet to the layout as usual
+                layout.addComponent(tabsheet);
+            }
+        } else {
+            main.addComponent(new TabSheetExample());
+        }
+    }
+
+    void example_Embedded(Window main, String param) {
+        final Embedded image = new Embedded("", new ClassResource("smiley.jpg",
+                this));
+        image.addStyleName("omaimage");
+        main.addComponent(image);
+
+        final EmbeddedButton button = new EmbeddedButton(new ClassResource(
+                "smiley.jpg", this));
+        main.addComponent(button);
+    }
+
+    void example_Window(Window main, String param) {
+        if (param != null) {
+            if (param.equals("opener")) {
+                main.addComponent(new WindowOpener("Window Opener", main));
+            } else if (param.equals("multiple")) {
+                /* Create a new window. */
+                final Window mywindow = new Window("Second Window");
+                mywindow.setName("mywindow");
+                mywindow.addComponent(new Label("This is a second window."));
+
+                /* Add the window to the application. */
+                main.getApplication().addWindow(mywindow);
+
+                /* Add link to the second window in the main window. */
+                main.addComponent(new Label("Second window: <a href='"
+                        + mywindow.getURL() + "'>middle-click to open</a>",
+                        Label.CONTENT_XHTML));
+                main.addComponent(new Label(
+                        "The second window can be accessed through URL: "
+                                + mywindow.getURL()));
+            }
+            return;
+        }
+
+        /* Create a new window. */
+        final Window mywindow = new Window("My Window");
+        mywindow.setName("mywindow");
+
+        /* Add some components in the window. */
+        mywindow.addComponent(new Label("A text label in the window."));
+        final Button okbutton = new Button("OK");
+        mywindow.addComponent(okbutton);
+
+        /* Set window size. */
+        mywindow.setHeight("200px");
+        mywindow.setWidth("400px");
+
+        /* Set window position. */
+        mywindow.setPositionX(200);
+        mywindow.setPositionY(50);
+
+        /* Add the window to the Application object. */
+        main.addWindow(mywindow);
+
+    }
+
+    void example_ClassResource(Window main, String param) {
+        final DateField df = new DateField();
+        main.addComponent(df);
+        df.setIcon(new ClassResource("smiley.jpg", main.getApplication()));
+        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));
+                main.addComponent(indicator);
+
+                // Set polling frequency to 0.5 seconds.
+                indicator.setPollingInterval(1000);
+
+                // 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 {
+                    @Override
+                    public void run() {
+                        double current = 0.0;
+                        while (true) {
+                            // Do some "heavy work"
+                            try {
+                                sleep(50); // Sleep for 50 milliseconds
+                            } catch (InterruptedException e) {
+                            }
+
+                            // Grow the progress value until it reaches 1.0.
+                            current += 0.01;
+                            if (current > 1.0) {
+                                indicator.setValue(new Float(1.0));
+                            } else {
+                                indicator.setValue(new Float(current));
+                            }
+
+                            // After the progress is full for a while, stop.
+                            if (current > 1.2) {
+                                // Restore the state to initial.
+                                indicator.setValue(new Float(0.0));
+                                button.setVisible(true);
+                                break;
+                            }
+                        }
+                    }
+                }
+
+                // 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
+                final Table table = new Table();
+                table.setPageLength(5);
+                table.setWidth(100, Sizeable.UNITS_PERCENTAGE);
+                table.addContainerProperty("Name", String.class, "");
+                main.addComponent(table);
+
+                // Create the second window
+                final Window adderWindow = new Window("Add Items");
+                adderWindow.setName("win-adder");
+                main.getApplication().addWindow(adderWindow);
+
+                // Create selection component to add items to the table
+                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++) {
+                    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 (select.getValue() != null) {
+                            // 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);
+                main.addComponent(link);
+
+                // Enable polling to update the main window
+                ProgressIndicator poller = new ProgressIndicator();
+                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,
+                // AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER,
+                // AlignmentHandler.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,
+                 * AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER,
+                 * AlignmentHandler.ALIGNMENT_VERTICAL_CENTER);
+                 * layout().setWidth(100, Sizeable.UNITS_PERCENTAGE);
+                 * layout().setHeight(100, Sizeable.UNITS_PERCENTAGE);
+                 */
+
+            }
+        } else {
+            ProgressIndicator poller = new ProgressIndicator(new Float(0.0));
+            poller.setPollingInterval(1000000);
+            poller.setIndeterminate(true);
+            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
+                if (custom.getComponent("okbutton") == ok) {
+                    System.out.println("Changing to deny button.");
+                    custom.addComponent(deny, "okbutton");
+                } else {
+                    System.out.println("Changing to ok button.");
+                    custom.addComponent(ok, "okbutton");
+                }
+            }
+        };
+
+        ok.addListener(listener);
+        deny.addListener(listener);
+    }
+
+    void example_Spacing(final Window main, String param) {
+        VerticalLayout containinglayout = new VerticalLayout();
+        main.setLayout(containinglayout);
+
+        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);
+        HorizontalLayout layout1 = new HorizontalLayout();
+        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);
+        HorizontalLayout layout2 = new HorizontalLayout();
+        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);
+        VerticalLayout layout3 = new VerticalLayout();
+        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);
+        VerticalLayout layout4 = new VerticalLayout();
+        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) {
+        HorizontalLayout hor = new HorizontalLayout();
+        main.setLayout(hor);
+
+        VerticalLayout containinglayout = new VerticalLayout();
+        hor.addComponent(containinglayout);
+
+        VerticalLayout layout1 = new VerticalLayout();
+        containinglayout.addComponent(new Label("Regular layout margins:"));
+        containinglayout.addComponent(layout1);
+        layout1.addStyleName("marginexample1");
+        layout1.addComponent(new Button("Component 1"));
+        layout1.addComponent(new Button("Component 2"));
+        layout1.addComponent(new Button("Component 3"));
+
+        // Create a layout
+        VerticalLayout layout2 = new VerticalLayout();
+        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"));
+        layout2.addComponent(new Button("Component 3"));
+    }
+
+    void example_ClientInfo(final Window main, String param) {
+        // Get the client identification string
+        WebApplicationContext context2 = (WebApplicationContext) getContext();
+        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) {
+
+                }
+            }
+        }
+    }
+
+    void example_Notification(final Window main, String param) {
+        // final Window sub1 = new Window("");
+        // main.addWindow(sub1);
+        if (param.equals("example")) {
+            main.showNotification("This is the caption",
+                    "This is the description");
+            return;
+        } else if (param.equals("type")) {
+            main.showNotification("This is a warning",
+                    "<br/>This is the <i>last</i> warning",
+                    Window.Notification.TYPE_WARNING_MESSAGE);
+            return;
+        } else if (param.equals("pos")) {
+            // Create a notification with the default settings for a warning.
+            Window.Notification notif = new Window.Notification("Be warned!",
+                    "This message lurks in the top-left corner!",
+                    Window.Notification.TYPE_WARNING_MESSAGE);
+
+            // Set the position.
+            notif.setPosition(Window.Notification.POSITION_TOP_LEFT);
+
+            // Let it stay there until the user clicks it
+            notif.setDelayMsec(-1);
+
+            // Show it in the main window.
+            main.showNotification(notif);
+            return;
+        }
+
+        main.setLayout(new HorizontalLayout());
+
+        final Integer type_humanized = Window.Notification.TYPE_HUMANIZED_MESSAGE;
+        final Integer type_warning = Window.Notification.TYPE_WARNING_MESSAGE;
+        final Integer type_error = Window.Notification.TYPE_ERROR_MESSAGE;
+        final Integer type_tray = Window.Notification.TYPE_TRAY_NOTIFICATION;
+        final NativeSelect types = new NativeSelect();
+        main.addComponent(types);
+        types.addItem(type_humanized);
+        types.addItem(type_warning);
+        types.addItem(type_error);
+        types.addItem(type_tray);
+        types.setItemCaption(type_humanized, "Humanized");
+        types.setItemCaption(type_warning, "Warning");
+        types.setItemCaption(type_error, "Error");
+        types.setItemCaption(type_tray, "Tray");
+
+        Button show = new Button("Show Notification");
+        main.addComponent(show);
+
+        show.addListener(new Button.ClickListener() {
+            public void buttonClick(ClickEvent event) {
+                String caption = "";
+                String description = "";
+                switch (((Integer) types.getValue()).intValue()) {
+                case Window.Notification.TYPE_HUMANIZED_MESSAGE:
+                    caption = "Humanized message";
+                    description = "<br/>For minimal annoyance";
+                    break;
+                case Window.Notification.TYPE_WARNING_MESSAGE:
+                    caption = "Warning message";
+                    description = "<br/>For notifications of medium importance";
+                    break;
+                case Window.Notification.TYPE_ERROR_MESSAGE:
+                    caption = "Error message";
+                    description = "<br/>For important notifications";
+                    break;
+                case Window.Notification.TYPE_TRAY_NOTIFICATION:
+                    caption = "Tray notification";
+                    description = "<br/>Stays up longer - but away";
+                }
+                // main.showNotification("The default notification");
+                Window.Notification notif = new Window.Notification(caption,
+                        description, (Integer) types.getValue());
+                // notif.setPosition(Window.Notification.POSITION_TOP_LEFT);
+                notif.setDelayMsec(-1);
+                main.showNotification(notif);
+            }
+        });
+
+        // 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));
+            return;
+        }
+
+        // A button to open the printer-friendly page.
+        Button printButton = new Button("Click to Print");
+        main.addComponent(printButton);
+        printButton.addListener(new Button.ClickListener() {
+            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."));
+
+                // To execute the print() JavaScript, we need to run it
+                // from a custom layout.
+                CustomLayout scriptLayout = new CustomLayout("printpage");
+                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));
+    }
+
+    void example_RichTextArea(final Window main, String param) {
+        main.setLayout(new HorizontalLayout());
+
+        // Create a rich text area
+        final RichTextArea rtarea = new RichTextArea();
+        rtarea.addStyleName("richtextexample");
+        // rtarea.setCaption("My Rich Text Area");
+
+        // Set initial content as HTML
+        rtarea
+                .setValue("<h1>Hello</h1>\n<p>This rich text area 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());
+        show.addListener(new Button.ClickListener() {
+            public void buttonClick(ClickEvent event) {
+                html.setValue(rtarea.getValue());
+            }
+        });
+
+        Panel rtPanel = new Panel("Rich Text Area");
+        rtPanel.addComponent(rtarea);
+        rtPanel.addComponent(show);
+
+        Panel valuePanel = new Panel("Value");
+        valuePanel.addComponent(html);
+
+        main.addComponent(rtPanel);
+        main.addComponent(valuePanel);
+    }
+
+    void example_QueryContainer(final Window main, String param) {
+        try {
+            // Create a database connection
+            Class.forName("org.hsqldb.jdbcDriver");
+            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.close();
+            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.close();
+            }
+
+            // Query the database
+            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.
+            select.setContainerDataSource(qc);
+
+            // 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.
+            select.setItemCaptionPropertyId("name");
+
+            // When selection changes, display the selected item.
+            select.setImmediate(true);
+            final Label selection = new Label("Currently selected: -");
+            select.addListener(new ValueChangeListener() {
+                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.
+                    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") + ")");
+                }
+            });
+
+            main.addComponent(select);
+            main.addComponent(selection);
+        } catch (SQLException e) {
+            e.printStackTrace();
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+    }
+
+    void example_MenuBar(final Window main, String param) {
+        // 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.");
+            }
+        };
+
+        // Put some items in the menu hierarchically
+        MenuBar.MenuItem beverages = menubar.addItem("Beverages", null, null);
+        MenuBar.MenuItem hot_beverages = beverages.addItem("Hot", null, null);
+        hot_beverages.addItem("Tea", null, mycommand);
+        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);
+    }
+
+    void example_AbsoluteLayout(final Window main, String param) {
+        AbsoluteLayout layout = new AbsoluteLayout();
+        layout.setWidth("400px");
+        layout.setHeight("400px");
+        main.setContent(layout);
+
+        final Button button = new Button("This could be anywhere");
+        layout.addComponent(button, "top: 100px; left: 50px;");
+    }
 
     void example_Layout(final Window main, String param) {
         if (param.equals("intro")) {
@@ -1790,7 +1796,7 @@ public class BookTestApplication extends com.vaadin.Application {
             Label title = new Label("The Ultimate Cat Finder");
             main.addComponent(title);
 
-            // Horizontal layout with selection tree on the left and 
+            // Horizontal layout with selection tree on the left and
             // a details panel on the right.
             HorizontalLayout horlayout = new HorizontalLayout();
             main.addComponent(horlayout);
@@ -1798,10 +1804,11 @@ public class BookTestApplication extends com.vaadin.Application {
             // Layout for the left-hand side
             VerticalLayout treeContainer = new VerticalLayout();
             horlayout.addComponent(treeContainer);
-            
+
             // Add some instructions.
-            treeContainer.addComponent(new Label("The Planets and Major Moons"));
-            
+            treeContainer
+                    .addComponent(new Label("The Planets and Major Moons"));
+
             // A selection tree, fill it later.
             Tree tree = new Tree();
             treeContainer.addComponent(tree);
@@ -1814,11 +1821,11 @@ public class BookTestApplication extends com.vaadin.Application {
             // Have a vertical layout in the Details panel.
             VerticalLayout detailslayout = new VerticalLayout();
             detailspanel.setContent(detailslayout);
-            
+
             // Put some stuff in the Details view.
             detailslayout.addComponent(new Label("Where is the cat?"));
             detailslayout.addComponent(new Label("I don't know!"));
-            
+
             // // // // // //
 
             horlayout.setExpandRatio(detailspanel, 1);
@@ -1838,9 +1845,9 @@ public class BookTestApplication extends com.vaadin.Application {
             treeContainer.setHeight("100%");
             treeContainer.setExpandRatio(tree, 1);
             detailspanel.addStyleName("light");
-            
+
             for (Iterator i = detailslayout.getComponentIterator(); i.hasNext();) {
-                Label c = (Label)i.next();
+                Label c = (Label) i.next();
                 detailslayout.setComponentAlignment(c, Alignment.MIDDLE_CENTER);
                 c.setSizeUndefined();
             }
@@ -1852,8 +1859,8 @@ public class BookTestApplication extends com.vaadin.Application {
                     new Object[] { "Mars", "Phobos", "Deimos" },
                     new Object[] { "Jupiter", "Io", "Europa", "Ganymedes",
                             "Callisto" },
-                    new Object[] { "Saturn", "Titan", "Tethys", "Dione", "Rhea",
-                            "Iapetus" },
+                    new Object[] { "Saturn", "Titan", "Tethys", "Dione",
+                            "Rhea", "Iapetus" },
                     new Object[] { "Uranus", "Miranda", "Ariel", "Umbriel",
                             "Titania", "Oberon" },
                     new Object[] { "Neptune", "Triton", "Proteus", "Nereid",
@@ -1886,8 +1893,7 @@ public class BookTestApplication extends com.vaadin.Application {
                     tree.expandItemsRecursively(planet);
                 }
             }
-        
-        
+
         }
     }
 }
index c3d96f1d167b65cea0e8d987665b7343a4492971..5c918288dfdb617a0dbf7dccebeecd6a29d8f5c7 100644 (file)
@@ -16,79 +16,79 @@ import com.vaadin.ui.Panel;
 import com.vaadin.ui.TextField;
 
 public class DefaultButtonExample extends CustomComponent implements Handler {
-       // Define and create user interface components
-       Panel panel = new Panel("Login");
-       FormLayout formlayout = new FormLayout();
-       TextField username = new TextField("Username");
-       TextField password = new TextField("Password");
-       HorizontalLayout buttons = new HorizontalLayout();
+    // Define and create user interface components
+    Panel panel = new Panel("Login");
+    FormLayout formlayout = new FormLayout();
+    TextField username = new TextField("Username");
+    TextField password = new TextField("Password");
+    HorizontalLayout buttons = new HorizontalLayout();
 
-       // Create buttons and define their listener methods.
-       Button ok = new Button("OK", this, "okHandler");
-       Button cancel = new Button("Cancel", this, "cancelHandler");
+    // Create buttons and define their listener methods.
+    Button ok = new Button("OK", this, "okHandler");
+    Button cancel = new Button("Cancel", this, "cancelHandler");
 
-       // Have the unmodified Enter key cause an event
-       Action action_ok = new ShortcutAction("Default key",
-                       ShortcutAction.KeyCode.ENTER, null);
+    // Have the unmodified Enter key cause an event
+    Action action_ok = new ShortcutAction("Default key",
+            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 });
+    // 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 });
 
-       public DefaultButtonExample() {
-               // Set up the user interface
-               setCompositionRoot(panel);
-               panel.addComponent(formlayout);
-               formlayout.addComponent(username);
-               formlayout.addComponent(password);
-               formlayout.addComponent(buttons);
-               buttons.addComponent(ok);
-               buttons.addComponent(cancel);
+    public DefaultButtonExample() {
+        // Set up the user interface
+        setCompositionRoot(panel);
+        panel.addComponent(formlayout);
+        formlayout.addComponent(username);
+        formlayout.addComponent(password);
+        formlayout.addComponent(buttons);
+        buttons.addComponent(ok);
+        buttons.addComponent(cancel);
 
-               // Set focus to username
-               username.focus();
+        // Set focus to username
+        username.focus();
 
-               // Set this object as the action handler
-               System.out.println("adding ah");
-               panel.addActionHandler(this);
+        // Set this object as the action handler
+        System.out.println("adding ah");
+        panel.addActionHandler(this);
 
-               System.out.println("start done.");
-       }
+        System.out.println("start done.");
+    }
 
-       /**
-        * Retrieve actions for a specific component. This method will be called for
-        * each object that has a handler; in this example just for login panel. The
-        * returned action list might as well be static list.
-        */
-       public Action[] getActions(Object target, Object sender) {
-               System.out.println("getActions()");
-               return new Action[] { action_ok, action_cancel };
-       }
+    /**
+     * Retrieve actions for a specific component. This method will be called for
+     * each object that has a handler; in this example just for login panel. The
+     * returned action list might as well be static list.
+     */
+    public Action[] getActions(Object target, Object sender) {
+        System.out.println("getActions()");
+        return new Action[] { action_ok, action_cancel };
+    }
 
-       /**
-        * Handle actions received from keyboard. This simply directs the actions to
-        * the same listener methods that are called with ButtonClick events.
-        */
-       public void handleAction(Action action, Object sender, Object target) {
-               if (action == action_ok) {
-                       okHandler();
-               }
-               if (action == action_cancel) {
-                       cancelHandler();
-               }
-       }
+    /**
+     * Handle actions received from keyboard. This simply directs the actions to
+     * the same listener methods that are called with ButtonClick events.
+     */
+    public void handleAction(Action action, Object sender, Object target) {
+        if (action == action_ok) {
+            okHandler();
+        }
+        if (action == action_cancel) {
+            cancelHandler();
+        }
+    }
 
-       public void okHandler() {
-               // Do something: report the click
-               formlayout.addComponent(new Label("OK clicked. " + "User="
-                               + username.getValue() + ", password=" + password.getValue()));
-               //  
-       }
+    public void okHandler() {
+        // Do something: report the click
+        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()));
-       }
+    public void cancelHandler() {
+        // Do something: report the click
+        formlayout.addComponent(new Label("Cancel clicked. User="
+                + username.getValue() + ", password=" + password.getValue()));
+    }
 }
index 9bc3c798238c51a8bed94f15a0dbfe1bc302407a..97c6e37790daf20d32d870b6cde8891b48384af7 100644 (file)
@@ -27,7 +27,7 @@ public class TabSheetExample extends CustomComponent implements
         // First tab contains a button, for which we
         // listen button click events.
         tab1.addListener(this);
-        
+
         // This will cause a selectedTabChange() call.
         tabsheet.addTab(tab1, "First Tab", null);
 
@@ -42,8 +42,8 @@ public class TabSheetExample extends CustomComponent implements
 
     public void buttonClick(ClickEvent event) {
         // Enable the invisible and disabled tabs.
-       tabsheet.getTab(tab2).setVisible(true);
-       tabsheet.getTab(tab3).setEnabled(true);
+        tabsheet.getTab(tab2).setVisible(true);
+        tabsheet.getTab(tab3).setEnabled(true);
 
         // Change selection automatically to second tab.
         tabsheet.setSelectedTab(tab2);
@@ -51,19 +51,19 @@ public class TabSheetExample extends CustomComponent implements
 
     public void selectedTabChange(SelectedTabChangeEvent event) {
         // Cast to a TabSheet. This isn't really necessary in
-       // this example, as we have only one TabSheet component,
-       // but would be useful if there were multiple TabSheets.
+        // this example, as we have only one TabSheet component,
+        // but would be useful if there were multiple TabSheets.
         final TabSheet source = (TabSheet) event.getSource();
 
         if (source == tabsheet) {
             // If the first tab was selected.
             if (source.getSelectedTab() == tab1) {
-               // The 2. and 3. tabs may not have been set yet.
-               if (tabsheet.getTab(tab2) != null
-                       && tabsheet.getTab(tab3) != null) {
-                       tabsheet.getTab(tab2).setVisible(false);
-                       tabsheet.getTab(tab3).setEnabled(false);
-               }
+                // The 2. and 3. tabs may not have been set yet.
+                if (tabsheet.getTab(tab2) != null
+                        && tabsheet.getTab(tab3) != null) {
+                    tabsheet.getTab(tab2).setVisible(false);
+                    tabsheet.getTab(tab3).setEnabled(false);
+                }
             }
         }
     }
index 6f66653d790085c08f5e787221a5f6b36daaabce..301dc7a18f82781584fa3ee4a77421daaba81053 100644 (file)
@@ -16,7 +16,7 @@ public class TableCellStyle extends CustomComponent {
         // of the container are integers so we can determine the column number
         // easily.
         table.addContainerProperty("0", String.class, null, "", null, null); // Row
-                                                                             // header
+        // header
         for (int i = 0; i < 8; i++) {
             table.addContainerProperty("" + (i + 1), String.class, null, String
                     .valueOf((char) (65 + i)), null, null);
index 78a4b808bd378f772b15e200170866c77aa3d8bd..0beefba320f61735993e5fc522394cfb3bfb007d 100644 (file)
@@ -38,7 +38,7 @@ public class TableEditable extends CustomComponent {
             // Create the table row.
             table.addItem(new Object[] { calendar.getTime(),
                     new Boolean(false), "" }, new Integer(i)); // Item
-                                                               // identifier
+            // identifier
         }
 
         table.setPageLength(8);
index c081382ee11ce447437d71b2a8cf4442477875a0..e211b9e833980fbd02658ed02bf34b4b14e6f7e9 100644 (file)
@@ -7,34 +7,34 @@ import com.vaadin.ui.Button.ClickEvent;
 \r
 public class ReplaceComponentNPE extends TestBase {\r
 \r
-       @Override\r
-       protected String getDescription() {\r
-               return "Clicking 'ReplaceComponent' should replace the 'Button' button with a VericalLayout, and move the button inside the verticalLayout. Visually this can be seen by the added margins of the VerticalLayout.";\r
-       }\r
-\r
-       @Override\r
-       protected Integer getTicketNumber() {\r
-               return 3195;\r
-       }\r
-\r
-       final Button button = new Button("Button");\r
-       final VerticalLayout outer = new VerticalLayout();\r
-\r
-       @Override\r
-       protected void setup() {\r
-               outer.setMargin(true);\r
-               \r
-               Button changer = new Button("ReplaceComponent");\r
-               changer.addListener(new Button.ClickListener() {\r
-                       public void buttonClick(ClickEvent event) {\r
-                               getLayout().replaceComponent(button, outer);\r
-                               outer.addComponent(button);\r
-                       }\r
-               });\r
-\r
-               getLayout().addComponent(button);\r
-               getLayout().addComponent(changer);\r
-\r
-       }\r
+    @Override\r
+    protected String getDescription() {\r
+        return "Clicking 'ReplaceComponent' should replace the 'Button' button with a VericalLayout, and move the button inside the verticalLayout. Visually this can be seen by the added margins of the VerticalLayout.";\r
+    }\r
+\r
+    @Override\r
+    protected Integer getTicketNumber() {\r
+        return 3195;\r
+    }\r
+\r
+    final Button button = new Button("Button");\r
+    final VerticalLayout outer = new VerticalLayout();\r
+\r
+    @Override\r
+    protected void setup() {\r
+        outer.setMargin(true);\r
+\r
+        Button changer = new Button("ReplaceComponent");\r
+        changer.addListener(new Button.ClickListener() {\r
+            public void buttonClick(ClickEvent event) {\r
+                getLayout().replaceComponent(button, outer);\r
+                outer.addComponent(button);\r
+            }\r
+        });\r
+\r
+        getLayout().addComponent(button);\r
+        getLayout().addComponent(changer);\r
+\r
+    }\r
 \r
 }\r
index 9d9800eeafd2c828094e4405e44de8b2bdef06ac..bde33df3d50338fb6bc54d078e33a0d55b2b7cd2 100644 (file)
@@ -1,4 +1,5 @@
 package com.vaadin.tests.components.splitpanel;\r
+\r
 import com.vaadin.terminal.Sizeable;\r
 import com.vaadin.tests.components.AbstractTestCase;\r
 import com.vaadin.ui.Button;\r
index aee56dd7ee5bbdcd6b8826f335f75f487dff8610..ed25567921eec4ca89b31092058d4336d062e988 100644 (file)
@@ -1,4 +1,5 @@
 package com.vaadin.tests.components.textfield;\r
+\r
 import com.vaadin.tests.components.TestBase;\r
 import com.vaadin.ui.TextField;\r
 \r
index b5619d16e3acc7abe07f74a31dd007404ce66801..451bc03f05bb57de755723efc0c40a1d85200865 100644 (file)
@@ -1,4 +1,5 @@
 package com.vaadin.tests.components.textfield;\r
+\r
 import com.vaadin.Application;\r
 import com.vaadin.ui.Component;\r
 import com.vaadin.ui.Panel;\r
index 2dd586d7b809bed49d5fceaa67e095a242cbca01..c93a34c7ecbfe2073dab1c4d646dfffafaa81d64 100644 (file)
@@ -118,8 +118,7 @@ public class FeatureUpload extends Feature implements Upload.FinishedListener {
         }
 
         /**
-         * @see com.vaadin.ui.Upload.Receiver#receiveUpload(String,
-         *      String)
+         * @see com.vaadin.ui.Upload.Receiver#receiveUpload(String, String)
          */
         public OutputStream receiveUpload(String filename, String MIMEType) {
             fileName = filename;
index 6294e09d4e3bd3bb7bdb6825aaef05283170ce18..a12489a2cc17279cf3eadef29660f796fc5d148f 100644 (file)
@@ -8,8 +8,8 @@ import com.vaadin.ui.Label;
 import com.vaadin.ui.Window;
 import com.vaadin.ui.Button.ClickEvent;
 
-public abstract class Robustness extends com.vaadin.Application
-        implements Button.ClickListener {
+public abstract class Robustness extends com.vaadin.Application implements
+        Button.ClickListener {
 
     static int totalCount = 0;
 
index c3e914a806af71bf7a4a6ed24605d26e19b66031..a3c0342d638ca0202bf5eb8257193f27e28a6db6 100644 (file)
@@ -32,7 +32,7 @@ public class TransactionListenersConcurrency extends TestCase {
      * transaction is then started for each application. Some semi-random delays\r
      * are included so that calls to addTransactionListener and\r
      * WebApplicationContext.startTransaction are mixed.\r
-     *\r
+     * \r
      */\r
     public void testTransactionListeners() throws Exception {\r
         final List<Throwable> exceptions = new ArrayList<Throwable>();\r
@@ -133,7 +133,7 @@ public class TransactionListenersConcurrency extends TestCase {
 \r
     /**\r
      * Creates a HttpSession mock\r
-     *\r
+     * \r
      */\r
     private static HttpSession createSession() {\r
         HttpSession session = createMock(HttpSession.class);\r
@@ -151,7 +151,7 @@ public class TransactionListenersConcurrency extends TestCase {
     /**\r
      * A transaction listener that just sleeps for the given amount of time in\r
      * transactionStart and transactionEnd.\r
-     *\r
+     * \r
      */\r
     public static class DelayTransactionListener implements TransactionListener {\r
 \r
index 1a890e313ecae72f4a800d89e17ff1428ec621b4..9bd7d3a04541a23a79d93ae801878bbc9c187f92 100644 (file)
@@ -7,8 +7,7 @@ import com.vaadin.ui.Label;
 import com.vaadin.ui.TextField;\r
 import com.vaadin.ui.Window;\r
 \r
-public class Ticket1365 extends com.vaadin.Application implements\r
-        Handler {\r
+public class Ticket1365 extends com.vaadin.Application implements Handler {\r
 \r
     TextField f = new TextField();\r
 \r