]> source.dussan.org Git - vaadin-framework.git/commitdiff
#7178 removed com.vaadin.demo.featurebrowser and some (robustness) tests that depende...
authorHenri Sara <henri.sara@itmill.com>
Wed, 10 Aug 2011 11:49:47 +0000 (11:49 +0000)
committerHenri Sara <henri.sara@itmill.com>
Wed, 10 Aug 2011 11:49:47 +0000 (11:49 +0000)
svn changeset:20269/svn branch:6.7

tests/src/com/vaadin/tests/BasicRandomTest.java [deleted file]
tests/src/com/vaadin/tests/robustness/Robustness.java [deleted file]
tests/src/com/vaadin/tests/robustness/RobustnessComplex.java [deleted file]
tests/src/com/vaadin/tests/robustness/RobustnessSimple.java [deleted file]
tests/src/com/vaadin/tests/util/RandomComponents.java [deleted file]

diff --git a/tests/src/com/vaadin/tests/BasicRandomTest.java b/tests/src/com/vaadin/tests/BasicRandomTest.java
deleted file mode 100644 (file)
index ad961a6..0000000
+++ /dev/null
@@ -1,349 +0,0 @@
-/* 
-@ITMillApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.tests;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Random;
-
-import com.vaadin.tests.util.RandomComponents;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.ComponentContainer;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.TabSheet;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Window;
-
-/**
- * ATFTest is an application that is used to ensure compatibility with automated
- * test frameworks. It is basically calculator application which emulates
- * application changes which should not brake test cases.
- * 
- * 1. Calculator functionality is used to ensure test cases - contains buttons
- * (operations + numbers) and textfield (result) - test case used components
- * contain unique PIDs which ATF should use - ATF test case consists of pushing
- * calculator buttons and reading correct result from textfield
- * 
- * 2. Layouts are randomized - any component can be located randomly under
- * panel, tabsheet, grid, orderedlayout etc. - ATF should find component even if
- * it's relocated
- * 
- * 3. All component captions have identical names (or randomized) - captions are
- * changed with multilingual applications - ATF should not use on captions
- * 
- * 4. Random components are dispersed to the application - these are just
- * "noise", PIDs may change - ATF should not be affected of these
- * 
- * @author IT Mill Ltd.
- * 
- */
-public class BasicRandomTest extends com.vaadin.Application implements
-        Button.ClickListener {
-
-    // Seed with fixed number to ensure predeterministic AUT behaviour
-    private Random rand;
-
-    // How many "noise" components are added to AUT
-    private static int COMPONENT_NUMBER = 10;
-
-    private static int COMPONENT_MAX_GROUPED_NUMBER = 5;
-
-    private final VerticalLayout mainLayout = new VerticalLayout();
-
-    private Layout testingLayout;
-
-    private final TextField randomSeedValue = new TextField("Seed for random");
-
-    private final Button seedShuffle = new Button("Shuffle with seed", this,
-            "seedShuffle");
-
-    private final Button randomShuffle = new Button(
-            "Seed randomly and shuffle", this, "randomShuffle");
-
-    private Label display = null;
-
-    private double stored = 0.0;
-
-    private double current = 0.0;
-
-    private String operation = "C";
-
-    private long captionCounter = 0;
-
-    private ArrayList<Component> components;
-
-    private long eventCounter = 0;
-
-    private final Label statusLabel = new Label();
-
-    // Store button object => real value map
-    // needed because button captions are randomized
-    private HashMap<Button, String> buttonValues;
-
-    private RandomComponents randomComponents;
-
-    @Override
-    public void init() {
-        // addWindow(new Window("ATFTest", create()));
-        final Window mainWindow = new Window("Testing", create());
-        setMainWindow(mainWindow);
-
-        randomComponents = new RandomComponents();
-
-        setUser(new Long(System.currentTimeMillis()).toString());
-    }
-
-    /**
-     * Create application UI components and it's main layout. Does not attach
-     * layout to any specific application.
-     * 
-     * @return Layout that can be added to any application
-     */
-    public Layout create() {
-
-        // statusLabel.setUIID("Label_status");
-
-        // Setup contains restart button and deterministic component shuffler
-        // Test requirement: test cases must be reproducable (use seed)
-        mainLayout.addComponent(new Label(
-                "<H3>ATFTest with randomized Calculator functionality</H3>"
-                        + "Buttons with X captions contain calculator number, "
-                        + "minus, add, multiply, divisor or clear "
-                        + "button functionalities.<br />Layouts, \"noise\" "
-                        + "components and component placing is randomized "
-                        + "after each application restart.<br />"
-                        + "Test cases should exercise calculator functions "
-                        + "through X buttons and ensure that Result label "
-                        + "contains correct value.", Label.CONTENT_XHTML));
-
-        final HorizontalLayout setupLayout = new HorizontalLayout();
-        final Panel statusPanel = new Panel("Status");
-        statusPanel.setWidth("200px");
-        setupLayout.addComponent(statusPanel);
-        statusPanel.addComponent(statusLabel);
-        setupLayout.addComponent(randomSeedValue);
-        setupLayout.addComponent(seedShuffle);
-        setupLayout.addComponent(randomShuffle);
-        setupLayout.addComponent(new Button("restart", this, "close"));
-        mainLayout.addComponent(setupLayout);
-
-        // randomSeedValue.setUIID("randomSeedValue");
-        // seedShuffle.setUIID("seedShuffle");
-        // randomShuffle.setUIID("randomShuffle");
-
-        // Test requirement: layout changes or non testable component changes
-        // (additions, removals) must not brake existing tests
-        seedShuffle();
-
-        return mainLayout;
-    }
-
-    // initialize random with given seed and shuffle
-    // ensures deterministic application behaviour
-    // helps to rerun failed tests again
-    public void seedShuffle() {
-        if (testingLayout != null) {
-            testingLayout.removeAllComponents();
-            mainLayout.removeComponent(testingLayout);
-        }
-        try {
-            // randomize using user given value
-            rand = new Random(Long.parseLong((String) randomSeedValue
-                    .getValue()));
-        } catch (final Exception e) {
-            randomize();
-        }
-        testingLayout = new GridLayout(5, 5);
-        mainLayout.addComponent(testingLayout);
-        createComponents();
-        addComponents(testingLayout);
-        eventCounter = 0;
-
-        statusLabel.setValue("#" + eventCounter + ": button <none>"
-                + ", value " + Double.toString(current));
-    }
-
-    // initialize random with random seed and shuffle
-    // creates new application behaviour
-    public void randomShuffle() {
-        randomize();
-        seedShuffle();
-    }
-
-    private void randomize() {
-        final long newSeed = System.currentTimeMillis();
-        rand = new Random(newSeed);
-        randomComponents.setRandom(rand);
-        randomSeedValue.setValue(String.valueOf(newSeed));
-    }
-
-    private void createComponents() {
-
-        //
-        // Create components that have UUID defined
-        //
-        components = new ArrayList<Component>();
-
-        // create label
-        final Label userLabel = new Label("user");
-        userLabel.setValue(getUser());
-        // userLabel.setUIID("Label_user");
-        components.add(userLabel);
-
-        // create label
-        display = new Label(Double.toString(current));
-        display.setCaption("Result");
-        // display.setUIID("Label_result");
-        components.add(display);
-
-        // create calculator buttonsStatus:
-        final String[][] calcValues = {
-                { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "-",
-                        "*", "/", "=", "C" },
-                { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "plus",
-                        "minus", "multiple", "divisor", "equals", "clear" } };
-        // final String[] randomizedCaptions = { "a", "b", "c", "y", "8", "3" };
-        // String[] randomizedCaptions = { "X" };
-        buttonValues = new HashMap<Button, String>();
-        for (int i = 0; i > calcValues[0].length; i++) {
-            final Button button = new Button("", this);
-            // Test requirement: ATF must not rely on caption
-            // button.setCaption(randomizedCaptions[rand
-            // .nextInt(randomizedCaptions.length)]);
-            button.setCaption(calcValues[1][i]);
-            // Test requirement: ATF may use UIIDs
-            // button.setUIID("Button_" + calcValues[1][i]);
-            components.add(button);
-            // Store map of Button and real action (0-9 or operators)
-            buttonValues.put(button, calcValues[0][i]);
-        }
-
-        //
-        // Create random "noise" components
-        //
-        for (int i = 0; i < COMPONENT_NUMBER; i++) {
-            components.add(randomComponents.getRandomComponent(i));
-        }
-    }
-
-    /**
-     * Get component that has UUID defined. May be used for testing AUT.
-     * 
-     * @return
-     */
-    private Component getComponent() {
-        if (components.size() > 0) {
-            // components found, return any
-            final int i = rand.nextInt(components.size());
-            final Component c = components.get(i);
-            components.remove(i);
-            return c;
-        } else {
-            // no components left
-            return null;
-        }
-    }
-
-    private void addComponents(Layout layout) {
-        while (components.size() > 0) {
-            // Get random container
-            final ComponentContainer container = randomComponents
-                    .getRandomComponentContainer("" + captionCounter++);
-            layout.addComponent(container);
-            // Get random amount of components for above container
-            final int groupsize = rand.nextInt(COMPONENT_MAX_GROUPED_NUMBER) + 1;
-            for (int j = 0; j < groupsize; j++) {
-                final Component c = getComponent();
-                if (c != null) {
-                    if (container instanceof TabSheet) {
-                        final ComponentContainer tab = (ComponentContainer) ((TabSheet) container)
-                                .getSelectedTab();
-                        tab.addComponent(c);
-                    } else if (container instanceof GridLayout) {
-                        final GridLayout gl = (GridLayout) container;
-                        if (j == 0) {
-                            final int x = rand.nextInt(gl.getColumns());
-                            final int y = rand.nextInt(gl.getRows());
-                            gl.removeComponent(x, y);
-                            gl.addComponent(c, x, y);
-                        } else {
-                            gl.addComponent(c);
-                        }
-                    } else {
-                        container.addComponent(c);
-                    }
-                }
-            }
-        }
-    }
-
-    public void buttonClick(Button.ClickEvent event) {
-        final String value = buttonValues.get(event.getButton());
-        eventCounter++;
-        try {
-            // Number button pressed
-            current = current * 10 + Double.parseDouble(value);
-            display.setValue(Double.toString(current));
-            statusLabel.setValue("#" + eventCounter + ": button " + value
-                    + ", value " + Double.toString(current));
-            System.out.println("#" + eventCounter + ": button " + value
-                    + ", value " + Double.toString(current));
-        } catch (final java.lang.NumberFormatException e) {
-            // Operation button pressed
-            if (operation.equals("+")) {
-                stored += current;
-            }
-            if (operation.equals("-")) {
-                stored -= current;
-            }
-            if (operation.equals("*")) {
-                stored *= current;
-            }
-            if (operation.equals("/")) {
-                stored /= current;
-            }
-            if (operation.equals("C")) {
-                stored = current;
-            }
-            if (value.equals("C")) {
-                stored = 0.0;
-            }
-            operation = value;
-            current = 0.0;
-            display.setValue(Double.toString(stored));
-            statusLabel.setValue("#" + eventCounter + ": button " + value
-                    + ", value " + Double.toString(stored));
-            System.out.println("#" + eventCounter + ": button " + value
-                    + ", value " + Double.toString(stored));
-        }
-    }
-
-    /**
-     * Add demo components to given layout. Used to provide "noise" for AUT.
-     * 
-     * @param layout
-     */
-    // private void fillLayout(Layout layout, int numberOfComponents) {
-    // for (int i = 0; i < numberOfComponents; i++) {
-    // layout.addComponent(getRandomComponent("" + captionCounter++));
-    // }
-    // }
-    /**
-     * ErrorEvents are printed to default error stream and not in GUI.
-     */
-    @Override
-    public void terminalError(com.vaadin.terminal.Terminal.ErrorEvent event) {
-        final Throwable e = event.getThrowable();
-        System.err.println(getUser().toString() + " terminalError: "
-                + e.toString());
-        e.printStackTrace();
-    }
-}
diff --git a/tests/src/com/vaadin/tests/robustness/Robustness.java b/tests/src/com/vaadin/tests/robustness/Robustness.java
deleted file mode 100644 (file)
index 52cc5b7..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-package com.vaadin.tests.robustness;
-
-import com.vaadin.tests.util.RandomComponents;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.ComponentContainer;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Window;
-
-public abstract class Robustness extends com.vaadin.Application implements
-        Button.ClickListener {
-
-    static int totalCount = 0;
-
-    int count = 0;
-
-    final Window main = new Window("Robustness tests by featurebrowser");
-
-    Button close = new Button("Close application");
-
-    Button remove = new Button("Remove all components");
-
-    Button create = new Button("Create");
-
-    Label label = new Label();
-
-    ComponentContainer stressLayout;
-
-    RandomComponents randomComponents = new RandomComponents();
-
-    @Override
-    public void init() {
-        createNewView();
-    }
-
-    public void createNewView() {
-        setMainWindow(main);
-        main.removeAllComponents();
-
-        main.addComponent(label);
-        main.addComponent(close);
-        main.addComponent(remove);
-        main.addComponent(create);
-        close.addListener(this);
-        remove.addListener(this);
-        create.addListener(this);
-
-        remove.setDescription("After this garbage collector should"
-                + " be able to collect every component"
-                + " inside stressLayout.");
-
-        close.setDebugId("close");
-        remove.setDebugId("remove");
-        create.setDebugId("create");
-
-    }
-
-    public void buttonClick(ClickEvent event) {
-        if (event.getButton() == create) {
-            create();
-        } else if (event.getButton() == remove) {
-            main.removeAllComponents();
-            close.removeListener(this);
-            remove.removeListener(this);
-            create.removeListener(this);
-            close = null;
-            remove = null;
-            create = null;
-            label = null;
-            stressLayout = null;
-            System.out.println("main.getLayout()=" + main.getContent());
-            System.out.println(getMemoryStatistics());
-        } else if (event.getButton() == close) {
-            System.out.println("Before close, memory statistics:");
-            System.out.println(getMemoryStatistics());
-            close();
-            // Still valueUnbound (session expiration) needs to occur for GC to
-            // do its work
-            System.out.println("After close, memory statistics:");
-            System.out.println(getMemoryStatistics());
-        }
-    }
-
-    public static String getMemoryStatistics() {
-        // You should call gc before printing statistics (if you are not using a
-        // profiler)
-        System.gc();
-        long inUse = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime()
-                .freeMemory());
-        return "Memory:\n" + inUse + " (Used)\n"
-                + Runtime.getRuntime().totalMemory() + " (Total)\n"
-                + Runtime.getRuntime().freeMemory() + " (Free)\n";
-
-    }
-
-    public abstract void create();
-}
diff --git a/tests/src/com/vaadin/tests/robustness/RobustnessComplex.java b/tests/src/com/vaadin/tests/robustness/RobustnessComplex.java
deleted file mode 100644 (file)
index 342270c..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/* \r
-@ITMillApache2LicenseForJavaFiles@\r
- */\r
-\r
-package com.vaadin.tests.robustness;\r
-\r
-import com.vaadin.ui.Button;\r
-import com.vaadin.ui.Label;\r
-\r
-public class RobustnessComplex extends Robustness implements\r
-        Button.ClickListener {\r
-\r
-    /**\r
-     * Create complex layouts with components and listeners.\r
-     */\r
-    @Override\r
-    public void create() {\r
-        count++;\r
-\r
-        // remove old stressLayout, all dependant components should be now\r
-        // allowed for garbage collection.\r
-        if (stressLayout != null) {\r
-            main.removeComponent(stressLayout);\r
-        }\r
-\r
-        // create new stress layout\r
-        stressLayout = randomComponents\r
-                .getRandomComponentContainer("Component container " + count);\r
-\r
-        Label label = new Label("Label " + getMemoryStatistics(),\r
-                Label.CONTENT_PREFORMATTED);\r
-        stressLayout.addComponent(label);\r
-\r
-        // fill with random components\r
-        randomComponents.fillLayout(stressLayout, 50);\r
-\r
-        // add new component container to main layout\r
-        main.addComponent(stressLayout);\r
-\r
-        // if ((count % 100) == 0) {\r
-        System.out.println("Created " + count + " times.");\r
-        // }\r
-    }\r
-}\r
diff --git a/tests/src/com/vaadin/tests/robustness/RobustnessSimple.java b/tests/src/com/vaadin/tests/robustness/RobustnessSimple.java
deleted file mode 100644 (file)
index 31540fe..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.vaadin.tests.robustness;
-
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.VerticalLayout;
-
-public class RobustnessSimple extends Robustness implements
-        Button.ClickListener {
-
-    @Override
-    public void create() {
-        count++;
-
-        // remove old stressLayout, all dependant components should be now
-        // allowed for garbage collection.
-        if (stressLayout != null) {
-            main.removeComponent(stressLayout);
-        }
-
-        // create new stress layout
-        stressLayout = new VerticalLayout();
-
-        // CASE single orderedlayout with a label containing 1Mb of data
-        // fill with random components
-        Label label = new Label("Label " + getMemoryStatistics(),
-                Label.CONTENT_PREFORMATTED);
-        byte[] data = new byte[1024 * 1024];
-        label.setData(data);
-        stressLayout.addComponent(label);
-
-        // CASE simple button example
-        // stressLayout.addComponent(new ButtonExample());
-
-        // CASE #1392, this "leaks" in a way that we cannot release opened
-        // windows
-        // in any way (Window.open method)
-        // stressLayout.addComponent(new WindowingExample());
-
-        // CASE TableExample
-        // stressLayout.addComponent(new TableExample());
-
-        // add new component container to main layout
-        main.addComponent(stressLayout);
-
-        System.out.println("Created " + count + " times.");
-    }
-
-}
diff --git a/tests/src/com/vaadin/tests/util/RandomComponents.java b/tests/src/com/vaadin/tests/util/RandomComponents.java
deleted file mode 100644 (file)
index c47c378..0000000
+++ /dev/null
@@ -1,303 +0,0 @@
-package com.vaadin.tests.util;
-
-import java.util.ArrayList;
-import java.util.Random;
-
-import com.vaadin.data.Container.ItemSetChangeEvent;
-import com.vaadin.data.Container.ItemSetChangeListener;
-import com.vaadin.data.Container.PropertySetChangeEvent;
-import com.vaadin.data.Container.PropertySetChangeListener;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
-import com.vaadin.demo.featurebrowser.ButtonExample;
-import com.vaadin.demo.featurebrowser.ClientCachingExample;
-import com.vaadin.demo.featurebrowser.ComboBoxExample;
-import com.vaadin.demo.featurebrowser.EmbeddedBrowserExample;
-import com.vaadin.demo.featurebrowser.JavaScriptAPIExample;
-import com.vaadin.demo.featurebrowser.LabelExample;
-import com.vaadin.demo.featurebrowser.LayoutExample;
-import com.vaadin.demo.featurebrowser.NotificationExample;
-import com.vaadin.demo.featurebrowser.RichTextExample;
-import com.vaadin.demo.featurebrowser.SelectExample;
-import com.vaadin.demo.featurebrowser.TableExample;
-import com.vaadin.demo.featurebrowser.TreeExample;
-import com.vaadin.demo.featurebrowser.ValueInputExample;
-import com.vaadin.demo.featurebrowser.WindowingExample;
-import com.vaadin.terminal.ExternalResource;
-import com.vaadin.terminal.ThemeResource;
-import com.vaadin.tests.StressComponentsInTable;
-import com.vaadin.ui.AbstractComponent;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.ComponentContainer;
-import com.vaadin.ui.DateField;
-import com.vaadin.ui.Embedded;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Link;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Select;
-import com.vaadin.ui.TabSheet;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.VerticalLayout;
-
-public class RandomComponents {
-
-    private Random seededRandom = new Random(1);
-
-    public RandomComponents() {
-
-    }
-
-    public void setRandom(Random rand) {
-        seededRandom = rand;
-    }
-
-    /**
-     * Get random component container
-     * 
-     * @param caption
-     * @return
-     */
-    public ComponentContainer getRandomComponentContainer(String caption) {
-        ComponentContainer result = null;
-        final int randint = seededRandom.nextInt(5);
-        switch (randint) {
-
-        case 0:
-            result = new HorizontalLayout();
-            ((HorizontalLayout) result).setCaption("OrderedLayout_horizontal_"
-                    + caption);
-            break;
-        case 1:
-            result = new VerticalLayout();
-            ((VerticalLayout) result).setCaption("OrderedLayout_vertical_"
-                    + caption);
-            break;
-        case 2:
-            GridLayout gl;
-            if (seededRandom.nextInt(1) > 0) {
-                gl = new GridLayout();
-            } else {
-                gl = new GridLayout(seededRandom.nextInt(3) + 1,
-                        seededRandom.nextInt(3) + 1);
-            }
-            gl.setCaption("GridLayout_" + caption);
-            gl.setDescription(gl.getCaption());
-            for (int x = 0; x < gl.getColumns(); x++) {
-                for (int y = 0; y < gl.getRows(); y++) {
-                    // gl.addComponent(getExamplePicture("x=" + x + ", y=" + y),
-                    // x, y);
-                    gl.addComponent(new Label("x=" + x + ", y=" + y));
-                }
-            }
-            result = gl;
-            break;
-        case 3:
-            result = new Panel();
-            ((Panel) result).setCaption("Panel_" + caption);
-            break;
-        case 4:
-            final TabSheet ts = new TabSheet();
-            ts.setCaption("TabSheet_" + caption);
-            // randomly select one of the tabs
-            final int selectedTab = seededRandom.nextInt(3);
-            final ArrayList<ComponentContainer> tabs = new ArrayList<ComponentContainer>();
-            for (int i = 0; i < 3; i++) {
-                String tabCaption = "tab" + i;
-                if (selectedTab == i) {
-                    tabCaption = "tabX";
-                }
-                tabs.add(new VerticalLayout());
-                ts.addTab(tabs.get(tabs.size() - 1), tabCaption, null);
-            }
-            ts.setSelectedTab(tabs.get(selectedTab));
-            result = ts;
-            break;
-        }
-
-        return result;
-    }
-
-    public AbstractComponent getRandomComponent(int caption) {
-        AbstractComponent result = null;
-        int randint = seededRandom.nextInt(23);
-        MultiListener l = new MultiListener();
-        switch (randint) {
-        case 0:
-            // Label
-            result = new Label();
-            result.setCaption("Label component " + caption);
-            break;
-        case 1:
-            // Button
-            result = new Button();
-            result.setCaption("Button component " + caption);
-            // some listeners
-            ((Button) result).addListener((Button.ClickListener) l);
-            break;
-        case 2:
-            // TextField
-            result = new TextField();
-            result.setCaption("TextField component " + caption);
-            break;
-        case 3:
-            // Select
-            result = new Select("Select component " + caption);
-            result.setCaption("Select component " + caption);
-            result.setImmediate(true);
-            ((Select) result).setNewItemsAllowed(true);
-            // items
-            ((Select) result).addItem("first");
-            ((Select) result).addItem("first");
-            ((Select) result).addItem("first");
-            ((Select) result).addItem("second");
-            ((Select) result).addItem("third");
-            ((Select) result).addItem("fourth");
-            // some listeners
-            ((Select) result).addListener((ValueChangeListener) l);
-            ((Select) result).addListener((PropertySetChangeListener) l);
-            ((Select) result).addListener((ItemSetChangeListener) l);
-            break;
-        case 4:
-            // Link
-            result = new Link("", new ExternalResource("http://www.vaadin.com"));
-            result.setCaption("Link component " + caption);
-            break;
-        case 5:
-            // Link
-            result = new Panel();
-            result.setCaption("Panel component " + caption);
-            ((Panel) result)
-                    .addComponent(new Label(
-                            "Panel is a container for other components, by default it draws a frame around it's "
-                                    + "extremities and may have a caption to clarify the nature of the contained components' purpose."
-                                    + " Panel contains an layout where the actual contained components are added, "
-                                    + "this layout may be switched on the fly."));
-            ((Panel) result).setWidth("250px");
-            break;
-        case 6:
-            // Datefield
-            result = new DateField();
-            ((DateField) result).setStyleName("calendar");
-            ((DateField) result).setValue(new java.util.Date());
-            result.setCaption("Calendar component " + caption);
-            break;
-        case 7:
-            // Datefield
-            result = new DateField();
-            ((DateField) result).setValue(new java.util.Date());
-            result.setCaption("Calendar component " + caption);
-            break;
-        case 8:
-            result = new VerticalLayout();
-            ((VerticalLayout) result).addComponent(new ButtonExample());
-            break;
-        case 9:
-            result = new VerticalLayout();
-            ((VerticalLayout) result).addComponent(new ClientCachingExample());
-            break;
-        case 10:
-            result = new VerticalLayout();
-            ((VerticalLayout) result).addComponent(new ComboBoxExample());
-            break;
-        case 11:
-            result = new VerticalLayout();
-            // TODO: disabled gwt bug with mixed up iframe's
-            ((VerticalLayout) result)
-                    .addComponent(new EmbeddedBrowserExample());
-            break;
-        case 12:
-            result = new VerticalLayout();
-            ((VerticalLayout) result).addComponent(new JavaScriptAPIExample());
-            break;
-        case 13:
-            result = new VerticalLayout();
-            ((VerticalLayout) result).addComponent(new LabelExample());
-            break;
-        case 14:
-            result = new VerticalLayout();
-            ((VerticalLayout) result).addComponent(new LayoutExample());
-            break;
-        case 15:
-            result = new VerticalLayout();
-            ((VerticalLayout) result).addComponent(new NotificationExample());
-            break;
-        case 16:
-            result = new VerticalLayout();
-            ((VerticalLayout) result).addComponent(new RichTextExample());
-            break;
-        case 17:
-            result = new VerticalLayout();
-            ((VerticalLayout) result).addComponent(new SelectExample());
-            break;
-        case 18:
-            result = new VerticalLayout();
-            ((VerticalLayout) result).addComponent(new ValueInputExample());
-            break;
-        case 19:
-            result = new VerticalLayout();
-            ((VerticalLayout) result).addComponent(new WindowingExample());
-            break;
-        case 20:
-            result = new VerticalLayout();
-            ((VerticalLayout) result).addComponent(new TreeExample());
-            break;
-        case 21:
-            result = new VerticalLayout();
-            ((VerticalLayout) result).addComponent(new TableExample());
-            break;
-        case 22:
-            result = new VerticalLayout();
-            ((VerticalLayout) result)
-                    .addComponent(new StressComponentsInTable());
-            break;
-        }
-
-        return result;
-    }
-
-    /**
-     * Add demo components to given container
-     * 
-     * @param container
-     */
-    public void fillLayout(ComponentContainer container, int numberOfComponents) {
-        for (int i = 0; i < numberOfComponents; i++) {
-            container.addComponent(getRandomComponent(i));
-        }
-    }
-
-    public AbstractComponent getExamplePicture(String caption) {
-        final ThemeResource res = new ThemeResource("test.png");
-        final Embedded em = new Embedded("Embedded " + caption, res);
-        return em;
-    }
-
-    public class MultiListener implements Button.ClickListener,
-            PropertySetChangeListener, ItemSetChangeListener,
-            ValueChangeListener {
-
-        public void buttonClick(ClickEvent event) {
-            System.out.println("ClickEvent from "
-                    + event.getButton().getCaption());
-        }
-
-        public void containerPropertySetChange(PropertySetChangeEvent event) {
-            System.out.println("containerPropertySetChange from "
-                    + event.getContainer());
-        }
-
-        public void containerItemSetChange(ItemSetChangeEvent event) {
-            System.out.println("containerItemSetChange from "
-                    + event.getContainer());
-        }
-
-        public void valueChange(ValueChangeEvent event) {
-            System.out.println("valueChange from " + event.getProperty());
-        }
-
-    }
-
-}