From e007f059b28f686109705ad1972cfdb6adc7ec43 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 14 Jul 2015 19:33:49 +0300 Subject: Use correct classname for ValoTheme.SCROLL_INDICATOR (#14802) Use constants in Valo tests to ensure they are correct Change-Id: Ie8234a45a6f81551cdc4de2e81141aba704f4b6b --- .../com/vaadin/tests/themes/valo/Accordions.java | 5 +- .../tests/themes/valo/AlignTopIconInButton.java | 3 +- .../vaadin/tests/themes/valo/ButtonsAndLinks.java | 47 ++++++------- .../com/vaadin/tests/themes/valo/CalendarTest.java | 10 +-- .../com/vaadin/tests/themes/valo/CheckBoxes.java | 25 +++---- .../com/vaadin/tests/themes/valo/ColorPickers.java | 5 +- .../com/vaadin/tests/themes/valo/ComboBoxes.java | 19 +++--- .../com/vaadin/tests/themes/valo/CommonParts.java | 79 +++++++++++----------- .../com/vaadin/tests/themes/valo/DateFields.java | 19 +++--- .../src/com/vaadin/tests/themes/valo/Dragging.java | 15 ++-- uitest/src/com/vaadin/tests/themes/valo/Forms.java | 31 +++++---- .../src/com/vaadin/tests/themes/valo/Labels.java | 27 ++++---- .../src/com/vaadin/tests/themes/valo/MenuBars.java | 31 +++++---- .../vaadin/tests/themes/valo/NativeSelects.java | 5 +- .../tests/themes/valo/NotificationStyleTest.java | 4 +- .../src/com/vaadin/tests/themes/valo/Panels.java | 29 ++++---- .../com/vaadin/tests/themes/valo/PopupViews.java | 5 +- .../src/com/vaadin/tests/themes/valo/Sliders.java | 15 ++-- .../com/vaadin/tests/themes/valo/SplitPanels.java | 9 +-- .../src/com/vaadin/tests/themes/valo/Tables.java | 51 +++++++------- .../com/vaadin/tests/themes/valo/Tabsheets.java | 9 +-- .../com/vaadin/tests/themes/valo/TextFields.java | 73 ++++++++++---------- uitest/src/com/vaadin/tests/themes/valo/Trees.java | 5 +- .../vaadin/tests/themes/valo/ValoMenuLayout.java | 5 +- .../com/vaadin/tests/themes/valo/ValoThemeUI.java | 26 +++---- 25 files changed, 288 insertions(+), 264 deletions(-) (limited to 'uitest/src') diff --git a/uitest/src/com/vaadin/tests/themes/valo/Accordions.java b/uitest/src/com/vaadin/tests/themes/valo/Accordions.java index c32be01d8d..3c7ad2ad33 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/Accordions.java +++ b/uitest/src/com/vaadin/tests/themes/valo/Accordions.java @@ -21,13 +21,14 @@ import com.vaadin.ui.Accordion; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.ValoTheme; public class Accordions extends VerticalLayout implements View { public Accordions() { setMargin(true); Label h1 = new Label("Accordions"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); @@ -38,7 +39,7 @@ public class Accordions extends VerticalLayout implements View { row.addComponent(getAccordion("Normal")); Accordion ac = getAccordion("Borderless"); - ac.addStyleName("borderless"); + ac.addStyleName(ValoTheme.ACCORDION_BORDERLESS); row.addComponent(ac); } diff --git a/uitest/src/com/vaadin/tests/themes/valo/AlignTopIconInButton.java b/uitest/src/com/vaadin/tests/themes/valo/AlignTopIconInButton.java index dc257fb3ec..eb4be8e0d8 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/AlignTopIconInButton.java +++ b/uitest/src/com/vaadin/tests/themes/valo/AlignTopIconInButton.java @@ -20,6 +20,7 @@ import com.vaadin.server.ThemeResource; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.Button; +import com.vaadin.ui.themes.ValoTheme; /** * Test UI for image icon in button with 'icon-align-top' style. @@ -34,7 +35,7 @@ public class AlignTopIconInButton extends AbstractTestUI { Button button = new Button(); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); addComponent(button); - button.addStyleName("icon-align-top"); + button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); button.setCaption("caption"); } diff --git a/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java b/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java index 9ed48896eb..ee88595ba7 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java +++ b/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java @@ -25,6 +25,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.Link; import com.vaadin.ui.NativeButton; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.ValoTheme; /** * @@ -39,11 +40,11 @@ public class ButtonsAndLinks extends VerticalLayout implements View { setMargin(true); Label h1 = new Label("Buttons"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); - row.addStyleName("wrapping"); + row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); addComponent(row); @@ -55,30 +56,30 @@ public class ButtonsAndLinks extends VerticalLayout implements View { row.addComponent(button); button = new Button("Primary"); - button.addStyleName("primary"); + button.addStyleName(ValoTheme.BUTTON_PRIMARY); row.addComponent(button); button = new Button("Friendly"); - button.addStyleName("friendly"); + button.addStyleName(ValoTheme.BUTTON_FRIENDLY); row.addComponent(button); button = new Button("Danger"); - button.addStyleName("danger"); + button.addStyleName(ValoTheme.BUTTON_DANGER); row.addComponent(button); TestIcon testIcon = new TestIcon(10); button = new Button("Small"); - button.addStyleName("small"); + button.addStyleName(ValoTheme.BUTTON_SMALL); button.setIcon(testIcon.get()); row.addComponent(button); button = new Button("Large"); - button.addStyleName("large"); + button.addStyleName(ValoTheme.BUTTON_LARGE); button.setIcon(testIcon.get()); row.addComponent(button); button = new Button("Top"); - button.addStyleName("icon-align-top"); + button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); button.setIcon(testIcon.get()); row.addComponent(button); @@ -87,7 +88,7 @@ public class ButtonsAndLinks extends VerticalLayout implements View { row.addComponent(button); button = new Button("Image icon"); - button.addStyleName("icon-align-right"); + button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_RIGHT); button.setIcon(testIcon.get(true)); row.addComponent(button); @@ -97,36 +98,36 @@ public class ButtonsAndLinks extends VerticalLayout implements View { button = new Button(); button.setIcon(testIcon.get()); - button.addStyleName("icon-only"); + button.addStyleName(ValoTheme.BUTTON_ICON_ONLY); row.addComponent(button); button = new Button("Borderless"); button.setIcon(testIcon.get()); - button.addStyleName("borderless"); + button.addStyleName(ValoTheme.BUTTON_BORDERLESS); row.addComponent(button); button = new Button("Borderless, colored"); button.setIcon(testIcon.get()); - button.addStyleName("borderless-colored"); + button.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); row.addComponent(button); button = new Button("Quiet"); button.setIcon(testIcon.get()); - button.addStyleName("quiet"); + button.addStyleName(ValoTheme.BUTTON_QUIET); row.addComponent(button); button = new Button("Link style"); button.setIcon(testIcon.get()); - button.addStyleName("link"); + button.addStyleName(ValoTheme.BUTTON_LINK); row.addComponent(button); button = new Button("Icon on right"); button.setIcon(testIcon.get()); - button.addStyleName("icon-align-right"); + button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_RIGHT); row.addComponent(button); CssLayout group = new CssLayout(); - group.addStyleName("v-component-group"); + group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); row.addComponent(group); button = new Button("One"); @@ -137,22 +138,22 @@ public class ButtonsAndLinks extends VerticalLayout implements View { group.addComponent(button); button = new Button("Tiny"); - button.addStyleName("tiny"); + button.addStyleName(ValoTheme.BUTTON_TINY); row.addComponent(button); button = new Button("Huge"); - button.addStyleName("huge"); + button.addStyleName(ValoTheme.BUTTON_HUGE); row.addComponent(button); NativeButton nbutton = new NativeButton("Native"); row.addComponent(nbutton); h1 = new Label("Links"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); row = new HorizontalLayout(); - row.addStyleName("wrapping"); + row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); addComponent(row); @@ -167,16 +168,16 @@ public class ButtonsAndLinks extends VerticalLayout implements View { row.addComponent(link); link = new Link("Small", new ExternalResource("https://vaadin.com")); - link.addStyleName("small"); + link.addStyleName(ValoTheme.LINK_SMALL); row.addComponent(link); link = new Link("Large", new ExternalResource("https://vaadin.com")); - link.addStyleName("large"); + link.addStyleName(ValoTheme.LINK_LARGE); row.addComponent(link); link = new Link(null, new ExternalResource("https://vaadin.com")); link.setIcon(testIcon.get()); - link.addStyleName("large"); + link.addStyleName(ValoTheme.LINK_LARGE); row.addComponent(link); link = new Link("Disabled", new ExternalResource("https://vaadin.com")); diff --git a/uitest/src/com/vaadin/tests/themes/valo/CalendarTest.java b/uitest/src/com/vaadin/tests/themes/valo/CalendarTest.java index 280ddf98b7..e18665f2fa 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/CalendarTest.java +++ b/uitest/src/com/vaadin/tests/themes/valo/CalendarTest.java @@ -286,7 +286,7 @@ public class CalendarTest extends GridLayout implements View { hl.addComponent(captionLabel); CssLayout group = new CssLayout(); - group.addStyleName("v-component-group"); + group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); group.addComponent(dayButton); group.addComponent(weekButton); group.addComponent(monthButton); @@ -922,7 +922,7 @@ public class CalendarTest extends GridLayout implements View { scheduleEventPopup.setModal(true); scheduleEventPopup.center(); - scheduleEventFieldLayout.addStyleName("light"); + scheduleEventFieldLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); scheduleEventFieldLayout.setMargin(false); layout.addComponent(scheduleEventFieldLayout); @@ -939,7 +939,7 @@ public class CalendarTest extends GridLayout implements View { } } }); - applyEventButton.addStyleName("primary"); + applyEventButton.addStyleName(ValoTheme.BUTTON_PRIMARY); Button cancel = new Button("Cancel", new ClickListener() { private static final long serialVersionUID = 1L; @@ -958,7 +958,7 @@ public class CalendarTest extends GridLayout implements View { deleteCalendarEvent(); } }); - deleteEventButton.addStyleName("borderless"); + deleteEventButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); scheduleEventPopup.addCloseListener(new Window.CloseListener() { private static final long serialVersionUID = 1L; @@ -970,7 +970,7 @@ public class CalendarTest extends GridLayout implements View { }); HorizontalLayout buttons = new HorizontalLayout(); - buttons.addStyleName("v-window-bottom-toolbar"); + buttons.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); buttons.setWidth("100%"); buttons.setSpacing(true); buttons.addComponent(deleteEventButton); diff --git a/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java b/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java index 9a889b3bda..f77cf9a315 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java +++ b/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java @@ -23,17 +23,18 @@ import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.OptionGroup; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.ValoTheme; public class CheckBoxes extends VerticalLayout implements View { public CheckBoxes() { setMargin(true); Label h1 = new Label("Check Boxes"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); - row.addStyleName("wrapping"); + row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); addComponent(row); @@ -72,11 +73,11 @@ public class CheckBoxes extends VerticalLayout implements View { row.addComponent(check); check = new CheckBox("Small", true); - check.addStyleName("small"); + check.addStyleName(ValoTheme.CHECKBOX_SMALL); row.addComponent(check); check = new CheckBox("Large", true); - check.addStyleName("large"); + check.addStyleName(ValoTheme.CHECKBOX_LARGE); row.addComponent(check); check = new CheckBox("Disabled", true); @@ -90,11 +91,11 @@ public class CheckBoxes extends VerticalLayout implements View { row.addComponent(check); h1 = new Label("Option Groups"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); row = new HorizontalLayout(); - row.addStyleName("wrapping"); + row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); addComponent(row); @@ -124,7 +125,7 @@ public class CheckBoxes extends VerticalLayout implements View { row.addComponent(options); options = new OptionGroup("Choose one, small"); - options.addStyleName("small"); + options.addStyleName(ValoTheme.OPTIONGROUP_SMALL); options.setMultiSelect(false); options.addItem("Option One"); options.addItem("Option Two"); @@ -136,7 +137,7 @@ public class CheckBoxes extends VerticalLayout implements View { row.addComponent(options); options = new OptionGroup("Choose many, small"); - options.addStyleName("small"); + options.addStyleName(ValoTheme.OPTIONGROUP_SMALL); options.setMultiSelect(true); options.addItem("Option One"); options.addItem("Option Two"); @@ -148,7 +149,7 @@ public class CheckBoxes extends VerticalLayout implements View { row.addComponent(options); options = new OptionGroup("Choose one, large"); - options.addStyleName("large"); + options.addStyleName(ValoTheme.OPTIONGROUP_LARGE); options.setMultiSelect(false); options.addItem("Option One"); options.addItem("Option Two"); @@ -160,7 +161,7 @@ public class CheckBoxes extends VerticalLayout implements View { row.addComponent(options); options = new OptionGroup("Choose many, large"); - options.addStyleName("large"); + options.addStyleName(ValoTheme.OPTIONGROUP_LARGE); options.setMultiSelect(true); options.addItem("Option One"); options.addItem("Option Two"); @@ -172,7 +173,7 @@ public class CheckBoxes extends VerticalLayout implements View { row.addComponent(options); options = new OptionGroup("Horizontal items"); - options.addStyleName("horizontal"); + options.addStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL); options.addItem("Option One"); two = options.addItem("Option Two, with a longer caption"); options.addItem("Option Three"); @@ -185,7 +186,7 @@ public class CheckBoxes extends VerticalLayout implements View { options = new OptionGroup("Horizontal items, explicit width"); options.setMultiSelect(true); options.setWidth("500px"); - options.addStyleName("horizontal"); + options.addStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL); options.addItem("Option One"); two = options.addItem("Option Two, with a longer caption"); options.addItem("Option Three"); diff --git a/uitest/src/com/vaadin/tests/themes/valo/ColorPickers.java b/uitest/src/com/vaadin/tests/themes/valo/ColorPickers.java index a7fd60ea51..8e32b07ebd 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/ColorPickers.java +++ b/uitest/src/com/vaadin/tests/themes/valo/ColorPickers.java @@ -23,17 +23,18 @@ import com.vaadin.ui.ColorPicker; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.ValoTheme; public class ColorPickers extends VerticalLayout implements View { public ColorPickers() { setMargin(true); Label h1 = new Label("Color Pickers"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); - row.addStyleName("wrapping"); + row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); addComponent(row); diff --git a/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java b/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java index 98a9cad83c..4a88d87cd2 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java +++ b/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java @@ -25,17 +25,18 @@ import com.vaadin.ui.CssLayout; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.ValoTheme; public class ComboBoxes extends VerticalLayout implements View { public ComboBoxes() { setMargin(true); Label h1 = new Label("Combo Boxes"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); - row.addStyleName("wrapping"); + row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); addComponent(row); @@ -52,7 +53,7 @@ public class ComboBoxes extends VerticalLayout implements View { CssLayout group = new CssLayout(); group.setCaption("Grouped with a Button"); - group.addStyleName("v-component-group"); + group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); row.addComponent(group); combo = new ComboBox(); @@ -104,7 +105,7 @@ public class ComboBoxes extends VerticalLayout implements View { combo.setNullSelectionAllowed(false); combo.select("Option One"); combo.setComponentError(new UserError("Fix it, now!")); - combo.addStyleName("borderless"); + combo.addStyleName(ValoTheme.COMBOBOX_BORDERLESS); row.addComponent(combo); combo = new ComboBox("Disabled"); @@ -144,7 +145,7 @@ public class ComboBoxes extends VerticalLayout implements View { combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); - combo.addStyleName("small"); + combo.addStyleName(ValoTheme.COMBOBOX_SMALL); row.addComponent(combo); combo = new ComboBox("Large"); @@ -152,7 +153,7 @@ public class ComboBoxes extends VerticalLayout implements View { combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); - combo.addStyleName("large"); + combo.addStyleName(ValoTheme.COMBOBOX_LARGE); row.addComponent(combo); combo = new ComboBox("Borderless"); @@ -160,7 +161,7 @@ public class ComboBoxes extends VerticalLayout implements View { combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); - combo.addStyleName("borderless"); + combo.addStyleName(ValoTheme.COMBOBOX_BORDERLESS); row.addComponent(combo); combo = new ComboBox("Tiny"); @@ -168,7 +169,7 @@ public class ComboBoxes extends VerticalLayout implements View { combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); - combo.addStyleName("tiny"); + combo.addStyleName(ValoTheme.COMBOBOX_TINY); row.addComponent(combo); combo = new ComboBox("Huge"); @@ -176,7 +177,7 @@ public class ComboBoxes extends VerticalLayout implements View { combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); - combo.addStyleName("huge"); + combo.addStyleName(ValoTheme.COMBOBOX_HUGE); row.addComponent(combo); } diff --git a/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java b/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java index 52cc43ac28..ea7c42ba2e 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java +++ b/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java @@ -51,13 +51,14 @@ import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.Window; import com.vaadin.ui.Window.CloseEvent; import com.vaadin.ui.Window.CloseListener; +import com.vaadin.ui.themes.ValoTheme; public class CommonParts extends VerticalLayout implements View { public CommonParts() { setMargin(true); Label h1 = new Label("Common UI Elements"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); GridLayout row = new GridLayout(2, 3); @@ -83,7 +84,7 @@ public class CommonParts extends VerticalLayout implements View { CssLayout group = new CssLayout(); group.setCaption("Show the loading indicator for…"); - group.addStyleName("v-component-group"); + group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); content.addComponent(group); Button loading = new Button("0.8"); loading.addClickListener(new ClickListener() { @@ -127,13 +128,13 @@ public class CommonParts extends VerticalLayout implements View { Label spinnerDesc = new Label( "The theme also provides a mixin that you can use to include a spinner anywhere in your application. Below is a Label with a custom style name, for which the spinner mixin is added."); - spinnerDesc.addStyleName("small"); + spinnerDesc.addStyleName(ValoTheme.LABEL_SMALL); spinnerDesc.setCaption("Spinner"); content.addComponent(spinnerDesc); if (!ValoThemeUI.isTestMode()) { Label spinner = new Label(); - spinner.addStyleName("spinner"); + spinner.addStyleName(ValoTheme.LABEL_SPINNER); content.addComponent(spinner); } @@ -172,7 +173,7 @@ public class CommonParts extends VerticalLayout implements View { addComponent(title); description.setInputPrompt("Description for the notification"); - description.addStyleName("small"); + description.addStyleName(ValoTheme.TEXTAREA_SMALL); description.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { @@ -217,7 +218,7 @@ public class CommonParts extends VerticalLayout implements View { type.addItem("Error", typeCommand).setCheckable(true); type.addItem("System", typeCommand).setCheckable(true); addComponent(type); - type.addStyleName("small"); + type.addStyleName(ValoTheme.MENUBAR_SMALL); Command styleCommand = new Command() { @Override @@ -249,16 +250,16 @@ public class CommonParts extends VerticalLayout implements View { style.addItem("Small", styleCommand).setCheckable(true); style.addItem("Closable", styleCommand).setCheckable(true); addComponent(style); - style.addStyleName("small"); + style.addStyleName(ValoTheme.MENUBAR_SMALL); CssLayout group = new CssLayout(); group.setCaption("Fade delay"); - group.addStyleName("v-component-group"); + group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); addComponent(group); delay.setInputPrompt("Infinite"); - delay.addStyleName("align-right"); - delay.addStyleName("small"); + delay.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); + delay.addStyleName(ValoTheme.TEXTFIELD_SMALL); delay.setWidth("7em"); delay.addValueChangeListener(new ValueChangeListener() { @Override @@ -284,8 +285,8 @@ public class CommonParts extends VerticalLayout implements View { }); clear.setIcon(FontAwesome.TIMES_CIRCLE); clear.addStyleName("last"); - clear.addStyleName("small"); - clear.addStyleName("icon-only"); + clear.addStyleName(ValoTheme.BUTTON_SMALL); + clear.addStyleName(ValoTheme.BUTTON_ICON_ONLY); group.addComponent(clear); group.addComponent(new Label("  msec", ContentMode.HTML)); @@ -301,7 +302,7 @@ public class CommonParts extends VerticalLayout implements View { notification.show(Page.getCurrent()); } }); - pos.addStyleName("small"); + pos.addStyleName(ValoTheme.BUTTON_SMALL); grid.addComponent(pos); pos = new Button("", new ClickListener() { @@ -311,7 +312,7 @@ public class CommonParts extends VerticalLayout implements View { notification.show(Page.getCurrent()); } }); - pos.addStyleName("small"); + pos.addStyleName(ValoTheme.BUTTON_SMALL); grid.addComponent(pos); pos = new Button("", new ClickListener() { @@ -321,7 +322,7 @@ public class CommonParts extends VerticalLayout implements View { notification.show(Page.getCurrent()); } }); - pos.addStyleName("small"); + pos.addStyleName(ValoTheme.BUTTON_SMALL); grid.addComponent(pos); pos = new Button("", new ClickListener() { @@ -331,7 +332,7 @@ public class CommonParts extends VerticalLayout implements View { notification.show(Page.getCurrent()); } }); - pos.addStyleName("small"); + pos.addStyleName(ValoTheme.BUTTON_SMALL); grid.addComponent(pos); pos = new Button("", new ClickListener() { @@ -341,7 +342,7 @@ public class CommonParts extends VerticalLayout implements View { notification.show(Page.getCurrent()); } }); - pos.addStyleName("small"); + pos.addStyleName(ValoTheme.BUTTON_SMALL); grid.addComponent(pos); pos = new Button("", new ClickListener() { @@ -351,7 +352,7 @@ public class CommonParts extends VerticalLayout implements View { notification.show(Page.getCurrent()); } }); - pos.addStyleName("small"); + pos.addStyleName(ValoTheme.BUTTON_SMALL); grid.addComponent(pos); pos = new Button("", new ClickListener() { @@ -361,7 +362,7 @@ public class CommonParts extends VerticalLayout implements View { notification.show(Page.getCurrent()); } }); - pos.addStyleName("small"); + pos.addStyleName(ValoTheme.BUTTON_SMALL); grid.addComponent(pos); pos = new Button("", new ClickListener() { @@ -371,7 +372,7 @@ public class CommonParts extends VerticalLayout implements View { notification.show(Page.getCurrent()); } }); - pos.addStyleName("small"); + pos.addStyleName(ValoTheme.BUTTON_SMALL); grid.addComponent(pos); pos = new Button("", new ClickListener() { @@ -381,7 +382,7 @@ public class CommonParts extends VerticalLayout implements View { notification.show(Page.getCurrent()); } }); - pos.addStyleName("small"); + pos.addStyleName(ValoTheme.BUTTON_SMALL); grid.addComponent(pos); } @@ -397,35 +398,35 @@ public class CommonParts extends VerticalLayout implements View { { setSpacing(true); setMargin(true); - addStyleName("wrapping"); + addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); addComponent(new Label( "Try out different tooltips/descriptions by hovering over the labels.")); Label label = new Label("Simple"); - label.addStyleName("bold"); + label.addStyleName(ValoTheme.LABEL_BOLD); label.setDescription("Simple tooltip message"); addComponent(label); label = new Label("Long"); - label.addStyleName("bold"); + label.addStyleName(ValoTheme.LABEL_BOLD); label.setDescription("Long tooltip message. Inmensae subtilitatis, obscuris et malesuada fames. Salutantibus vitae elit libero, a pharetra augue."); addComponent(label); label = new Label("HTML tooltip"); - label.addStyleName("bold"); + label.addStyleName(ValoTheme.LABEL_BOLD); label.setDescription("

Ut enim ad minim veniam, quis nostrud exercitation

Morbi fringilla convallis sapien, id pulvinar odio volutpat. Vivamus sagittis lacus vel augue laoreet rutrum faucibus. Donec sed odio operae, eu vulputate felis rhoncus. At nos hinc posthac, sitientis piros Afros. Tu quoque, Brute, fili mi, nihil timor populi, nihil!

Gallia est omnis divisa in partes tres, quarum. Praeterea iter est quasdam res quas ex communi. Cum ceteris in veneratione tui montes, nascetur mus. Quam temere in vitiis, legem sancimus haerentia. Idque Caesaris facere voluntate liceret: sese habere.

"); addComponent(label); label = new Label("With an error message"); - label.addStyleName("bold"); + label.addStyleName(ValoTheme.LABEL_BOLD); label.setDescription("Simple tooltip message"); label.setComponentError(new UserError( "Something terrible has happened")); addComponent(label); label = new Label("With a long error message"); - label.addStyleName("bold"); + label.addStyleName(ValoTheme.LABEL_BOLD); label.setDescription("Simple tooltip message"); label.setComponentError(new UserError( "

Contra legem facit qui id facit quod lex prohibet Tityre, tu patulae recubans sub tegmine fagi dolor. Tityre, tu patulae recubans sub tegmine fagi dolor. Prima luce, cum quibus mons aliud consensu ab eo. Quid securi etiam tamquam eu fugiat nulla pariatur. Fabio vel iudice vincam, sunt in culpa qui officia. Nihil hic munitissimus habendi senatus locus, nihil horum?

Plura mihi bona sunt, inclinet, amari petere vellent. Integer legentibus erat a ante historiarum dapibus. Quam diu etiam furor iste tuus nos eludet? Nec dubitamus multa iter quae et nos invenerat. Quisque ut dolor gravida, placerat libero vel, euismod. Quae vero auctorem tractata ab fiducia dicuntur.

", @@ -434,7 +435,7 @@ public class CommonParts extends VerticalLayout implements View { addComponent(label); label = new Label("Error message only"); - label.addStyleName("bold"); + label.addStyleName(ValoTheme.LABEL_BOLD); label.setComponentError(new UserError( "Something terrible has happened")); addComponent(label); @@ -479,7 +480,7 @@ public class CommonParts extends VerticalLayout implements View { Alignment.TOP_RIGHT); toolbar = toolbarLayout; } - toolbar.addStyleName("v-window-top-toolbar"); + toolbar.addStyleName(ValoTheme.WINDOW_TOP_TOOLBAR); root.addComponent(toolbar); } @@ -498,7 +499,7 @@ public class CommonParts extends VerticalLayout implements View { "Another"); tabs.addTab(new Label(" ", ContentMode.HTML), "One more"); - tabs.addStyleName("padded-tabbar"); + tabs.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR); tabs.addSelectedTabChangeListener(new SelectedTabChangeListener() { @Override public void selectedTabChange( @@ -514,9 +515,9 @@ public class CommonParts extends VerticalLayout implements View { } else if (!autoHeight) { Panel p = new Panel(); p.setSizeFull(); - p.addStyleName("borderless"); + p.addStyleName(ValoTheme.PANEL_BORDERLESS); if (!toolbarVisible || !toolbarLayout) { - p.addStyleName("scroll-divider"); + p.addStyleName(ValoTheme.PANEL_SCROLL_INDICATOR); } VerticalLayout l = new VerticalLayout(); l.addComponent(new Label( @@ -538,13 +539,13 @@ public class CommonParts extends VerticalLayout implements View { HorizontalLayout footer = new HorizontalLayout(); footer.setWidth("100%"); footer.setSpacing(true); - footer.addStyleName("v-window-bottom-toolbar"); + footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); Label footerText = new Label("Footer text"); footerText.setSizeUndefined(); Button ok = new Button("OK"); - ok.addStyleName("primary"); + ok.addStyleName(ValoTheme.BUTTON_PRIMARY); Button cancel = new Button("Cancel"); @@ -614,7 +615,7 @@ public class CommonParts extends VerticalLayout implements View { if (selectedItem.getText() .equals("Borderless Toolbars")) { - toolbarStyle = selectedItem.isChecked() ? "borderless" + toolbarStyle = selectedItem.isChecked() ? ValoTheme.MENUBAR_BORDERLESS : null; } @@ -630,7 +631,7 @@ public class CommonParts extends VerticalLayout implements View { MenuItem option = options.addItem("Footer", optionsCommand); option.setCheckable(true); option.setChecked(true); - options.addStyleName("small"); + options.addStyleName(ValoTheme.MENUBAR_SMALL); addComponent(options); options = new MenuBar(); @@ -643,7 +644,7 @@ public class CommonParts extends VerticalLayout implements View { .setCheckable(true); options.addItem("Borderless Toolbars", optionsCommand) .setCheckable(true); - options.addStyleName("small"); + options.addStyleName(ValoTheme.MENUBAR_SMALL); addComponent(options); Command optionsCommand2 = new Command() { @@ -671,7 +672,7 @@ public class CommonParts extends VerticalLayout implements View { options.addItem("Resizable", optionsCommand2) .setCheckable(true); options.addItem("Modal", optionsCommand2).setCheckable(true); - options.addStyleName("small"); + options.addStyleName(ValoTheme.MENUBAR_SMALL); addComponent(options); final Button show = new Button("Open Window", @@ -684,7 +685,7 @@ public class CommonParts extends VerticalLayout implements View { event.getButton().setEnabled(false); } }); - show.addStyleName("primary"); + show.addStyleName(ValoTheme.BUTTON_PRIMARY); addComponent(show); final CheckBox hidden = new CheckBox("Hidden"); diff --git a/uitest/src/com/vaadin/tests/themes/valo/DateFields.java b/uitest/src/com/vaadin/tests/themes/valo/DateFields.java index 4b29f83621..9c95b7400c 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/DateFields.java +++ b/uitest/src/com/vaadin/tests/themes/valo/DateFields.java @@ -35,17 +35,18 @@ import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.InlineDateField; import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.ValoTheme; public class DateFields extends VerticalLayout implements View { public DateFields() { setMargin(true); Label h1 = new Label("Date Fields"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); - row.addStyleName("wrapping"); + row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); addComponent(row); @@ -61,12 +62,12 @@ public class DateFields extends VerticalLayout implements View { date = new DateField("Error, borderless"); setDate(date); date.setComponentError(new UserError("Fix it, now!")); - date.addStyleName("borderless"); + date.addStyleName(ValoTheme.DATEFIELD_BORDERLESS); row.addComponent(date); CssLayout group = new CssLayout(); group.setCaption("Grouped with a Button"); - group.addStyleName("v-component-group"); + group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); row.addComponent(group); final DateField date2 = new DateField(); @@ -143,19 +144,19 @@ public class DateFields extends VerticalLayout implements View { date = new DateField("Small"); setDate(date); date.setResolution(Resolution.DAY); - date.addStyleName("small"); + date.addStyleName(ValoTheme.DATEFIELD_SMALL); row.addComponent(date); date = new DateField("Large"); setDate(date); date.setResolution(Resolution.DAY); - date.addStyleName("large"); + date.addStyleName(ValoTheme.DATEFIELD_LARGE); row.addComponent(date); date = new DateField("Borderless"); setDate(date); date.setResolution(Resolution.DAY); - date.addStyleName("borderless"); + date.addStyleName(ValoTheme.DATEFIELD_BORDERLESS); row.addComponent(date); date = new DateField("Week numbers"); @@ -179,13 +180,13 @@ public class DateFields extends VerticalLayout implements View { date = new DateField("Tiny"); setDate(date); date.setResolution(Resolution.DAY); - date.addStyleName("tiny"); + date.addStyleName(ValoTheme.DATEFIELD_TINY); row.addComponent(date); date = new DateField("Huge"); setDate(date); date.setResolution(Resolution.DAY); - date.addStyleName("huge"); + date.addStyleName(ValoTheme.DATEFIELD_HUGE); row.addComponent(date); date = new InlineDateField("Date picker"); diff --git a/uitest/src/com/vaadin/tests/themes/valo/Dragging.java b/uitest/src/com/vaadin/tests/themes/valo/Dragging.java index 27bdea7d8a..8de518be23 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/Dragging.java +++ b/uitest/src/com/vaadin/tests/themes/valo/Dragging.java @@ -46,6 +46,7 @@ import com.vaadin.ui.MenuBar; import com.vaadin.ui.MenuBar.MenuItem; import com.vaadin.ui.Notification; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.ValoTheme; /** * @@ -61,7 +62,7 @@ public class Dragging extends VerticalLayout implements View { setSpacing(true); Label h1 = new Label("Dragging Components"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); MenuBar options = new MenuBar(); @@ -74,9 +75,9 @@ public class Dragging extends VerticalLayout implements View { @Override public void menuSelected(MenuItem selectedItem) { if (selectedItem.isChecked()) { - sample.removeStyleName("no-vertical-drag-hints"); + sample.removeStyleName(ValoTheme.DRAG_AND_DROP_WRAPPER_NO_VERTICAL_DRAG_HINTS); } else { - sample.addStyleName("no-vertical-drag-hints"); + sample.addStyleName(ValoTheme.DRAG_AND_DROP_WRAPPER_NO_VERTICAL_DRAG_HINTS); } } }); @@ -87,9 +88,9 @@ public class Dragging extends VerticalLayout implements View { @Override public void menuSelected(MenuItem selectedItem) { if (selectedItem.isChecked()) { - sample.removeStyleName("no-horizontal-drag-hints"); + sample.removeStyleName(ValoTheme.DRAG_AND_DROP_WRAPPER_NO_HORIZONTAL_DRAG_HINTS); } else { - sample.addStyleName("no-horizontal-drag-hints"); + sample.addStyleName(ValoTheme.DRAG_AND_DROP_WRAPPER_NO_HORIZONTAL_DRAG_HINTS); } } }); @@ -100,9 +101,9 @@ public class Dragging extends VerticalLayout implements View { @Override public void menuSelected(MenuItem selectedItem) { if (selectedItem.isChecked()) { - sample.removeStyleName("no-box-drag-hints"); + sample.removeStyleName(ValoTheme.DRAG_AND_DROP_WRAPPER_NO_BOX_DRAG_HINTS); } else { - sample.addStyleName("no-box-drag-hints"); + sample.addStyleName(ValoTheme.DRAG_AND_DROP_WRAPPER_NO_BOX_DRAG_HINTS); } } }); diff --git a/uitest/src/com/vaadin/tests/themes/valo/Forms.java b/uitest/src/com/vaadin/tests/themes/valo/Forms.java index 90a6c51496..91fe473d60 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/Forms.java +++ b/uitest/src/com/vaadin/tests/themes/valo/Forms.java @@ -36,6 +36,7 @@ import com.vaadin.ui.RichTextArea; import com.vaadin.ui.TextArea; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.ValoTheme; /** * @@ -48,18 +49,18 @@ public class Forms extends VerticalLayout implements View { setMargin(true); Label title = new Label("Forms"); - title.addStyleName("h1"); + title.addStyleName(ValoTheme.LABEL_H1); addComponent(title); final FormLayout form = new FormLayout(); form.setMargin(false); form.setWidth("800px"); - form.addStyleName("light"); + form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); addComponent(form); Label section = new Label("Personal Info"); - section.addStyleName("h2"); - section.addStyleName("colored"); + section.addStyleName(ValoTheme.LABEL_H2); + section.addStyleName(ValoTheme.LABEL_COLORED); form.addComponent(section); StringGenerator sg = new StringGenerator(); @@ -81,12 +82,12 @@ public class Forms extends VerticalLayout implements View { sex.addItem("Female"); sex.addItem("Male"); sex.select("Male"); - sex.addStyleName("horizontal"); + sex.addStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL); form.addComponent(sex); section = new Label("Contact Info"); - section.addStyleName("h3"); - section.addStyleName("colored"); + section.addStyleName(ValoTheme.LABEL_H3); + section.addStyleName(ValoTheme.LABEL_COLORED); form.addComponent(section); TextField email = new TextField("Email"); @@ -120,14 +121,14 @@ public class Forms extends VerticalLayout implements View { period.addItem("Montly"); period.setNullSelectionAllowed(false); period.select("Weekly"); - period.addStyleName("small"); + period.addStyleName(ValoTheme.COMBOBOX_SMALL); period.setWidth("10em"); wrap.addComponent(period); form.addComponent(wrap); section = new Label("Additional Info"); - section.addStyleName("h4"); - section.addStyleName("colored"); + section.addStyleName(ValoTheme.LABEL_H4); + section.addStyleName(ValoTheme.LABEL_COLORED); form.addComponent(section); TextField website = new TextField("Website"); @@ -156,15 +157,15 @@ public class Forms extends VerticalLayout implements View { if (readOnly) { bio.setReadOnly(false); form.setReadOnly(false); - form.removeStyleName("light"); + form.removeStyleName(ValoTheme.FORMLAYOUT_LIGHT); event.getButton().setCaption("Save"); - event.getButton().addStyleName("primary"); + event.getButton().addStyleName(ValoTheme.BUTTON_PRIMARY); } else { bio.setReadOnly(true); form.setReadOnly(true); - form.addStyleName("light"); + form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); event.getButton().setCaption("Edit"); - event.getButton().removeStyleName("primary"); + event.getButton().removeStyleName(ValoTheme.BUTTON_PRIMARY); } } }); @@ -177,7 +178,7 @@ public class Forms extends VerticalLayout implements View { footer.addComponent(edit); Label lastModified = new Label("Last modified by you a minute ago"); - lastModified.addStyleName("light"); + lastModified.addStyleName(ValoTheme.LABEL_LIGHT); footer.addComponent(lastModified); } diff --git a/uitest/src/com/vaadin/tests/themes/valo/Labels.java b/uitest/src/com/vaadin/tests/themes/valo/Labels.java index b5bab3a1d3..9954979d50 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/Labels.java +++ b/uitest/src/com/vaadin/tests/themes/valo/Labels.java @@ -23,6 +23,7 @@ import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.ValoTheme; /** * @@ -34,7 +35,7 @@ public class Labels extends VerticalLayout implements View { setMargin(true); Label h1 = new Label("Labels"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout split = new HorizontalLayout(); @@ -46,16 +47,16 @@ public class Labels extends VerticalLayout implements View { split.addComponent(left); Label huge = new Label("Huge type for display text."); - huge.addStyleName("huge"); + huge.addStyleName(ValoTheme.LABEL_HUGE); left.addComponent(huge); Label large = new Label( "Large type for introductory text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); - large.addStyleName("large"); + large.addStyleName(ValoTheme.LABEL_LARGE); left.addComponent(large); Label h2 = new Label("Subtitle"); - h2.addStyleName("h2"); + h2.addStyleName(ValoTheme.LABEL_H2); left.addComponent(h2); Label normal = new Label( @@ -64,20 +65,20 @@ public class Labels extends VerticalLayout implements View { left.addComponent(normal); Label h3 = new Label("Small Title"); - h3.addStyleName("h3"); + h3.addStyleName(ValoTheme.LABEL_H3); left.addComponent(h3); Label small = new Label( "Small type for additional text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); - small.addStyleName("small"); + small.addStyleName(ValoTheme.LABEL_SMALL); left.addComponent(small); Label tiny = new Label("Tiny type for minor text."); - tiny.addStyleName("tiny"); + tiny.addStyleName(ValoTheme.LABEL_TINY); left.addComponent(tiny); Label h4 = new Label("Section Title"); - h4.addStyleName("h4"); + h4.addStyleName(ValoTheme.LABEL_H4); left.addComponent(h4); normal = new Label( @@ -94,25 +95,25 @@ public class Labels extends VerticalLayout implements View { Label label = new Label( "Bold type for prominent text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); - label.addStyleName("bold"); + label.addStyleName(ValoTheme.LABEL_BOLD); right.addComponent(label); label = new Label( "Light type for subtle text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); - label.addStyleName("light"); + label.addStyleName(ValoTheme.LABEL_LIGHT); right.addComponent(label); label = new Label( "Colored type for highlighted text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); - label.addStyleName("colored"); + label.addStyleName(ValoTheme.LABEL_COLORED); right.addComponent(label); label = new Label("A label for success"); - label.addStyleName("success"); + label.addStyleName(ValoTheme.LABEL_SUCCESS); right.addComponent(label); label = new Label("A label for failure"); - label.addStyleName("failure"); + label.addStyleName(ValoTheme.LABEL_FAILURE); right.addComponent(label); } diff --git a/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java b/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java index 4a0130931e..fc74166b29 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java +++ b/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java @@ -25,6 +25,7 @@ import com.vaadin.ui.MenuBar.Command; import com.vaadin.ui.MenuBar.MenuItem; import com.vaadin.ui.Notification; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.ValoTheme; public class MenuBars extends VerticalLayout implements View { public MenuBars() { @@ -32,7 +33,7 @@ public class MenuBars extends VerticalLayout implements View { setSpacing(true); Label h1 = new Label("Menu Bars"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); MenuBar menuBar = getMenuBar(); @@ -41,37 +42,37 @@ public class MenuBars extends VerticalLayout implements View { menuBar = getMenuBar(); menuBar.setCaption("Small style"); - menuBar.addStyleName("small"); + menuBar.addStyleName(ValoTheme.MENUBAR_SMALL); addComponent(menuBar); menuBar = getMenuBar(); menuBar.setCaption("Borderless style"); - menuBar.addStyleName("borderless"); + menuBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS); addComponent(menuBar); menuBar = getMenuBar(); menuBar.setCaption("Small borderless style"); - menuBar.addStyleName("borderless"); - menuBar.addStyleName("small"); + menuBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS); + menuBar.addStyleName(ValoTheme.MENUBAR_SMALL); addComponent(menuBar); Label h2 = new Label("Drop Down Button"); - h2.addStyleName("h2"); + h2.addStyleName(ValoTheme.LABEL_H2); addComponent(h2); HorizontalLayout wrap = new HorizontalLayout(); - wrap.addStyleName("wrapping"); + wrap.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); wrap.setSpacing(true); addComponent(wrap); wrap.addComponent(getMenuButton("Normal", false)); MenuBar split = getMenuButton("Small", false); - split.addStyleName("small"); + split.addStyleName(ValoTheme.MENUBAR_SMALL); wrap.addComponent(split); split = getMenuButton("Borderless", false); - split.addStyleName("borderless"); + split.addStyleName(ValoTheme.MENUBAR_BORDERLESS); wrap.addComponent(split); split = getMenuButton("Themed", false); @@ -80,26 +81,26 @@ public class MenuBars extends VerticalLayout implements View { split = getMenuButton("Small", false); split.addStyleName("color1"); - split.addStyleName("small"); + split.addStyleName(ValoTheme.MENUBAR_SMALL); wrap.addComponent(split); h2 = new Label("Split Button"); - h2.addStyleName("h2"); + h2.addStyleName(ValoTheme.LABEL_H2); addComponent(h2); wrap = new HorizontalLayout(); - wrap.addStyleName("wrapping"); + wrap.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); wrap.setSpacing(true); addComponent(wrap); wrap.addComponent(getMenuButton("Normal", true)); split = getMenuButton("Small", true); - split.addStyleName("small"); + split.addStyleName(ValoTheme.MENUBAR_SMALL); wrap.addComponent(split); split = getMenuButton("Borderless", true); - split.addStyleName("borderless"); + split.addStyleName(ValoTheme.MENUBAR_BORDERLESS); wrap.addComponent(split); split = getMenuButton("Themed", true); @@ -108,7 +109,7 @@ public class MenuBars extends VerticalLayout implements View { split = getMenuButton("Small", true); split.addStyleName("color1"); - split.addStyleName("small"); + split.addStyleName(ValoTheme.MENUBAR_SMALL); wrap.addComponent(split); } diff --git a/uitest/src/com/vaadin/tests/themes/valo/NativeSelects.java b/uitest/src/com/vaadin/tests/themes/valo/NativeSelects.java index 284f7c8d6e..e9c1c78049 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/NativeSelects.java +++ b/uitest/src/com/vaadin/tests/themes/valo/NativeSelects.java @@ -23,17 +23,18 @@ import com.vaadin.ui.ListSelect; import com.vaadin.ui.NativeSelect; import com.vaadin.ui.TwinColSelect; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.ValoTheme; public class NativeSelects extends VerticalLayout implements View { public NativeSelects() { setMargin(true); Label h1 = new Label("Selects"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); - row.addStyleName("wrapping"); + row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); addComponent(row); diff --git a/uitest/src/com/vaadin/tests/themes/valo/NotificationStyleTest.java b/uitest/src/com/vaadin/tests/themes/valo/NotificationStyleTest.java index 7adae9ce65..5f9542b6f3 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/NotificationStyleTest.java +++ b/uitest/src/com/vaadin/tests/themes/valo/NotificationStyleTest.java @@ -27,6 +27,7 @@ import org.openqa.selenium.support.ui.ExpectedCondition; import com.vaadin.testbench.elements.ButtonElement; import com.vaadin.tests.tb3.MultiBrowserTest; +import com.vaadin.ui.themes.ValoTheme; /** * Test for H1 and P elements styles in Notifications. @@ -45,7 +46,8 @@ public class NotificationStyleTest extends MultiBrowserTest { waitUntil(notificationPresentCondition(), 2); WebElement notification = findElement(By.className("v-Notification")); - List headers = notification.findElements(By.tagName("h1")); + List headers = notification.findElements(By + .tagName(ValoTheme.LABEL_H1)); String textAlign = headers.get(0).getCssValue("text-align"); String textAlignInnerHeader = headers.get(1).getCssValue("text-align"); Assert.assertNotEquals("Styles for notification defined h1 tag " diff --git a/uitest/src/com/vaadin/tests/themes/valo/Panels.java b/uitest/src/com/vaadin/tests/themes/valo/Panels.java index 8a17244693..d98daf7b05 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/Panels.java +++ b/uitest/src/com/vaadin/tests/themes/valo/Panels.java @@ -27,17 +27,18 @@ import com.vaadin.ui.MenuBar; import com.vaadin.ui.MenuBar.MenuItem; import com.vaadin.ui.Panel; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.ValoTheme; public class Panels extends VerticalLayout implements View { public Panels() { setMargin(true); Label h1 = new Label("Panels & Layout panels"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); - row.addStyleName("wrapping"); + row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); addComponent(row); TestIcon testIcon = new TestIcon(60); @@ -74,33 +75,33 @@ public class Panels extends VerticalLayout implements View { panel = new Panel("Borderless style"); panel.setIcon(testIcon.get()); - panel.addStyleName("borderless"); + panel.addStyleName(ValoTheme.PANEL_BORDERLESS); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Borderless + scroll divider"); panel.setIcon(testIcon.get()); - panel.addStyleName("borderless"); - panel.addStyleName("scroll-divider"); + panel.addStyleName(ValoTheme.PANEL_BORDERLESS); + panel.addStyleName(ValoTheme.PANEL_SCROLL_INDICATOR); panel.setContent(panelContentScroll()); panel.setHeight("17em"); row.addComponent(panel); panel = new Panel("Well style"); panel.setIcon(testIcon.get()); - panel.addStyleName("well"); + panel.addStyleName(ValoTheme.PANEL_WELL); panel.setContent(panelContent()); row.addComponent(panel); CssLayout layout = new CssLayout(); layout.setIcon(testIcon.get()); layout.setCaption("Panel style layout"); - layout.addStyleName("card"); + layout.addStyleName(ValoTheme.LAYOUT_CARD); layout.addComponent(panelContent()); row.addComponent(layout); layout = new CssLayout(); - layout.addStyleName("card"); + layout.addStyleName(ValoTheme.LAYOUT_CARD); row.addComponent(layout); HorizontalLayout panelCaption = new HorizontalLayout(); panelCaption.addStyleName("v-panel-caption"); @@ -112,13 +113,13 @@ public class Panels extends VerticalLayout implements View { Button action = new Button(); action.setIcon(FontAwesome.PENCIL); - action.addStyleName("borderless-colored"); - action.addStyleName("small"); - action.addStyleName("icon-only"); + action.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); + action.addStyleName(ValoTheme.BUTTON_SMALL); + action.addStyleName(ValoTheme.BUTTON_ICON_ONLY); panelCaption.addComponent(action); MenuBar dropdown = new MenuBar(); - dropdown.addStyleName("borderless"); - dropdown.addStyleName("small"); + dropdown.addStyleName(ValoTheme.MENUBAR_BORDERLESS); + dropdown.addStyleName(ValoTheme.MENUBAR_SMALL); MenuItem addItem = dropdown.addItem("", FontAwesome.CHEVRON_DOWN, null); addItem.setStyleName("icon-only"); addItem.addItem("Settings", null); @@ -134,7 +135,7 @@ public class Panels extends VerticalLayout implements View { layout = new CssLayout(); layout.setIcon(testIcon.get()); layout.setCaption("Well style layout"); - layout.addStyleName("well"); + layout.addStyleName(ValoTheme.LAYOUT_WELL); layout.addComponent(panelContent()); row.addComponent(layout); } diff --git a/uitest/src/com/vaadin/tests/themes/valo/PopupViews.java b/uitest/src/com/vaadin/tests/themes/valo/PopupViews.java index c15270400c..58988c06d6 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/PopupViews.java +++ b/uitest/src/com/vaadin/tests/themes/valo/PopupViews.java @@ -24,17 +24,18 @@ import com.vaadin.ui.Label; import com.vaadin.ui.PopupView; import com.vaadin.ui.PopupView.Content; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.ValoTheme; public class PopupViews extends VerticalLayout implements View { public PopupViews() { setMargin(true); Label h1 = new Label("Popup Views"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); - row.addStyleName("wrapping"); + row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); addComponent(row); diff --git a/uitest/src/com/vaadin/tests/themes/valo/Sliders.java b/uitest/src/com/vaadin/tests/themes/valo/Sliders.java index 8ed846e39f..9642cb5ccf 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/Sliders.java +++ b/uitest/src/com/vaadin/tests/themes/valo/Sliders.java @@ -23,17 +23,18 @@ import com.vaadin.ui.Label; import com.vaadin.ui.ProgressBar; import com.vaadin.ui.Slider; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.ValoTheme; public class Sliders extends VerticalLayout implements View { public Sliders() { setMargin(true); Label h1 = new Label("Sliders"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); - row.addStyleName("wrapping"); + row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); addComponent(row); @@ -67,7 +68,7 @@ public class Sliders extends VerticalLayout implements View { slider = new Slider("No indicator"); slider.setValue(50.0); slider.setWidth("200px"); - slider.addStyleName("no-indicator"); + slider.addStyleName(ValoTheme.SLIDER_NO_INDICATOR); row.addComponent(slider); slider = new Slider("With ticks (not in IE8 & IE9)"); @@ -119,7 +120,7 @@ public class Sliders extends VerticalLayout implements View { slider = new Slider("No indicator"); slider.setValue(50.0); slider.setHeight("200px"); - slider.addStyleName("no-indicator"); + slider.addStyleName(ValoTheme.SLIDER_NO_INDICATOR); slider.setOrientation(SliderOrientation.VERTICAL); row.addComponent(slider); @@ -137,11 +138,11 @@ public class Sliders extends VerticalLayout implements View { row.addComponent(slider); h1 = new Label("Progress Bars"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); row = new HorizontalLayout(); - row.addStyleName("wrapping"); + row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); addComponent(row); @@ -154,7 +155,7 @@ public class Sliders extends VerticalLayout implements View { pb2 = new ProgressBar(); pb2.setCaption("Point style"); pb2.setWidth("300px"); - pb2.addStyleName("point"); + pb2.addStyleName(ValoTheme.PROGRESSBAR_POINT); // pb2.setValue(0.6f); row.addComponent(pb2); diff --git a/uitest/src/com/vaadin/tests/themes/valo/SplitPanels.java b/uitest/src/com/vaadin/tests/themes/valo/SplitPanels.java index 9a6d86ae04..4983bc5813 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/SplitPanels.java +++ b/uitest/src/com/vaadin/tests/themes/valo/SplitPanels.java @@ -23,20 +23,21 @@ import com.vaadin.ui.HorizontalSplitPanel; import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.VerticalSplitPanel; +import com.vaadin.ui.themes.ValoTheme; public class SplitPanels extends VerticalLayout implements View { public SplitPanels() { setMargin(true); Label h1 = new Label("Split Panels"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); addComponent(new Label( "Outlines are just to show the areas of the SplitPanels. They are not part of the actual component style.")); HorizontalLayout row = new HorizontalLayout(); - row.addStyleName("wrapping"); + row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); row.setMargin(new MarginInfo(true, false, false, false)); addComponent(row); @@ -61,7 +62,7 @@ public class SplitPanels extends VerticalLayout implements View { sp.setCaption("Large style"); sp.setWidth("300px"); sp.setHeight("200px"); - sp.addStyleName("large"); + sp.addStyleName(ValoTheme.SPLITPANEL_LARGE); sp.setFirstComponent(getContent()); sp.setSecondComponent(getContent()); row.addComponent(sp); @@ -70,7 +71,7 @@ public class SplitPanels extends VerticalLayout implements View { sp2.setCaption("Large style"); sp2.setWidth("300px"); sp2.setHeight("200px"); - sp2.addStyleName("large"); + sp2.addStyleName(ValoTheme.SPLITPANEL_LARGE); sp2.setFirstComponent(getContent()); sp2.setSecondComponent(getContent()); row.addComponent(sp2); diff --git a/uitest/src/com/vaadin/tests/themes/valo/Tables.java b/uitest/src/com/vaadin/tests/themes/valo/Tables.java index fb6638ee7d..071e6b746a 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/Tables.java +++ b/uitest/src/com/vaadin/tests/themes/valo/Tables.java @@ -42,6 +42,7 @@ import com.vaadin.ui.Table.TableDragMode; import com.vaadin.ui.TextField; import com.vaadin.ui.TreeTable; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.ValoTheme; public class Tables extends VerticalLayout implements View { @@ -72,11 +73,11 @@ public class Tables extends VerticalLayout implements View { setSpacing(true); Label h1 = new Label("Tables"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout wrap = new HorizontalLayout(); - wrap.addStyleName("wrapping"); + wrap.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); wrap.setSpacing(true); addComponent(wrap); @@ -189,9 +190,9 @@ public class Tables extends VerticalLayout implements View { Object columnId) { TextField tf = new TextField(); tf.setInputPrompt("Type here…"); - // tf.addStyleName("compact"); + // tf.addStyleName(ValoTheme.TABLE_COMPACT); if ((Integer) itemId % 2 == 0) { - tf.addStyleName("borderless"); + tf.addStyleName(ValoTheme.TABLE_BORDERLESS); } return tf; } @@ -203,9 +204,9 @@ public class Tables extends VerticalLayout implements View { public Object generateCell(Table source, Object itemId, Object columnId) { DateField tf = new DateField(); - tf.addStyleName("compact"); + tf.addStyleName(ValoTheme.TABLE_COMPACT); if ((Integer) itemId % 2 == 0) { - tf.addStyleName("borderless"); + tf.addStyleName(ValoTheme.DATEFIELD_BORDERLESS); } return tf; } @@ -218,9 +219,9 @@ public class Tables extends VerticalLayout implements View { Object columnId) { ComboBox tf = new ComboBox(); tf.setInputPrompt("Select"); - tf.addStyleName("compact"); + tf.addStyleName(ValoTheme.TABLE_COMPACT); if ((Integer) itemId % 2 == 0) { - tf.addStyleName("borderless"); + tf.addStyleName(ValoTheme.DATEFIELD_BORDERLESS); } return tf; } @@ -232,7 +233,7 @@ public class Tables extends VerticalLayout implements View { public Object generateCell(Table source, Object itemId, Object columnId) { Button b = new Button("Button"); - b.addStyleName("small"); + b.addStyleName(ValoTheme.BUTTON_SMALL); return b; } }); @@ -244,7 +245,7 @@ public class Tables extends VerticalLayout implements View { Object columnId) { Label label = new Label("Label component"); label.setSizeUndefined(); - label.addStyleName("bold"); + label.addStyleName(ValoTheme.LABEL_BOLD); return label; } }); @@ -267,7 +268,7 @@ public class Tables extends VerticalLayout implements View { OptionGroup op = new OptionGroup(); op.addItem("Male"); op.addItem("Female"); - op.addStyleName("horizontal"); + op.addStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL); return op; } }); @@ -321,45 +322,45 @@ public class Tables extends VerticalLayout implements View { expandRatios ? 1.0f : 0); if (!stripes) { - table.addStyleName("no-stripes"); + table.addStyleName(ValoTheme.TABLE_NO_STRIPES); } else { - table.removeStyleName("no-stripes"); + table.removeStyleName(ValoTheme.TABLE_NO_STRIPES); } if (!verticalLines) { - table.addStyleName("no-vertical-lines"); + table.addStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES); } else { - table.removeStyleName("no-vertical-lines"); + table.removeStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES); } if (!horizontalLines) { - table.addStyleName("no-horizontal-lines"); + table.addStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES); } else { - table.removeStyleName("no-horizontal-lines"); + table.removeStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES); } if (borderless) { - table.addStyleName("borderless"); + table.addStyleName(ValoTheme.TABLE_BORDERLESS); } else { - table.removeStyleName("borderless"); + table.removeStyleName(ValoTheme.TABLE_BORDERLESS); } if (!headers) { - table.addStyleName("no-header"); + table.addStyleName(ValoTheme.TABLE_NO_HEADER); } else { - table.removeStyleName("no-header"); + table.removeStyleName(ValoTheme.TABLE_NO_HEADER); } if (compact) { - table.addStyleName("compact"); + table.addStyleName(ValoTheme.TABLE_COMPACT); } else { - table.removeStyleName("compact"); + table.removeStyleName(ValoTheme.TABLE_COMPACT); } if (small) { - table.addStyleName("small"); + table.addStyleName(ValoTheme.TABLE_SMALL); } else { - table.removeStyleName("small"); + table.removeStyleName(ValoTheme.TABLE_SMALL); } if (!rowIndex && !rowCaption && rowIcon) { diff --git a/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java b/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java index 5e77292471..421da5ffe7 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java +++ b/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java @@ -28,6 +28,7 @@ import com.vaadin.ui.TabSheet.SelectedTabChangeEvent; import com.vaadin.ui.TabSheet.SelectedTabChangeListener; import com.vaadin.ui.TabSheet.Tab; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.ValoTheme; public class Tabsheets extends VerticalLayout implements View { @@ -37,12 +38,12 @@ public class Tabsheets extends VerticalLayout implements View { setMargin(true); Label h1 = new Label("Tabs"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout wrap = new HorizontalLayout(); wrap.setSpacing(true); - wrap.addStyleName("wrapping"); + wrap.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); addComponent(wrap); final CheckBox closable = new CheckBox("Closable"); @@ -66,12 +67,12 @@ public class Tabsheets extends VerticalLayout implements View { wrap.addComponent(disable); Label h3 = new Label("Additional Styles"); - h3.addStyleName("h3"); + h3.addStyleName(ValoTheme.LABEL_H3); addComponent(h3); wrap = new HorizontalLayout(); wrap.setSpacing(true); - wrap.addStyleName("wrapping"); + wrap.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); wrap.setMargin(new MarginInfo(false, false, true, false)); addComponent(wrap); diff --git a/uitest/src/com/vaadin/tests/themes/valo/TextFields.java b/uitest/src/com/vaadin/tests/themes/valo/TextFields.java index 347a683673..be6e430b23 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/TextFields.java +++ b/uitest/src/com/vaadin/tests/themes/valo/TextFields.java @@ -28,6 +28,7 @@ import com.vaadin.ui.RichTextArea; import com.vaadin.ui.TextArea; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.ValoTheme; public class TextFields extends VerticalLayout implements View { private TestIcon testIcon = new TestIcon(140); @@ -36,11 +37,11 @@ public class TextFields extends VerticalLayout implements View { setMargin(true); Label h1 = new Label("Text Fields"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); - row.addStyleName("wrapping"); + row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); addComponent(row); @@ -72,7 +73,7 @@ public class TextFields extends VerticalLayout implements View { tf = new TextField("Error, borderless"); tf.setValue("Something’s wrong"); tf.setComponentError(new UserError("Fix it, now!")); - tf.addStyleName("borderless"); + tf.addStyleName(ValoTheme.TEXTFIELD_BORDERLESS); row.addComponent(tf); tf = new TextField("Read-only"); @@ -83,121 +84,121 @@ public class TextFields extends VerticalLayout implements View { tf = new TextField("Small"); tf.setValue("Field value"); - tf.addStyleName("small"); + tf.addStyleName(ValoTheme.TEXTFIELD_SMALL); row.addComponent(tf); tf = new TextField("Large"); tf.setValue("Field value"); - tf.addStyleName("large"); + tf.addStyleName(ValoTheme.TEXTFIELD_LARGE); tf.setIcon(testIcon.get(true)); row.addComponent(tf); tf = new TextField("Icon inside"); tf.setInputPrompt("Ooh, an icon"); - tf.addStyleName("inline-icon"); + tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField("Large, Icon inside"); tf.setInputPrompt("Ooh, an icon"); - tf.addStyleName("large"); - tf.addStyleName("inline-icon"); + tf.addStyleName(ValoTheme.TEXTFIELD_LARGE); + tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField("Small, Icon inside"); tf.setInputPrompt("Ooh, an icon"); - tf.addStyleName("small"); - tf.addStyleName("inline-icon"); + tf.addStyleName(ValoTheme.TEXTFIELD_SMALL); + tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField("16px supported by default"); tf.setInputPrompt("Image icon"); - tf.addStyleName("inline-icon"); + tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); tf.setIcon(testIcon.get(true, 16)); row.addComponent(tf); tf = new TextField(); tf.setValue("Font, no caption"); - tf.addStyleName("inline-icon"); + tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField(); tf.setValue("Image, no caption"); - tf.addStyleName("inline-icon"); + tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); tf.setIcon(testIcon.get(true, 16)); row.addComponent(tf); CssLayout group = new CssLayout(); - group.addStyleName("v-component-group"); + group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); row.addComponent(group); tf = new TextField(); tf.setInputPrompt("Grouped with a button"); - tf.addStyleName("inline-icon"); + tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); tf.setIcon(testIcon.get()); tf.setWidth("260px"); group.addComponent(tf); Button button = new Button("Do It"); - // button.addStyleName("primary"); + // button.addStyleName(ValoTheme.BUTTON_PRIMARY); group.addComponent(button); tf = new TextField("Borderless"); tf.setInputPrompt("Write here…"); - tf.addStyleName("inline-icon"); - tf.addStyleName("borderless"); + tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); + tf.addStyleName(ValoTheme.TEXTFIELD_BORDERLESS); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField("Right-aligned"); tf.setValue("1,234"); - tf.addStyleName("align-right"); + tf.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); row.addComponent(tf); tf = new TextField("Centered"); tf.setInputPrompt("Guess what?"); - tf.addStyleName("align-center"); + tf.addStyleName(ValoTheme.TEXTFIELD_ALIGN_CENTER); row.addComponent(tf); PasswordField pwf = new PasswordField("Password"); pwf.setInputPrompt("Secret words"); - pwf.addStyleName("inline-icon"); + pwf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); pwf.setIcon(FontAwesome.LOCK); row.addComponent(pwf); pwf = new PasswordField("Password, right-aligned"); pwf.setInputPrompt("Secret words"); - pwf.addStyleName("inline-icon"); - pwf.addStyleName("align-right"); + pwf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); + pwf.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); pwf.setIcon(FontAwesome.LOCK); row.addComponent(pwf); pwf = new PasswordField("Password, centered"); pwf.setInputPrompt("Secret words"); - pwf.addStyleName("inline-icon"); - pwf.addStyleName("align-center"); + pwf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); + pwf.addStyleName(ValoTheme.TEXTFIELD_ALIGN_CENTER); pwf.setIcon(FontAwesome.LOCK); row.addComponent(pwf); tf = new TextField("Tiny"); tf.setValue("Field value"); - tf.addStyleName("tiny"); + tf.addStyleName(ValoTheme.TEXTFIELD_TINY); row.addComponent(tf); tf = new TextField("Huge"); tf.setValue("Field value"); - tf.addStyleName("huge"); + tf.addStyleName(ValoTheme.TEXTFIELD_HUGE); row.addComponent(tf); h1 = new Label("Text Areas"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); row = new HorizontalLayout(); - row.addStyleName("wrapping"); + row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); addComponent(row); @@ -228,37 +229,37 @@ public class TextFields extends VerticalLayout implements View { row.addComponent(ta); ta = new TextArea("Small"); - ta.addStyleName("small"); + ta.addStyleName(ValoTheme.TEXTAREA_SMALL); ta.setInputPrompt("Write your comment…"); row.addComponent(ta); ta = new TextArea("Large"); - ta.addStyleName("large"); + ta.addStyleName(ValoTheme.TEXTAREA_LARGE); ta.setInputPrompt("Write your comment…"); row.addComponent(ta); ta = new TextArea("Borderless"); - ta.addStyleName("borderless"); + ta.addStyleName(ValoTheme.TEXTAREA_BORDERLESS); ta.setInputPrompt("Write your comment…"); row.addComponent(ta); ta = new TextArea("Right-aligned"); - ta.addStyleName("align-right"); + ta.addStyleName(ValoTheme.TEXTAREA_ALIGN_RIGHT); ta.setValue("Field value, spanning multiple lines of text"); row.addComponent(ta); ta = new TextArea("Centered"); - ta.addStyleName("align-center"); + ta.addStyleName(ValoTheme.TEXTAREA_ALIGN_CENTER); ta.setValue("Field value, spanning multiple lines of text"); row.addComponent(ta); ta = new TextArea("Tiny"); - ta.addStyleName("tiny"); + ta.addStyleName(ValoTheme.TEXTAREA_TINY); ta.setInputPrompt("Write your comment…"); row.addComponent(ta); ta = new TextArea("Huge"); - ta.addStyleName("huge"); + ta.addStyleName(ValoTheme.TEXTAREA_HUGE); ta.setInputPrompt("Write your comment…"); row.addComponent(ta); diff --git a/uitest/src/com/vaadin/tests/themes/valo/Trees.java b/uitest/src/com/vaadin/tests/themes/valo/Trees.java index cb5657660a..02846d8921 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/Trees.java +++ b/uitest/src/com/vaadin/tests/themes/valo/Trees.java @@ -28,17 +28,18 @@ import com.vaadin.ui.Notification; import com.vaadin.ui.Tree; import com.vaadin.ui.Tree.TreeDragMode; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.ValoTheme; public class Trees extends VerticalLayout implements View { public Trees() { setMargin(true); Label h1 = new Label("Trees"); - h1.addStyleName("h1"); + h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); - row.addStyleName("wrapping"); + row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); addComponent(row); diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoMenuLayout.java b/uitest/src/com/vaadin/tests/themes/valo/ValoMenuLayout.java index 3a3baa686c..0e62f983a6 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/ValoMenuLayout.java +++ b/uitest/src/com/vaadin/tests/themes/valo/ValoMenuLayout.java @@ -19,6 +19,7 @@ import com.vaadin.ui.Component; import com.vaadin.ui.ComponentContainer; import com.vaadin.ui.CssLayout; import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.themes.ValoTheme; /** * @@ -34,7 +35,7 @@ public class ValoMenuLayout extends HorizontalLayout { public ValoMenuLayout() { setSizeFull(); - menuArea.setPrimaryStyleName("valo-menu"); + menuArea.setPrimaryStyleName(ValoTheme.MENU_ROOT); contentArea.setPrimaryStyleName("valo-content"); contentArea.addStyleName("v-scrollable"); @@ -49,7 +50,7 @@ public class ValoMenuLayout extends HorizontalLayout { } public void addMenu(Component menu) { - menu.addStyleName("valo-menu-part"); + menu.addStyleName(ValoTheme.MENU_PART); menuArea.addComponent(menu); } diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java index 988b3487bd..3bf6fd7ca3 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java +++ b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java @@ -194,29 +194,29 @@ public class ValoThemeUI extends UI { Component buildTestMenu() { CssLayout menu = new CssLayout(); - menu.addStyleName("large-icons"); + menu.addStyleName(ValoTheme.MENU_PART_LARGE_ICONS); Label logo = new Label("Va"); logo.setSizeUndefined(); - logo.setPrimaryStyleName("valo-menu-logo"); + logo.setPrimaryStyleName(ValoTheme.MENU_LOGO); menu.addComponent(logo); Button b = new Button( "Reference 3"); b.setIcon(FontAwesome.TH_LIST); - b.setPrimaryStyleName("valo-menu-item"); + b.setPrimaryStyleName(ValoTheme.MENU_ITEM); b.addStyleName("selected"); b.setHtmlContentAllowed(true); menu.addComponent(b); b = new Button("API"); b.setIcon(FontAwesome.BOOK); - b.setPrimaryStyleName("valo-menu-item"); + b.setPrimaryStyleName(ValoTheme.MENU_ITEM); menu.addComponent(b); b = new Button("Examples 12"); b.setIcon(FontAwesome.TABLE); - b.setPrimaryStyleName("valo-menu-item"); + b.setPrimaryStyleName(ValoTheme.MENU_ITEM); b.setHtmlContentAllowed(true); menu.addComponent(b); @@ -250,7 +250,7 @@ public class ValoThemeUI extends UI { HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); - top.addStyleName("valo-menu-title"); + top.addStyleName(ValoTheme.MENU_TITLE); menu.addComponent(top); menu.addComponent(createThemeSelect()); @@ -297,8 +297,8 @@ public class ValoThemeUI extends UI { for (final Entry item : menuItems.entrySet()) { if (item.getKey().equals("labels")) { label = new Label("Components", ContentMode.HTML); - label.setPrimaryStyleName("valo-menu-subtitle"); - label.addStyleName("h4"); + label.setPrimaryStyleName(ValoTheme.MENU_SUBTITLE); + label.addStyleName(ValoTheme.LABEL_H4); label.setSizeUndefined(); menuItemsLayout.addComponent(label); } @@ -308,8 +308,8 @@ public class ValoThemeUI extends UI { + ""); count = 0; label = new Label("Containers", ContentMode.HTML); - label.setPrimaryStyleName("valo-menu-subtitle"); - label.addStyleName("h4"); + label.setPrimaryStyleName(ValoTheme.MENU_SUBTITLE); + label.addStyleName(ValoTheme.LABEL_H4); label.setSizeUndefined(); menuItemsLayout.addComponent(label); } @@ -319,8 +319,8 @@ public class ValoThemeUI extends UI { + ""); count = 0; label = new Label("Other", ContentMode.HTML); - label.setPrimaryStyleName("valo-menu-subtitle"); - label.addStyleName("h4"); + label.setPrimaryStyleName(ValoTheme.MENU_SUBTITLE); + label.addStyleName(ValoTheme.LABEL_H4); label.setSizeUndefined(); menuItemsLayout.addComponent(label); } @@ -335,7 +335,7 @@ public class ValoThemeUI extends UI { + " 123"); } b.setHtmlContentAllowed(true); - b.setPrimaryStyleName("valo-menu-item"); + b.setPrimaryStyleName(ValoTheme.MENU_ITEM); b.setIcon(testIcon.get()); menuItemsLayout.addComponent(b); count++; -- cgit v1.2.3