]> source.dussan.org Git - vaadin-framework.git/commitdiff
Added new ui theme testing application
authorJohn Ahlroos <john@vaadin.com>
Tue, 11 Sep 2012 10:37:36 +0000 (13:37 +0300)
committerJohn Ahlroos <john@vaadin.com>
Tue, 11 Sep 2012 10:40:00 +0000 (13:40 +0300)
20 files changed:
uitest/src/com/vaadin/tests/components/uitest/TestSampler.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/uitest/ThemeTestUI.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/uitest/components/AccordionsCssTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/uitest/components/ButtonsCssTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/uitest/components/DatesCssTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/uitest/components/EmbeddedCssTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/uitest/components/FormsCssTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/uitest/components/LabelsCssTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/uitest/components/LayoutsCssTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/uitest/components/NotificationsCssTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/uitest/components/SelectsCssTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/uitest/components/SlidersCssTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/uitest/components/TabSheetsCssTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/uitest/components/TablesCssTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/uitest/components/TextFieldsCssTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/uitest/components/TreeCssTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/uitest/components/TreeTableCssTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/uitest/components/UploadCssTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/uitest/components/WindowsCssTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/uitest/reindeer_theme_test.html [new file with mode: 0644]

diff --git a/uitest/src/com/vaadin/tests/components/uitest/TestSampler.java b/uitest/src/com/vaadin/tests/components/uitest/TestSampler.java
new file mode 100644 (file)
index 0000000..fce2ef6
--- /dev/null
@@ -0,0 +1,200 @@
+package com.vaadin.tests.components.uitest;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.vaadin.tests.components.uitest.components.AccordionsCssTest;
+import com.vaadin.tests.components.uitest.components.ButtonsCssTest;
+import com.vaadin.tests.components.uitest.components.DatesCssTest;
+import com.vaadin.tests.components.uitest.components.EmbeddedCssTest;
+import com.vaadin.tests.components.uitest.components.FormsCssTest;
+import com.vaadin.tests.components.uitest.components.LabelsCssTest;
+import com.vaadin.tests.components.uitest.components.LayoutsCssTest;
+import com.vaadin.tests.components.uitest.components.NotificationsCssTest;
+import com.vaadin.tests.components.uitest.components.SelectsCssTest;
+import com.vaadin.tests.components.uitest.components.SlidersCssTest;
+import com.vaadin.tests.components.uitest.components.TabSheetsCssTest;
+import com.vaadin.tests.components.uitest.components.TablesCssTest;
+import com.vaadin.tests.components.uitest.components.TextFieldsCssTest;
+import com.vaadin.tests.components.uitest.components.TreeCssTest;
+import com.vaadin.tests.components.uitest.components.TreeTableCssTest;
+import com.vaadin.tests.components.uitest.components.UploadCssTest;
+import com.vaadin.tests.components.uitest.components.WindowsCssTest;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.Window;
+
+/**
+ * Test sampler that creates a tabsheet of "all" the Vaadin UI components. This
+ * can be used to test themes and components in general.
+ */
+public class TestSampler extends TabSheet {
+    public static final String ICON_URL = "../runo/icons/16/help.png";
+
+    private List<Component> components = new ArrayList<Component>();
+
+    private ComponentContainer currentTab;
+
+    public TestSampler() {
+        setId("testsampler");
+
+        createLabels();
+        createButtons();
+        createEmbedded();
+        createPopupDates();
+        createTextFields();
+        createSelects();
+        createSliders();
+        createUploads();
+        createForms();
+
+        createTables();
+        createTrees();
+        createTreeTable();
+
+        createLayouts();
+        createTabSheets();
+        createAccordions();
+
+        createWindows();
+        createNotifications();
+
+    }
+
+    private void createNotifications() {
+        NotificationsCssTest notificationsTest = new NotificationsCssTest(this);
+        createComponentLayout("Notifications", notificationsTest);
+    }
+
+    private void createWindows() {
+        WindowsCssTest windows = new WindowsCssTest(this);
+        createComponentLayout("Windows", windows);
+    }
+
+    private void createAccordions() {
+        GridLayout grid = createGridLayoutBase();
+        createComponentLayout("Accordions", grid);
+        new AccordionsCssTest(this);
+    }
+
+    private void createTabSheets() {
+        GridLayout grid = createGridLayoutBase();
+        createComponentLayout("TabSheets", grid);
+        new TabSheetsCssTest(this);
+    }
+
+    private GridLayout createGridLayoutBase() {
+        GridLayout grid = new GridLayout();
+        grid.setColumns(3);
+        grid.setWidth("100%");
+        return grid;
+    }
+
+    private void createLayouts() {
+        GridLayout grid = new LayoutsCssTest(this);
+        createComponentLayout("Layouts", grid);
+    }
+
+    private void createTreeTable() {
+        createComponentLayout("TreeTable");
+        new TreeTableCssTest(this);
+    }
+
+    private void createTrees() {
+        createComponentLayout("Trees");
+        new TreeCssTest(this);
+    }
+
+    private void createTables() {
+        createComponentLayout("Tables", new TablesCssTest(this));
+    }
+
+    private void createForms() {
+        createComponentLayout("Forms", new FormsCssTest(this));
+    }
+
+    private void createUploads() {
+        createComponentLayout("Uploads");
+        new UploadCssTest(this);
+    }
+
+    private void createSliders() {
+        createComponentLayout("Sliders");
+        new SlidersCssTest(this);
+
+    }
+
+    private void createSelects() {
+        createComponentLayout("Selects", new SelectsCssTest(this));
+    }
+
+    private void createTextFields() {
+        createComponentLayout("TextFields", new TextFieldsCssTest(this));
+    }
+
+    private void createPopupDates() {
+        createComponentLayout("Dates", new DatesCssTest(this));
+    }
+
+    private void createEmbedded() {
+        createComponentLayout("Embedded");
+        new EmbeddedCssTest(this);
+
+    }
+
+    private void createButtons() {
+        createComponentLayout("Buttons", new ButtonsCssTest(this));
+    }
+
+    private void createLabels() {
+        createComponentLayout("Labels", new LabelsCssTest(this));
+    }
+
+    private void createComponentLayout(String caption) {
+
+        HorizontalLayout hl = new HorizontalLayout();
+        hl.setSpacing(true);
+        hl.setWidth("100%");
+
+        createComponentLayout(caption, hl);
+    }
+
+    private void createComponentLayout(String caption, ComponentContainer layout) {
+        addTab(layout, caption);
+        currentTab = layout;
+    }
+
+    @Override
+    public void addComponent(Component c) {
+
+        currentTab.addComponent(c);
+        components.add(c);
+    }
+
+    /**
+     * Register a component to the TestSampler for style name changes/additions.
+     * 
+     * @param component
+     */
+    public void registerComponent(Component component) {
+        components.add(component);
+    }
+
+    public void addWindow(Window window) {
+        UI.getCurrent().addWindow(window);
+    }
+
+    public void setCustomStyleNameToComponents(String oldStyleName,
+            String newStyleName) {
+        for (Component c : components) {
+            if (oldStyleName != null) {
+                c.removeStyleName(oldStyleName);
+            }
+            c.addStyleName(newStyleName);
+        }
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/ThemeTestUI.java b/uitest/src/com/vaadin/tests/components/uitest/ThemeTestUI.java
new file mode 100644 (file)
index 0000000..673045a
--- /dev/null
@@ -0,0 +1,65 @@
+package com.vaadin.tests.components.uitest;
+
+import com.vaadin.server.WrappedRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.TextField;
+
+public class ThemeTestUI extends AbstractTestUI {
+
+    private TextField customStyle;
+    private Button setStyleName;
+    private TestSampler sampler;
+    private String customStyleName = null;
+
+    @Override
+    protected void setup(WrappedRequest request) {
+        getLayout().setSpacing(true);
+
+        createCustomStyleStringField();
+
+        HorizontalLayout selectors = new HorizontalLayout();
+        selectors.setSpacing(true);
+
+        selectors.addComponent(customStyle);
+        selectors.addComponent(setStyleName);
+
+        addComponent(selectors);
+
+        sampler = new TestSampler();
+        addComponent(sampler);
+
+    }
+
+    private void createCustomStyleStringField() {
+        customStyle = new TextField();
+        customStyle.setId("customstyle");
+        setStyleName = new Button("Set stylename", new Button.ClickListener() {
+
+            @Override
+            public void buttonClick(ClickEvent event) {
+                onCustomStyleNameChanged(customStyle.getValue());
+            }
+        });
+        setStyleName.setId("setcuststyle");
+
+    }
+
+    private void onCustomStyleNameChanged(String newStyleName) {
+        sampler.setCustomStyleNameToComponents(customStyleName, newStyleName);
+        customStyleName = newStyleName;
+    }
+
+    @Override
+    protected String getTestDescription() {
+        return "Test Sampler application with support for changing themes and stylenames.";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 8031;
+    }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/components/AccordionsCssTest.java b/uitest/src/com/vaadin/tests/components/uitest/components/AccordionsCssTest.java
new file mode 100644 (file)
index 0000000..e3128d5
--- /dev/null
@@ -0,0 +1,55 @@
+package com.vaadin.tests.components.uitest.components;
+
+import com.vaadin.server.ThemeResource;
+import com.vaadin.server.UserError;
+import com.vaadin.tests.components.uitest.TestSampler;
+import com.vaadin.ui.Accordion;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.themes.ChameleonTheme;
+import com.vaadin.ui.themes.Runo;
+
+public class AccordionsCssTest {
+
+    private TestSampler parent;
+    private int debugIdCounter = 0;
+
+    public AccordionsCssTest(TestSampler parent) {
+        this.parent = parent;
+
+        Accordion def = createAccordionWith("Def Accordion", null);
+        parent.addComponent(def);
+
+        Accordion light = createAccordionWith("Light Accordion",
+                Runo.ACCORDION_LIGHT);
+        parent.addComponent(light);
+
+        Accordion opaque = createAccordionWith("Oppaque Accordion",
+                ChameleonTheme.ACCORDION_OPAQUE);
+        parent.addComponent(opaque);
+
+    }
+
+    private Accordion createAccordionWith(String caption, String styleName) {
+        Accordion acc = new Accordion();
+        acc.setId("accordion" + debugIdCounter++);
+        acc.setCaption(caption);
+        acc.setComponentError(new UserError("A error message..."));
+
+        if (styleName != null) {
+            acc.addStyleName(styleName);
+        }
+
+        Label l1 = new Label("There are no previously saved actions.");
+        Label l2 = new Label("There are no saved notes.");
+        Label l3 = new Label("There are currently no issues.");
+
+        acc.addTab(l1, "Actions", new ThemeResource(parent.ICON_URL));
+        acc.addTab(l2, "Notes", new ThemeResource(parent.ICON_URL));
+        acc.addTab(l3, "Issues", new ThemeResource(parent.ICON_URL));
+
+        acc.getTab(l2).setEnabled(false);
+
+        return acc;
+    }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/components/ButtonsCssTest.java b/uitest/src/com/vaadin/tests/components/uitest/components/ButtonsCssTest.java
new file mode 100644 (file)
index 0000000..d18b0b0
--- /dev/null
@@ -0,0 +1,108 @@
+package com.vaadin.tests.components.uitest.components;
+
+import com.vaadin.server.ExternalResource;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.tests.components.uitest.TestSampler;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Link;
+import com.vaadin.ui.themes.BaseTheme;
+import com.vaadin.ui.themes.ChameleonTheme;
+import com.vaadin.ui.themes.Reindeer;
+import com.vaadin.ui.themes.Runo;
+
+public class ButtonsCssTest extends GridLayout {
+
+    private TestSampler parent;
+    private int debugIdCounter = 0;
+
+    public ButtonsCssTest(TestSampler parent) {
+        this.parent = parent;
+        setSpacing(true);
+        setWidth("100%");
+        setColumns(6);
+
+        Button b = new Button("Default button");
+        b.setId("button" + debugIdCounter++);
+        addComponent(b);
+
+        b = new Button("Button with icon");
+        b.setIcon(new ThemeResource(parent.ICON_URL));
+        b.setId("button" + debugIdCounter++);
+        addComponent(b);
+
+        b = new Button("Button with tooltip");
+        b.setDescription("The tooltip");
+        b.setId("button" + debugIdCounter++);
+        addComponent(b);
+
+        b = new Button("Link button");
+        b.setStyleName(BaseTheme.BUTTON_LINK);
+        b.setId("button" + debugIdCounter++);
+        addComponent(b);
+
+        b = new Button("Disabled on click button");
+        b.setDisableOnClick(true);
+        b.setId("button" + debugIdCounter++);
+        addComponent(b);
+
+        CheckBox cb = new CheckBox("Checkbox");
+        cb.setId("button" + debugIdCounter++);
+        addComponent(cb);
+
+        cb = new CheckBox("Checkbox with icon");
+        cb.setIcon(new ThemeResource(parent.ICON_URL));
+        cb.setId("button" + debugIdCounter++);
+        addComponent(cb);
+
+        Link l = new Link("A link", new ExternalResource(""));
+        l.setId("button" + debugIdCounter++);
+        addComponent(l);
+
+        createButtonWith("Primary", Reindeer.BUTTON_DEFAULT, null);
+        createButtonWith("Small", Reindeer.BUTTON_SMALL, null);
+        createButtonWith("Default", Runo.BUTTON_DEFAULT, null);
+        createButtonWith("Big", Runo.BUTTON_BIG, null);
+        createButtonWith("Wide", ChameleonTheme.BUTTON_WIDE, null);
+        createButtonWith("Tall", ChameleonTheme.BUTTON_TALL, null);
+        createButtonWith("Borderless", ChameleonTheme.BUTTON_BORDERLESS, null);
+        createButtonWith("Icn top", ChameleonTheme.BUTTON_ICON_ON_TOP,
+                parent.ICON_URL);
+        createButtonWith("Icn right", ChameleonTheme.BUTTON_ICON_ON_RIGHT,
+                parent.ICON_URL);
+        createButtonWith("Icon only", ChameleonTheme.BUTTON_ICON_ONLY,
+                parent.ICON_URL);
+        createButtonWith("Down", ChameleonTheme.BUTTON_DOWN, null);
+
+    }
+
+    private void createButtonWith(String caption, String primaryStyleName,
+            String iconUrl) {
+        Button b = new Button();
+        b.setId("button" + debugIdCounter++);
+
+        if (caption != null) {
+            b.setCaption(caption);
+        }
+
+        if (primaryStyleName != null) {
+            b.addStyleName(primaryStyleName);
+        }
+
+        if (iconUrl != null) {
+            b.setIcon(new ThemeResource(iconUrl));
+        }
+
+        addComponent(b);
+
+    }
+
+    @Override
+    public void addComponent(Component component) {
+        parent.registerComponent(component);
+        super.addComponent(component);
+    }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/components/DatesCssTest.java b/uitest/src/com/vaadin/tests/components/uitest/components/DatesCssTest.java
new file mode 100644 (file)
index 0000000..e41eb75
--- /dev/null
@@ -0,0 +1,56 @@
+package com.vaadin.tests.components.uitest.components;
+
+import com.vaadin.tests.components.uitest.TestSampler;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.InlineDateField;
+import com.vaadin.ui.PopupDateField;
+import com.vaadin.ui.themes.ChameleonTheme;
+
+public class DatesCssTest extends HorizontalLayout {
+
+    private TestSampler parent;
+    private int debugIdCounter = 0;
+
+    public DatesCssTest(TestSampler parent) {
+        this.parent = parent;
+        setSpacing(true);
+        setWidth("100%");
+
+        createDateFieldWith(null, null);
+        createDateFieldWith("Small", ChameleonTheme.DATEFIELD_SMALL);
+        createDateFieldWith("Big", ChameleonTheme.DATEFIELD_BIG);
+
+        DateField df = new PopupDateField("Popup date field");
+        df.setId("datefield" + debugIdCounter++);
+        addComponent(df);
+
+        df = new InlineDateField("Inline date field");
+        df.setId("datefield" + debugIdCounter++);
+        addComponent(df);
+    }
+
+    private void createDateFieldWith(String caption, String primaryStyleName) {
+        DateField df = new DateField("Date field");
+        df.setId("datefield" + debugIdCounter++);
+
+        if (caption != null) {
+            df.setCaption(caption);
+        }
+
+        if (primaryStyleName != null) {
+            df.addStyleName(primaryStyleName);
+        }
+
+        addComponent(df);
+
+    }
+
+    @Override
+    public void addComponent(Component c) {
+        parent.registerComponent(c);
+        super.addComponent(c);
+    }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/components/EmbeddedCssTest.java b/uitest/src/com/vaadin/tests/components/uitest/components/EmbeddedCssTest.java
new file mode 100644 (file)
index 0000000..57783f6
--- /dev/null
@@ -0,0 +1,31 @@
+package com.vaadin.tests.components.uitest.components;
+
+import com.vaadin.server.ThemeResource;
+import com.vaadin.tests.components.uitest.TestSampler;
+import com.vaadin.ui.BrowserFrame;
+import com.vaadin.ui.Embedded;
+
+public class EmbeddedCssTest {
+
+    private int debugIdCounter = 0;
+
+    public EmbeddedCssTest(TestSampler parent) {
+        Embedded e = new Embedded("Embedded with a caption", new ThemeResource(
+                parent.ICON_URL));
+        e.setId("embedded" + debugIdCounter);
+        parent.addComponent(e);
+
+        e = new Embedded(null, new ThemeResource(parent.ICON_URL));
+        e.setId("embedded" + debugIdCounter);
+        parent.addComponent(e);
+
+        BrowserFrame eBrowser = new BrowserFrame();
+        eBrowser.setCaption("A embedded browser");
+        eBrowser.setSource(null);
+        eBrowser.setHeight("150px");
+        eBrowser.setWidth("300px");
+        eBrowser.setId("embedded" + debugIdCounter);
+        parent.addComponent(eBrowser);
+    }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/components/FormsCssTest.java b/uitest/src/com/vaadin/tests/components/uitest/components/FormsCssTest.java
new file mode 100644 (file)
index 0000000..e1e3068
--- /dev/null
@@ -0,0 +1,44 @@
+package com.vaadin.tests.components.uitest.components;
+
+import com.vaadin.data.fieldgroup.BeanFieldGroup;
+import com.vaadin.data.fieldgroup.FieldGroup;
+import com.vaadin.data.util.BeanItem;
+import com.vaadin.tests.components.uitest.TestSampler;
+import com.vaadin.tests.util.Person;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.LoginForm;
+import com.vaadin.ui.VerticalLayout;
+
+public class FormsCssTest extends HorizontalLayout {
+
+    private TestSampler parent;
+    private int debugIdCounter = 0;
+
+    public FormsCssTest(TestSampler parent) {
+        this.parent = parent;
+        setSpacing(true);
+        setWidth("100%");
+
+        VerticalLayout vl = new VerticalLayout();
+        FieldGroup fg = new BeanFieldGroup<Person>(Person.class);
+        fg.setItemDataSource(new BeanItem<Person>(new Person()));
+        for (Object propId : fg.getUnboundPropertyIds()) {
+            vl.addComponent(fg.buildAndBind(propId));
+        }
+
+        addComponent(vl);
+
+        LoginForm login = new LoginForm();
+        login.setId("form" + debugIdCounter++);
+        login.setHeight("150px");
+        addComponent(login);
+
+    }
+
+    @Override
+    public void addComponent(com.vaadin.ui.Component c) {
+        parent.registerComponent(c);
+        super.addComponent(c);
+    };
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/components/LabelsCssTest.java b/uitest/src/com/vaadin/tests/components/uitest/components/LabelsCssTest.java
new file mode 100644 (file)
index 0000000..2413dfa
--- /dev/null
@@ -0,0 +1,84 @@
+package com.vaadin.tests.components.uitest.components;
+
+import com.vaadin.server.ThemeResource;
+import com.vaadin.tests.components.uitest.TestSampler;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.themes.ChameleonTheme;
+import com.vaadin.ui.themes.Reindeer;
+
+public class LabelsCssTest extends GridLayout {
+
+    private TestSampler parent;
+    private int debugIdCounter = 0;
+
+    public LabelsCssTest(TestSampler parent) {
+        this.parent = parent;
+        setSpacing(true);
+        setWidth("100%");
+        setColumns(5);
+
+        createLabelWith(null, "Default empty label", null, null);
+        createLabelWith(null, "Label with icon", null, parent.ICON_URL);
+        Label l = createLabelWith("The caption", "With caption and tooltip",
+                null, null);
+        l.setDescription("The tooltip");
+
+        createLabelWith("H1", ChameleonTheme.LABEL_H1);
+        createLabelWith("H2", ChameleonTheme.LABEL_H2);
+        createLabelWith("H3", ChameleonTheme.LABEL_H3);
+        createLabelWith("H4", ChameleonTheme.LABEL_H4);
+        createLabelWith("Big", ChameleonTheme.LABEL_BIG);
+        createLabelWith("Small", ChameleonTheme.LABEL_SMALL);
+        createLabelWith("Tiny", ChameleonTheme.LABEL_TINY);
+        createLabelWith("Color", ChameleonTheme.LABEL_COLOR);
+        createLabelWith("Warning", ChameleonTheme.LABEL_WARNING);
+        createLabelWith("Error", ChameleonTheme.LABEL_ERROR);
+        // Will break test bench as the spinner spins and it's not identical in
+        // all screen shots
+        // createLabelWith("Loading", ChameleonTheme.LABEL_LOADING);
+        createLabelWith("Big", ChameleonTheme.LABEL_BIG);
+        createLabelWith("Big", ChameleonTheme.LABEL_BIG);
+
+        createLabelWith("Light", Reindeer.LABEL_SMALL);
+
+    }
+
+    private Label createLabelWith(String content, String primaryStyleName) {
+        return createLabelWith(null, content, primaryStyleName, null);
+    }
+
+    private Label createLabelWith(String caption, String content,
+            String primaryStyleName, String iconUrl) {
+
+        Label l = new Label();
+        l.setId("label" + debugIdCounter++);
+        if (caption != null) {
+            l.setCaption(caption);
+        }
+
+        if (content != null) {
+            l.setValue(content);
+        }
+
+        if (primaryStyleName != null) {
+            l.addStyleName(primaryStyleName);
+        }
+
+        if (iconUrl != null) {
+            l.setIcon(new ThemeResource(iconUrl));
+        }
+
+        addComponent(l);
+        return l;
+
+    }
+
+    @Override
+    public void addComponent(Component component) {
+        parent.registerComponent(component);
+        super.addComponent(component);
+    }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/components/LayoutsCssTest.java b/uitest/src/com/vaadin/tests/components/uitest/components/LayoutsCssTest.java
new file mode 100644 (file)
index 0000000..454fec7
--- /dev/null
@@ -0,0 +1,155 @@
+package com.vaadin.tests.components.uitest.components;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+import com.vaadin.server.ThemeResource;
+import com.vaadin.server.UserError;
+import com.vaadin.tests.components.uitest.TestSampler;
+import com.vaadin.ui.AbsoluteLayout;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomLayout;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalSplitPanel;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.VerticalSplitPanel;
+import com.vaadin.ui.themes.ChameleonTheme;
+import com.vaadin.ui.themes.Reindeer;
+
+public class LayoutsCssTest extends GridLayout {
+
+    private TestSampler parent;
+    private int debugIdCounter = 0;
+
+    public LayoutsCssTest(TestSampler parent) {
+        this.parent = parent;
+        setSpacing(true);
+        setColumns(4);
+        setWidth("100%");
+
+        VerticalLayout vl = new VerticalLayout();
+        vl.setCaption("VerticalLayout");
+        vl.setMargin(true);
+        vl.setSpacing(true);
+        vl.setComponentError(new UserError("A error message..."));
+        vl.addComponent(new Label("Some content"));
+        vl.setId("layout" + debugIdCounter++);
+        addComponent(vl);
+
+        CssLayout css = new CssLayout();
+        css.setCaption("CssLayout");
+        css.addComponent(new Label("Some content"));
+        css.setId("layout" + debugIdCounter++);
+        addComponent(css);
+
+        AbsoluteLayout abs = new AbsoluteLayout();
+        abs.setCaption("Abs layout");
+        abs.addComponent(new Label("Some content"));
+        abs.setComponentError(new UserError("A error message..."));
+        abs.setId("layout" + debugIdCounter++);
+
+        addComponent(abs);
+
+        GridLayout gl = new GridLayout();
+        gl.setMargin(true);
+        gl.setSpacing(true);
+        gl.setCaption("GridLayout");
+        gl.setComponentError(new UserError("A error message..."));
+        gl.addComponent(new Label("Some content"));
+        gl.setId("layout" + debugIdCounter++);
+
+        addComponent(gl);
+
+        VerticalSplitPanel vert = new VerticalSplitPanel();
+        vert.setCaption("VertSplitPan");
+        vert.setFirstComponent(new Label("Some content 1"));
+        vert.setSecondComponent(new Label("Some content 2"));
+        vert.setComponentError(new UserError("A error message..."));
+        vert.setSplitPosition(50);
+        vert.setEnabled(false);
+        vert.setHeight("50px");
+        vert.setId("layout" + debugIdCounter++);
+
+        addComponent(vert);
+
+        HorizontalSplitPanel horiz = new HorizontalSplitPanel();
+        horiz.setSplitPosition(50);
+        horiz.setFirstComponent(new Label("Some content 1"));
+        horiz.setSecondComponent(new Label("Some content 2"));
+        horiz.setIcon(new ThemeResource(parent.ICON_URL));
+        horiz.setCaption("HorizSplitPan");
+        horiz.setId("layout" + debugIdCounter++);
+
+        addComponent(horiz);
+
+        VerticalSplitPanel smallSplitPanel = new VerticalSplitPanel();
+        smallSplitPanel.setCaption("SmallVertSplitPan");
+        smallSplitPanel.setFirstComponent(new Label("Some content 1"));
+        smallSplitPanel.setSecondComponent(new Label("Some content 2"));
+        smallSplitPanel.setComponentError(new UserError("A error message..."));
+        smallSplitPanel.setSplitPosition(50);
+        smallSplitPanel.addStyleName(Reindeer.SPLITPANEL_SMALL);
+        smallSplitPanel.setEnabled(false);
+        smallSplitPanel.setHeight("50px");
+        smallSplitPanel.setId("layout" + debugIdCounter++);
+        addComponent(smallSplitPanel);
+
+        String customLayoutSrc = "<html><div location='pos1' class='customclass'> </div></html>";
+
+        CustomLayout custom;
+        try {
+            custom = new CustomLayout(new ByteArrayInputStream(
+                    customLayoutSrc.getBytes()));
+            custom.addComponent(new Label("Some content"), "pos1");
+            custom.setComponentError(new UserError("A error mesasge..."));
+            custom.setCaption("CustomLayout");
+            custom.setId("layout" + debugIdCounter++);
+
+            addComponent(custom);
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+        Panel defPanel = createPanelWith("A default panel", null);
+        addComponent(defPanel);
+
+        Panel light = createPanelWith("A light panel", Reindeer.PANEL_LIGHT);
+        addComponent(light);
+
+        Panel borderless = createPanelWith("A borderless panel",
+                ChameleonTheme.PANEL_BORDERLESS);
+        addComponent(borderless);
+
+        Panel bubbling = createPanelWith("A Bubbling panel",
+                ChameleonTheme.PANEL_BUBBLE);
+        addComponent(bubbling);
+    }
+
+    /**
+     * Helper to create panels for different theme variants...
+     */
+    private Panel createPanelWith(String caption, String styleName) {
+        Panel panel = new Panel(caption);
+        panel.addComponent(new Label("Some content"));
+        panel.setIcon(new ThemeResource(parent.ICON_URL));
+        panel.setComponentError(new UserError("A error message..."));
+        panel.setId("layout" + debugIdCounter++);
+
+        if (styleName != null) {
+            panel.addStyleName(styleName);
+        }
+
+        return panel;
+    }
+
+    @Override
+    public void addComponent(Component component) {
+        parent.registerComponent(component);
+        super.addComponent(component);
+
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/components/NotificationsCssTest.java b/uitest/src/com/vaadin/tests/components/uitest/components/NotificationsCssTest.java
new file mode 100644 (file)
index 0000000..78ff89d
--- /dev/null
@@ -0,0 +1,98 @@
+package com.vaadin.tests.components.uitest.components;
+
+import com.vaadin.tests.components.uitest.TestSampler;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Notification;
+import com.vaadin.ui.VerticalLayout;
+
+public class NotificationsCssTest extends VerticalLayout {
+
+    private TestSampler parent;
+    private String styleName = null;
+    private int debugIdCounter = 0;
+
+    public NotificationsCssTest(TestSampler parent) {
+        this.parent = parent;
+        parent.registerComponent(this);
+
+        Button humanized = new Button("Humanized message",
+                new Button.ClickListener() {
+
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        createNotification("A message", "A description",
+                                Notification.Type.HUMANIZED_MESSAGE);
+                    }
+                });
+        humanized.setId("notifButt" + debugIdCounter++);
+        Button warning = new Button("Warning message",
+                new Button.ClickListener() {
+
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        createNotification("A message", "A description",
+                                Notification.Type.WARNING_MESSAGE);
+                    }
+                });
+        warning.setId("notifButt" + debugIdCounter++);
+        Button error = new Button("Error message", new Button.ClickListener() {
+
+            @Override
+            public void buttonClick(ClickEvent event) {
+                createNotification("A message", "A description",
+                        Notification.Type.ERROR_MESSAGE);
+            }
+        });
+        error.setId("notifButt" + debugIdCounter++);
+        Button tray = new Button("Tray message", new Button.ClickListener() {
+
+            @Override
+            public void buttonClick(ClickEvent event) {
+                createNotification("A message", "A description",
+                        Notification.Type.TRAY_NOTIFICATION);
+            }
+        });
+        tray.setId("notifButt" + debugIdCounter++);
+
+        addComponent(humanized);
+        addComponent(warning);
+        addComponent(error);
+        addComponent(tray);
+    }
+
+    private void createNotification(String caption, String message,
+            Notification.Type type) {
+
+        Notification notification;
+
+        if (message == null) {
+            notification = new Notification(caption, type);
+        } else {
+            notification = new Notification(caption, message, type);
+        }
+
+        if (styleName != null) {
+            notification.setStyleName(styleName);
+        }
+
+        notification.setDelayMsec(-1);
+        notification.show(parent.getUI().getPage());
+    }
+
+    @Override
+    public void setStyleName(String style) {
+        styleName = style;
+    }
+
+    @Override
+    public void addStyleName(String style) {
+        styleName = style;
+    }
+
+    @Override
+    public void removeStyleName(String style) {
+        styleName = null;
+    }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/components/SelectsCssTest.java b/uitest/src/com/vaadin/tests/components/uitest/components/SelectsCssTest.java
new file mode 100644 (file)
index 0000000..4da6837
--- /dev/null
@@ -0,0 +1,97 @@
+package com.vaadin.tests.components.uitest.components;
+
+import com.vaadin.tests.components.uitest.TestSampler;
+import com.vaadin.ui.AbstractSelect;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.ListSelect;
+import com.vaadin.ui.NativeSelect;
+import com.vaadin.ui.OptionGroup;
+import com.vaadin.ui.Select;
+import com.vaadin.ui.TwinColSelect;
+import com.vaadin.ui.themes.ChameleonTheme;
+
+public class SelectsCssTest extends HorizontalLayout {
+
+    private TestSampler parent;
+    private int debugIdCounter = 0;
+
+    public SelectsCssTest(TestSampler parent) {
+        this.parent = parent;
+        setSpacing(true);
+        setWidth(null);
+
+        Select s = new Select("Basic select");
+        s.setId("select" + debugIdCounter++);
+        addComponent(s);
+
+        s = new Select("Select with items");
+        s.setId("select" + debugIdCounter++);
+        createDummyData(s);
+        addComponent(s);
+
+        TwinColSelect tws = new TwinColSelect();
+        tws.setId("select" + debugIdCounter++);
+        createDummyData(tws);
+        addComponent(tws);
+
+        OptionGroup og = new OptionGroup();
+        og.setId("select" + debugIdCounter++);
+        createDummyData(og, 4);
+        addComponent(og);
+
+        og = new OptionGroup();
+        og.setId("select" + debugIdCounter++);
+        createDummyData(og, 4);
+        og.setItemEnabled("Foo2", false);
+        og.setItemEnabled("Foo3", false);
+        addComponent(og);
+
+        NativeSelect ns = new NativeSelect();
+        ns.setId("select" + debugIdCounter++);
+        createDummyData(ns);
+        addComponent(ns);
+
+        createComboBoxWith(null, null);
+        createComboBoxWith("CB Search", ChameleonTheme.COMBOBOX_SEARCH);
+        createComboBoxWith("SelectButton",
+                ChameleonTheme.COMBOBOX_SELECT_BUTTON);
+
+        ListSelect ls = new ListSelect();
+        ls.setId("select" + debugIdCounter++);
+        createDummyData(ls);
+        addComponent(ls);
+    }
+
+    private void createComboBoxWith(String caption, String primaryStyleName) {
+        ComboBox cb = new ComboBox();
+        cb.setId("select" + debugIdCounter++);
+        if (caption != null) {
+            cb.setCaption(caption);
+        }
+
+        if (primaryStyleName != null) {
+            cb.addStyleName(primaryStyleName);
+        }
+
+        createDummyData(cb);
+        addComponent(cb);
+    }
+
+    @Override
+    public void addComponent(Component c) {
+        parent.registerComponent(c);
+        super.addComponent(c);
+    }
+
+    private void createDummyData(AbstractSelect select) {
+        createDummyData(select, 20);
+    }
+
+    private void createDummyData(AbstractSelect select, int items) {
+        for (int i = 0; i < items; i++) {
+            select.addItem("Foo" + i);
+        }
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/components/SlidersCssTest.java b/uitest/src/com/vaadin/tests/components/uitest/components/SlidersCssTest.java
new file mode 100644 (file)
index 0000000..db6b6fc
--- /dev/null
@@ -0,0 +1,21 @@
+package com.vaadin.tests.components.uitest.components;
+
+import com.vaadin.shared.ui.slider.SliderOrientation;
+import com.vaadin.tests.components.uitest.TestSampler;
+import com.vaadin.ui.Slider;
+
+public class SlidersCssTest {
+
+    private int debugIdCounter = 0;
+
+    public SlidersCssTest(TestSampler parent) {
+        Slider slide = new Slider();
+        slide.setId("slider" + debugIdCounter++);
+        parent.addComponent(slide);
+
+        slide = new Slider();
+        slide.setOrientation(SliderOrientation.VERTICAL);
+        slide.setId("slider" + debugIdCounter++);
+        parent.addComponent(slide);
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/components/TabSheetsCssTest.java b/uitest/src/com/vaadin/tests/components/uitest/components/TabSheetsCssTest.java
new file mode 100644 (file)
index 0000000..b05eb2f
--- /dev/null
@@ -0,0 +1,72 @@
+package com.vaadin.tests.components.uitest.components;
+
+import com.vaadin.server.ThemeResource;
+import com.vaadin.server.UserError;
+import com.vaadin.tests.components.uitest.TestSampler;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.themes.Reindeer;
+import com.vaadin.ui.themes.Runo;
+
+public class TabSheetsCssTest {
+
+    private TestSampler parent;
+    private int debugIdCounter = 0;
+
+    public TabSheetsCssTest(TestSampler parent) {
+        this.parent = parent;
+
+        TabSheet basic = createTabSheetWith("Basic TabSheet", null);
+        parent.addComponent(basic);
+
+        TabSheet bordeless = createTabSheetWith("Borderelss TabSheet",
+                Reindeer.TABSHEET_BORDERLESS);
+        parent.addComponent(bordeless);
+
+        TabSheet bar = createTabSheetWith("A small/bar TabSheet",
+                Reindeer.TABSHEET_SMALL);
+        parent.addComponent(bar);
+
+        TabSheet minimal = createTabSheetWith("A minimal tabsheet",
+                Reindeer.TABSHEET_MINIMAL);
+        parent.addComponent(minimal);
+
+        TabSheet hoverClosable = createTabSheetWith(
+                "A hover-closable TabSheet", Reindeer.TABSHEET_HOVER_CLOSABLE);
+        parent.addComponent(hoverClosable);
+
+        TabSheet selectedClosable = createTabSheetWith(
+                "A selected-closable TabSheet",
+                Reindeer.TABSHEET_SELECTED_CLOSABLE);
+        parent.addComponent(selectedClosable);
+
+        TabSheet light = createTabSheetWith("A light TabSheet",
+                Runo.TABSHEET_SMALL);
+        parent.addComponent(light);
+
+    }
+
+    private TabSheet createTabSheetWith(String caption, String styleName) {
+        TabSheet ts = new TabSheet();
+        ts.setId("tabsheet" + debugIdCounter++);
+        ts.setCaption(caption);
+        ts.setComponentError(new UserError("A error message"));
+
+        Label content = new Label("First Component");
+        ts.addTab(content, "First");
+        Label content2 = new Label("Second Component");
+        ts.addTab(content2, "Second");
+        ts.getTab(content2).setClosable(true);
+
+        Label content3 = new Label("Third Component");
+        ts.addTab(content3, "Third", new ThemeResource(parent.ICON_URL));
+        ts.getTab(content3).setEnabled(false);
+
+        if (styleName != null) {
+            ts.addStyleName(styleName);
+        }
+
+        return ts;
+
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/components/TablesCssTest.java b/uitest/src/com/vaadin/tests/components/uitest/components/TablesCssTest.java
new file mode 100644 (file)
index 0000000..754b359
--- /dev/null
@@ -0,0 +1,100 @@
+package com.vaadin.tests.components.uitest.components;
+
+import java.util.HashSet;
+
+import com.vaadin.event.Action;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.tests.components.uitest.TestSampler;
+import com.vaadin.tests.util.TestUtils;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.themes.ChameleonTheme;
+import com.vaadin.ui.themes.Reindeer;
+
+public class TablesCssTest extends GridLayout {
+
+    private TestSampler parent;
+    private int debugIdCounter = 0;
+
+    private final Action ACTION_MARK = new Action("Mark");
+    private final Action ACTION_UNMARK = new Action("Unmark");
+    private final Action ACTION_LOG = new Action("Save");
+    private final Action[] ACTIONS_UNMARKED = new Action[] { ACTION_MARK,
+            ACTION_LOG };
+    private final Action[] ACTIONS_MARKED = new Action[] { ACTION_UNMARK,
+            ACTION_LOG };
+
+    public TablesCssTest(TestSampler parent) {
+        super();
+        setSpacing(true);
+        setColumns(2);
+        setWidth("100%");
+
+        this.parent = parent;
+
+        createTableWith("CC & flags, default table", null);
+        createTableWith("Borderless", ChameleonTheme.TABLE_BORDERLESS);
+        createTableWith("Big", ChameleonTheme.TABLE_BIG);
+        createTableWith("Small", ChameleonTheme.TABLE_SMALL);
+        createTableWith("Striped", ChameleonTheme.TABLE_STRIPED);
+        createTableWith("Strong", Reindeer.TABLE_STRONG);
+
+    }
+
+    private void createTableWith(String caption, String primaryStyleName) {
+        final HashSet<Object> markedRows = new HashSet<Object>();
+
+        final Table t;
+        if (caption != null) {
+            t = new Table(caption);
+        } else {
+            t = new Table();
+        }
+
+        t.setId("table" + debugIdCounter++);
+
+        if (primaryStyleName != null) {
+            t.addStyleName(primaryStyleName);
+        }
+
+        t.setWidth("100%");
+        t.setHeight("100px");
+
+        t.setSelectable(true);
+        t.setMultiSelect(true);
+        t.setImmediate(true);
+        t.setContainerDataSource(TestUtils.getISO3166Container());
+        t.setColumnReorderingAllowed(true);
+        t.setColumnCollapsingAllowed(true);
+        // t.setColumnHeaders(new String[] { "Country", "Code", "Icon file" });
+        t.setColumnIcon(TestUtils.iso3166_PROPERTY_NAME, new ThemeResource(
+                parent.ICON_URL));
+
+        // Actions (a.k.a context menu)
+        t.addActionHandler(new Action.Handler() {
+            public Action[] getActions(Object target, Object sender) {
+                if (markedRows.contains(target)) {
+                    return ACTIONS_MARKED;
+                } else {
+                    return ACTIONS_UNMARKED;
+                }
+            }
+
+            @Override
+            public void handleAction(Action action, Object sender, Object target) {
+                // We just want the actions UI.. don't care about the logic...
+                if (ACTION_MARK == action) {
+                    markedRows.add(target);
+                    t.refreshRowCache();
+                } else if (ACTION_UNMARK == action) {
+                    markedRows.remove(target);
+                    t.refreshRowCache();
+                }
+            }
+        });
+
+        addComponent(t);
+        parent.registerComponent(t);
+    }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/components/TextFieldsCssTest.java b/uitest/src/com/vaadin/tests/components/uitest/components/TextFieldsCssTest.java
new file mode 100644 (file)
index 0000000..6ae220b
--- /dev/null
@@ -0,0 +1,80 @@
+package com.vaadin.tests.components.uitest.components;
+
+import com.vaadin.tests.components.uitest.TestSampler;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.PasswordField;
+import com.vaadin.ui.RichTextArea;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.themes.ChameleonTheme;
+import com.vaadin.ui.themes.Reindeer;
+
+public class TextFieldsCssTest extends GridLayout {
+
+    private TestSampler parent;
+    private int debugIdCounter = 0;
+
+    public TextFieldsCssTest(TestSampler parent) {
+        this.parent = parent;
+        setSpacing(true);
+        setColumns(7);
+        setRows(2);
+
+        setWidth("100%");
+
+        createTextFieldWith(null, null, null);
+        createTextFieldWith("Input prompt", null, "Input prompt");
+        createTextFieldWith("Small", Reindeer.TEXTFIELD_SMALL, null);
+        createTextFieldWith("Big", ChameleonTheme.TEXTFIELD_BIG, null);
+        createTextFieldWith("Search", ChameleonTheme.TEXTFIELD_SEARCH, null);
+
+        TextArea ta = new TextArea();
+        ta.setId("textfield" + debugIdCounter++);
+        addComponent(ta);
+
+        PasswordField pf = new PasswordField();
+        pf.setId("textfield" + debugIdCounter++);
+        addComponent(pf);
+
+        RichTextArea rta = new RichTextArea();
+        rta.setId("textfield" + debugIdCounter++);
+        addComponent(rta, 0, 1, 6, 1);
+
+    }
+
+    private void createTextFieldWith(String caption, String primaryStyleName,
+            String inputPrompt) {
+        TextField tf = new TextField();
+        tf.setId("textfield" + debugIdCounter++);
+        if (caption != null) {
+            tf.setCaption(caption);
+        }
+
+        if (primaryStyleName != null) {
+            tf.addStyleName(primaryStyleName);
+        }
+
+        if (inputPrompt != null) {
+            tf.setInputPrompt(inputPrompt);
+        }
+
+        addComponent(tf);
+
+    }
+
+    @Override
+    public void addComponent(Component c) {
+        parent.registerComponent(c);
+        super.addComponent(c);
+    }
+
+    @Override
+    public void addComponent(Component component, int column1, int row1,
+            int column2, int row2) throws OverlapsException,
+            OutOfBoundsException {
+
+        parent.registerComponent(component);
+        super.addComponent(component, column1, row1, column2, row2);
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/components/TreeCssTest.java b/uitest/src/com/vaadin/tests/components/uitest/components/TreeCssTest.java
new file mode 100644 (file)
index 0000000..0508bfc
--- /dev/null
@@ -0,0 +1,72 @@
+package com.vaadin.tests.components.uitest.components;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.util.HierarchicalContainer;
+import com.vaadin.event.Action;
+import com.vaadin.tests.components.uitest.TestSampler;
+import com.vaadin.ui.Tree;
+
+public class TreeCssTest {
+    private int debugIdCounter = 0;
+
+    public TreeCssTest(TestSampler parent) {
+        // Actions for the context menu
+        final Action ACTION_ADD = new Action("Add child item");
+        final Action ACTION_DELETE = new Action("Delete");
+        final Action[] ACTIONS = new Action[] { ACTION_ADD, ACTION_DELETE };
+
+        final Tree tree = new Tree();
+        tree.setId("tree" + debugIdCounter++);
+
+        HierarchicalContainer hc = createHierarchicalContainer();
+
+        tree.setContainerDataSource(hc);
+
+        tree.addActionHandler(new Action.Handler() {
+
+            @Override
+            public void handleAction(Action action, Object sender, Object target) {
+                // We don't care about functionality, we just want the UI for
+                // testing..
+
+            }
+
+            @Override
+            public Action[] getActions(Object target, Object sender) {
+                // TODO Auto-generated method stub
+                return ACTIONS;
+            }
+        });
+
+        // Expand whole tree
+        for (Object id : tree.rootItemIds()) {
+            tree.expandItemsRecursively(id);
+        }
+
+        parent.addComponent(tree);
+    }
+
+    private HierarchicalContainer createHierarchicalContainer() {
+        String[] itemNames = new String[] { "Foo", "Baar" };
+
+        HierarchicalContainer hc = new HierarchicalContainer();
+        hc.addContainerProperty("NAME", String.class, null);
+
+        for (String parentId : itemNames) {
+            Item parent = hc.addItem(parentId);
+            parent.getItemProperty("NAME").setValue(parentId);
+            hc.setChildrenAllowed(parent, true);
+            for (int i = 0; i < 5; i++) {
+                String childId = parentId + i;
+                Item child = hc.addItem(childId);
+                child.getItemProperty("NAME").setValue(childId);
+                if (!hc.setParent(childId, parentId)) {
+                    System.out.println("Unable to set parent \"" + parentId
+                            + "\" for child with id: \"" + childId + "\"");
+                }
+            }
+        }
+        return hc;
+    }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/components/TreeTableCssTest.java b/uitest/src/com/vaadin/tests/components/uitest/components/TreeTableCssTest.java
new file mode 100644 (file)
index 0000000..ca24669
--- /dev/null
@@ -0,0 +1,49 @@
+package com.vaadin.tests.components.uitest.components;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.util.HierarchicalContainer;
+import com.vaadin.tests.components.uitest.TestSampler;
+import com.vaadin.ui.TreeTable;
+
+public class TreeTableCssTest {
+    private int debugIdCounter = 0;
+
+    public TreeTableCssTest(TestSampler parent) {
+        TreeTable treeTable = new TreeTable();
+        treeTable.setId("treetable" + debugIdCounter++);
+        treeTable.setWidth("100%");
+        parent.addComponent(treeTable);
+
+        HierarchicalContainer hc = createHierarchicalContainer();
+
+        treeTable.setContainerDataSource(hc);
+
+        for (Object itemId : treeTable.getItemIds()) {
+            treeTable.setCollapsed(itemId, false);
+        }
+    }
+
+    private HierarchicalContainer createHierarchicalContainer() {
+        String[] itemNames = new String[] { "Foo", "Baar" };
+
+        HierarchicalContainer hc = new HierarchicalContainer();
+        hc.addContainerProperty("NAME", String.class, null);
+
+        for (String parentId : itemNames) {
+            Item parent = hc.addItem(parentId);
+            parent.getItemProperty("NAME").setValue(parentId);
+            hc.setChildrenAllowed(parent, true);
+            for (int i = 0; i < 5; i++) {
+                String childId = parentId + i;
+                Item child = hc.addItem(childId);
+                child.getItemProperty("NAME").setValue(childId);
+                if (!hc.setParent(childId, parentId)) {
+                    System.out.println("Unable to set parent \"" + parentId
+                            + "\" for child with id: \"" + childId + "\"");
+                }
+            }
+        }
+        return hc;
+    }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/components/UploadCssTest.java b/uitest/src/com/vaadin/tests/components/uitest/components/UploadCssTest.java
new file mode 100644 (file)
index 0000000..9aac96c
--- /dev/null
@@ -0,0 +1,20 @@
+package com.vaadin.tests.components.uitest.components;
+
+import com.vaadin.tests.components.uitest.TestSampler;
+import com.vaadin.ui.Upload;
+
+public class UploadCssTest {
+
+    private int debugIdCounter = 0;
+
+    public UploadCssTest(TestSampler parent) {
+        Upload up = new Upload();
+        up.setId("upload" + debugIdCounter++);
+        parent.addComponent(up);
+
+        up = new Upload();
+        up.setId("upload" + debugIdCounter++);
+        up.setImmediate(true);
+        parent.addComponent(up);
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/components/WindowsCssTest.java b/uitest/src/com/vaadin/tests/components/uitest/components/WindowsCssTest.java
new file mode 100644 (file)
index 0000000..ceb5ff5
--- /dev/null
@@ -0,0 +1,116 @@
+package com.vaadin.tests.components.uitest.components;
+
+import com.vaadin.tests.components.uitest.TestSampler;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window;
+import com.vaadin.ui.themes.ChameleonTheme;
+import com.vaadin.ui.themes.Reindeer;
+import com.vaadin.ui.themes.Runo;
+
+public class WindowsCssTest extends VerticalLayout {
+
+    private TestSampler parent;
+    private String styleName = null;
+    private String caption = "A caption";
+
+    private int debugIdCounter = 0;
+
+    public WindowsCssTest(TestSampler parent) {
+        this.parent = parent;
+        parent.registerComponent(this);
+
+        Button defWindow = new Button("Default window",
+                new Button.ClickListener() {
+
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        createWindowWith(caption, null, styleName);
+                    }
+                });
+        defWindow.setId("windButton" + debugIdCounter++);
+        Button light = new Button("Light window", new Button.ClickListener() {
+
+            @Override
+            public void buttonClick(ClickEvent event) {
+                createWindowWith(caption, Reindeer.WINDOW_LIGHT, styleName);
+            }
+        });
+        light.setId("windButton" + debugIdCounter++);
+        Button black = new Button("Black window", new Button.ClickListener() {
+
+            @Override
+            public void buttonClick(ClickEvent event) {
+                createWindowWith(caption, Reindeer.WINDOW_BLACK, styleName);
+            }
+        });
+        black.setId("windButton" + debugIdCounter++);
+        Button dialog = new Button("Dialog window", new Button.ClickListener() {
+
+            @Override
+            public void buttonClick(ClickEvent event) {
+                createWindowWith(caption, Runo.WINDOW_DIALOG, styleName);
+            }
+        });
+        dialog.setId("windButton" + debugIdCounter++);
+        Button opaque = new Button("Opaque window", new Button.ClickListener() {
+
+            @Override
+            public void buttonClick(ClickEvent event) {
+                createWindowWith(caption, ChameleonTheme.WINDOW_OPAQUE,
+                        styleName);
+            }
+        });
+        opaque.setId("windButton" + debugIdCounter++);
+
+        addComponent(defWindow);
+        addComponent(light);
+        addComponent(black);
+        addComponent(dialog);
+        addComponent(opaque);
+
+    }
+
+    /**
+     * 
+     * @param caption
+     * @param primaryStyleName
+     *            - the style defined styleName
+     * @param styleName
+     *            - the user defined styleName
+     * @return
+     */
+    private void createWindowWith(String caption, String primaryStyleName,
+            String styleName) {
+
+        Window window = new Window();
+        window.addComponent(new Label("Some content"));
+
+        if (caption != null) {
+            window.setCaption(caption);
+        }
+
+        if (primaryStyleName != null) {
+            window.addStyleName(primaryStyleName);
+        }
+
+        if (styleName != null) {
+            window.addStyleName(styleName);
+        }
+
+        parent.getUI().addWindow(window);
+
+    }
+
+    @Override
+    public void addStyleName(String style) {
+        styleName = style;
+    };
+
+    @Override
+    public void removeStyleName(String style) {
+        styleName = null;
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/reindeer_theme_test.html b/uitest/src/com/vaadin/tests/components/uitest/reindeer_theme_test.html
new file mode 100644 (file)
index 0000000..5d25c87
--- /dev/null
@@ -0,0 +1,466 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>reindeer_theme_test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">reindeer_theme_test</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/ThemeTestUI?restartApplication&amp;theme=reindeer</td>
+       <td></td>
+</tr>
+<tr>
+       <td>setSpeed</td>
+       <td>150</td>
+       <td>150</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='testsampler']/div[1]/table/tbody/tr/td[2]/div/div/div</td>
+       <td>31,8</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='testsampler']/div[1]/table/tbody/tr/td[3]/div/div/div</td>
+       <td>27,1</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='testsampler']/div[1]/table/tbody/tr/td[4]/div/div</td>
+       <td>33,24</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='datefield0']/button</td>
+       <td>11,10</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='testsampler']/div[2]/div/div[3]/div/div</td>
+       <td>402,158</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='datefield1']/button</td>
+       <td>14,9</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='datefield2']/button</td>
+       <td>9,16</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='datefield3']/button</td>
+       <td>9,10</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='testsampler']/div[1]/table/tbody/tr/td[5]/div/div/div</td>
+       <td>35,2</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='testsampler']/div[1]/table/tbody/tr/td[6]/div/div/div</td>
+       <td>27,10</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='select0']/div</td>
+       <td>9,11</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='select1']/div</td>
+       <td>10,13</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='select6']/div</td>
+       <td>7,13</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='select7']/div</td>
+       <td>7,12</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='select8']/div</td>
+       <td>9,7</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='testsampler']/div[1]/table/tbody/tr/td[7]/div/div/div</td>
+       <td>20,3</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='testsampler']/div[1]/table/tbody/tr/td[8]/div/div/div</td>
+       <td>18,5</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runThemeTestUI::/VVerticalLayout[0]</td>
+       <td>518,136</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='testsampler']/div[2]/div/div[4]/div/div/div[1]</td>
+       <td>510,23</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='testsampler']/div[1]/table/tbody/tr/td[9]/div/div/div</td>
+       <td>18,10</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='testsampler']/div[1]/table/tbody/tr/td[10]/div/div</td>
+       <td>22,25</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>contextmenu</td>
+       <td>//div[@id='table0']/div[2]/div[1]/table/tbody/tr[2]/td[1]/div</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='table0']/div[1]/div[2]</td>
+       <td>12,9</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='testsampler']/div[1]/table/tbody/tr/td[11]/div/div/div</td>
+       <td>28,3</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='testsampler']/div[1]/table/tbody/tr/td[12]/div/div</td>
+       <td>52,9</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='testsampler']/div[1]/table/tbody/tr/td[13]/div/div</td>
+       <td>23,9</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='testsampler']/div[1]/table/tbody/tr/td[14]/div/div/div</td>
+       <td>24,1</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='testsampler']/div[1]/table/tbody/tr/td[15]/div/div/div</td>
+       <td>24,9</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='testsampler']/div[1]/table/tbody/tr/td[16]/div/div/div</td>
+       <td>15,0</td>
+</tr>
+<!--Window and Notification screenshots-->
+<tr>
+       <td>click</td>
+       <td>//div[@id='windButton0']/span</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+       <td>9,8</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>//div[@id='windButton1']/span/span</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+       <td>11,6</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>//div[@id='windButton2']/span/span</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+       <td>8,5</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>//div[@id='windButton3']/span/span</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+       <td>9,6</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>//div[@id='windButton4']/span/span</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+       <td>10,7</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>//div[@id='testsampler']/div[1]/table/tbody/tr/td[17]/div/div</td>
+       <td>46,8</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>//div[@id='notifButt0']/span/span</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runThemeTestUI::Root/VNotification[0]</td>
+       <td>214,15</td>
+</tr>
+<!--
+<tr>
+       <td>closeNotification</td>
+       <td>//body/div[2]</td>
+       <td>0,0</td>
+</tr>
+-->
+<tr>
+       <td>click</td>
+       <td>//div[@id='notifButt1']/span/span</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runThemeTestUI::Root/VNotification[0]</td>
+       <td>172,13</td>
+</tr>
+<!--
+<tr>
+       <td>closeNotification</td>
+       <td>//body/div[2]</td>
+       <td>0,0</td>
+</tr>
+-->
+<tr>
+       <td>click</td>
+       <td>//div[@id='notifButt2']/span/span</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runThemeTestUI::Root/VNotification[0]</td>
+       <td>318,11</td>
+</tr>
+<!--
+<tr>
+       <td>closeNotification</td>
+       <td>//body/div[2]</td>
+       <td>0,0</td>
+</tr>
+-->
+<tr>
+       <td>click</td>
+       <td>//div[@id='notifButt3']/span/span</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runThemeTestUI::Root/VNotification[0]</td>
+       <td>66,9</td>
+</tr>
+<!--
+<tr>
+       <td>closeNotification</td>
+       <td>//body/div[2]</td>
+       <td>0,0</td>
+</tr>
+-->
+
+</tbody></table>
+</body>
+</html>