diff options
author | Jouni Koivuviita <jouni@vaadin.com> | 2014-06-25 16:25:40 +0300 |
---|---|---|
committer | Jouni Koivuviita <jouni@vaadin.com> | 2014-06-25 13:26:19 +0000 |
commit | 2701ad52c4824e815200784464e8341e1fd135ed (patch) | |
tree | c75986461d8474aecebd9059693455f1fa7af1da /uitest | |
parent | 4193eef8f75957ada410940ddb77bceb8ec3888b (diff) | |
download | vaadin-framework-2701ad52c4824e815200784464e8341e1fd135ed.tar.gz vaadin-framework-2701ad52c4824e815200784464e8341e1fd135ed.zip |
Various fixes to Valo and ValoThemeTest
Improve textfied, datefield and combobox mixins so that they can be
used with null parameter values. This makes them output less styles and
allows combining multiple styles together (e.g. small + borderless).
Let valo-button-style mixin support padding as a list instead of just a
single number.
Change default calendar event colors to hex values (Vaadin Sass
compiler doesn’t support all color keywords just yet).
Error styles for date field and combo box
Small fix to table to support all border sizes (Java code has a
hard-coded 1px border width). Remove a few unnecessary selectors.
Make tab sheet tab alignment mixin more generic (now allows both right
and center alignment).
Fix framed tab sheet style border (bottom border caused left and right
borders to have a “cropped” angle at the bottom end).
Fix selection overlay item active style color (i.e. white would produce
a pink color). Now a completely desaturated color won’t be saturated.
Change-Id: I0117e20ef0a597de982a4d0c85a3c78fff87eafc
Diffstat (limited to 'uitest')
5 files changed, 84 insertions, 2 deletions
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java b/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java index f96584f855..cafdfe37e0 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java +++ b/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java @@ -19,6 +19,7 @@ import com.vaadin.data.Container; import com.vaadin.navigator.View; import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; import com.vaadin.server.ThemeResource; +import com.vaadin.server.UserError; import com.vaadin.ui.Button; import com.vaadin.ui.ComboBox; import com.vaadin.ui.CssLayout; @@ -88,6 +89,27 @@ public class ComboBoxes extends VerticalLayout implements View { combo.select("Option One"); row.addComponent(combo); + combo = new ComboBox("Error"); + combo.setInputPrompt("You can type here"); + combo.addItem("Option One"); + combo.addItem("Option Two"); + combo.addItem("Option Three"); + combo.setNullSelectionAllowed(false); + combo.select("Option One"); + combo.setComponentError(new UserError("Fix it, now!")); + row.addComponent(combo); + + combo = new ComboBox("Error, borderless"); + combo.setInputPrompt("You can type here"); + combo.addItem("Option One"); + combo.addItem("Option Two"); + combo.addItem("Option Three"); + combo.setNullSelectionAllowed(false); + combo.select("Option One"); + combo.setComponentError(new UserError("Fix it, now!")); + combo.addStyleName("borderless"); + row.addComponent(combo); + combo = new ComboBox("Disabled"); combo.setInputPrompt("You can't type here"); combo.addItem("Option One"); diff --git a/uitest/src/com/vaadin/tests/themes/valo/DateFields.java b/uitest/src/com/vaadin/tests/themes/valo/DateFields.java index 5ea4a32fd2..ae520e07c2 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/DateFields.java +++ b/uitest/src/com/vaadin/tests/themes/valo/DateFields.java @@ -20,6 +20,7 @@ import java.util.Locale; import com.vaadin.navigator.View; import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; +import com.vaadin.server.UserError; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -48,6 +49,17 @@ public class DateFields extends VerticalLayout implements View { date.setValue(new Date()); row.addComponent(date); + date = new DateField("Error"); + date.setValue(new Date()); + date.setComponentError(new UserError("Fix it, now!")); + row.addComponent(date); + + date = new DateField("Error, borderless"); + date.setValue(new Date()); + date.setComponentError(new UserError("Fix it, now!")); + date.addStyleName("borderless"); + row.addComponent(date); + CssLayout group = new CssLayout(); group.setCaption("Grouped with a Button"); group.addStyleName("v-component-group"); diff --git a/uitest/src/com/vaadin/tests/themes/valo/Tables.java b/uitest/src/com/vaadin/tests/themes/valo/Tables.java index aff8b93079..6aa02a7f74 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/Tables.java +++ b/uitest/src/com/vaadin/tests/themes/valo/Tables.java @@ -24,14 +24,17 @@ import com.vaadin.event.dd.acceptcriteria.AcceptAll; import com.vaadin.event.dd.acceptcriteria.AcceptCriterion; import com.vaadin.navigator.View; import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; +import com.vaadin.ui.Button; import com.vaadin.ui.CheckBox; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Notification; import com.vaadin.ui.Table; import com.vaadin.ui.Table.Align; +import com.vaadin.ui.Table.ColumnGenerator; import com.vaadin.ui.Table.RowHeaderMode; import com.vaadin.ui.Table.TableDragMode; +import com.vaadin.ui.TextField; import com.vaadin.ui.TreeTable; import com.vaadin.ui.VerticalLayout; @@ -154,6 +157,33 @@ public class Tables extends VerticalLayout implements View { Align.RIGHT); table.setColumnAlignment(ValoThemeTest.INDEX_PROPERTY, Align.CENTER); + table.removeContainerProperty("textfield"); + table.addContainerProperty("textfield", TextField.class, null); + + table.removeGeneratedColumn("textfield"); + table.addGeneratedColumn("textfield", new ColumnGenerator() { + @Override + public Object generateCell(Table source, Object itemId, + Object columnId) { + TextField tf = new TextField(); + tf.setInputPrompt("Type here…"); + return tf; + } + }); + + table.removeContainerProperty("button"); + table.addContainerProperty("button", Button.class, null); + + table.removeGeneratedColumn("button"); + table.addGeneratedColumn("button", new ColumnGenerator() { + @Override + public Object generateCell(Table source, Object itemId, + Object columnId) { + Button b = new Button("Button"); + return b; + } + }); + table.setFooterVisible(footer); if (footer) { table.setColumnFooter(ValoThemeTest.CAPTION_PROPERTY, "caption"); diff --git a/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java b/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java index e070af9b95..24a249d90e 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java +++ b/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java @@ -61,7 +61,7 @@ public class Tabsheets extends VerticalLayout implements View { icon.setImmediate(true); wrap.addComponent(icon); - final CheckBox disable = new CheckBox("Disable Tabs"); + final CheckBox disable = new CheckBox("Disable tabs"); disable.setImmediate(true); wrap.addComponent(disable); @@ -79,10 +79,14 @@ public class Tabsheets extends VerticalLayout implements View { framed.setImmediate(true); wrap.addComponent(framed); - final CheckBox centered = new CheckBox("Centered Tabs"); + final CheckBox centered = new CheckBox("Centered tabs"); centered.setImmediate(true); wrap.addComponent(centered); + final CheckBox rightAlign = new CheckBox("Right-aligned tabs"); + rightAlign.setImmediate(true); + wrap.addComponent(rightAlign); + final CheckBox equal = new CheckBox("Equal-width tabs"); equal.setImmediate(true); wrap.addComponent(equal); @@ -108,6 +112,7 @@ public class Tabsheets extends VerticalLayout implements View { public void valueChange(ValueChangeEvent event) { String style = framed.getValue() ? "framed " : ""; style += centered.getValue() ? " centered-tabs" : ""; + style += rightAlign.getValue() ? " right-aligned-tabs" : ""; style += equal.getValue() ? " equal-width-tabs" : ""; style += padded.getValue() ? " padded-tabbar" : ""; style += compact.getValue() ? " compact-tabbar" : ""; @@ -131,6 +136,7 @@ public class Tabsheets extends VerticalLayout implements View { disable.addValueChangeListener(update); framed.addValueChangeListener(update); centered.addValueChangeListener(update); + rightAlign.addValueChangeListener(update); equal.addValueChangeListener(update); padded.addValueChangeListener(update); compact.addValueChangeListener(update); diff --git a/uitest/src/com/vaadin/tests/themes/valo/TextFields.java b/uitest/src/com/vaadin/tests/themes/valo/TextFields.java index b65433f0db..cbe7a8a0b3 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/TextFields.java +++ b/uitest/src/com/vaadin/tests/themes/valo/TextFields.java @@ -18,6 +18,7 @@ package com.vaadin.tests.themes.valo; import com.vaadin.navigator.View; import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; import com.vaadin.server.FontAwesome; +import com.vaadin.server.UserError; import com.vaadin.ui.Button; import com.vaadin.ui.CssLayout; import com.vaadin.ui.HorizontalLayout; @@ -61,6 +62,17 @@ public class TextFields extends VerticalLayout implements View { tf.addStyleName("color3"); row.addComponent(tf); + tf = new TextField("Error"); + tf.setValue("Something’s wrong"); + tf.setComponentError(new UserError("Fix it, now!")); + row.addComponent(tf); + + tf = new TextField("Error, borderless"); + tf.setValue("Something’s wrong"); + tf.setComponentError(new UserError("Fix it, now!")); + tf.addStyleName("borderless"); + row.addComponent(tf); + tf = new TextField("Read-only"); tf.setInputPrompt("Nationality"); tf.setValue("Finnish"); |