summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Koivuviita <jouni@vaadin.com>2014-06-24 15:41:41 +0300
committerJouni Koivuviita <jouni@vaadin.com>2014-06-25 11:16:08 +0000
commitf4a5dcf7671676c7e2f3780ddccae2c26f9295f8 (patch)
tree951b44ae447fb6acfdce91d499b83743dae77581
parentd4fe6004f27892e089caee94383c9c295b1e43e4 (diff)
downloadvaadin-framework-f4a5dcf7671676c7e2f3780ddccae2c26f9295f8.tar.gz
vaadin-framework-f4a5dcf7671676c7e2f3780ddccae2c26f9295f8.zip
Update ValoThemeTest
Tables example refactored to allow testing all possible combinations of different styles and configurations. Lots of other small updates to cover different use cases. RandomTests renamed to an indipendent ValoMiscTests UI Change-Id: I7f8cf55372031e3012e7a5d3b32a70f85e93aefd
-rw-r--r--WebContent/VAADIN/themes/tests-valo/_flat.scss1
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java48
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java16
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/CommonParts.java4
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/DateFields.java6
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Forms.java22
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Panels.java2
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Tables.java248
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java36
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/TextFields.java61
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ValoMiscTests.java (renamed from uitest/src/com/vaadin/tests/themes/valo/RandomTests.java)36
11 files changed, 373 insertions, 107 deletions
diff --git a/WebContent/VAADIN/themes/tests-valo/_flat.scss b/WebContent/VAADIN/themes/tests-valo/_flat.scss
index d6e2857a83..5d2b8abbb7 100644
--- a/WebContent/VAADIN/themes/tests-valo/_flat.scss
+++ b/WebContent/VAADIN/themes/tests-valo/_flat.scss
@@ -2,6 +2,7 @@ $v-app-loading-text: "Flat Valo";
$v-font-family: "Roboto", sans-serif;
$v-font-weight: 400;
+$v-font-weight--header: 400;
$v-background-color: #fff;
$v-focus-color: rgb(150,190,90);
$v-luminance-threshold: 180;
diff --git a/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java b/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java
index 65575c764b..a2daeff2f8 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java
@@ -112,6 +112,54 @@ public class CheckBoxes extends VerticalLayout implements View {
options.setItemIcon("Option Three", TestIcon.get(true));
row.addComponent(options);
+ options = new OptionGroup("Choose one, small");
+ options.addStyleName("small");
+ options.setMultiSelect(false);
+ options.addItem("Option One");
+ options.addItem("Option Two");
+ options.addItem("Option Three");
+ options.select("Option One");
+ options.setItemIcon("Option One", TestIcon.get());
+ options.setItemIcon("Option Two", TestIcon.get());
+ options.setItemIcon("Option Three", TestIcon.get(true));
+ row.addComponent(options);
+
+ options = new OptionGroup("Choose many, small");
+ options.addStyleName("small");
+ options.setMultiSelect(true);
+ options.addItem("Option One");
+ options.addItem("Option Two");
+ options.addItem("Option Three");
+ options.select("Option One");
+ options.setItemIcon("Option One", TestIcon.get());
+ options.setItemIcon("Option Two", TestIcon.get());
+ options.setItemIcon("Option Three", TestIcon.get(true));
+ row.addComponent(options);
+
+ options = new OptionGroup("Choose one, large");
+ options.addStyleName("large");
+ options.setMultiSelect(false);
+ options.addItem("Option One");
+ options.addItem("Option Two");
+ options.addItem("Option Three");
+ options.select("Option One");
+ options.setItemIcon("Option One", TestIcon.get());
+ options.setItemIcon("Option Two", TestIcon.get());
+ options.setItemIcon("Option Three", TestIcon.get(true));
+ row.addComponent(options);
+
+ options = new OptionGroup("Choose many, large");
+ options.addStyleName("large");
+ options.setMultiSelect(true);
+ options.addItem("Option One");
+ options.addItem("Option Two");
+ options.addItem("Option Three");
+ options.select("Option One");
+ options.setItemIcon("Option One", TestIcon.get());
+ options.setItemIcon("Option Two", TestIcon.get());
+ options.setItemIcon("Option Three", TestIcon.get(true));
+ row.addComponent(options);
+
options = new OptionGroup("Horizontal items");
options.addStyleName("horizontal");
options.addItem("Option One");
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java b/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java
index 6c1253c841..f96584f855 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java
@@ -122,18 +122,26 @@ public class ComboBoxes extends VerticalLayout implements View {
combo = new ComboBox("Small");
combo.setInputPrompt("You can type here");
- combo.addItem("Option One");
- combo.addItem("Option Two");
- combo.addItem("Option Three");
+ combo.setContainerDataSource(generatedContainer);
+ combo.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY);
+ combo.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY);
combo.addStyleName("small");
row.addComponent(combo);
combo = new ComboBox("Large");
combo.setInputPrompt("You can type here");
+ combo.setContainerDataSource(generatedContainer);
+ combo.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY);
+ combo.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY);
+ combo.addStyleName("large");
+ row.addComponent(combo);
+
+ combo = new ComboBox("Borderless");
+ combo.setInputPrompt("You can type here");
combo.addItem("Option One");
combo.addItem("Option Two");
combo.addItem("Option Three");
- combo.addStyleName("large");
+ combo.addStyleName("borderless");
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 94363687b6..75d51ed2a6 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java
@@ -22,6 +22,7 @@ import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.server.AbstractErrorMessage;
import com.vaadin.server.ErrorMessage.ErrorLevel;
+import com.vaadin.server.FontAwesome;
import com.vaadin.server.Page;
import com.vaadin.server.UserError;
import com.vaadin.shared.Position;
@@ -272,12 +273,13 @@ public class CommonParts extends VerticalLayout implements View {
delay.setValue("1000");
group.addComponent(delay);
- Button clear = new Button("×", new ClickListener() {
+ Button clear = new Button(null, new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
delay.setValue("");
}
});
+ clear.setIcon(FontAwesome.TIMES_CIRCLE);
clear.addStyleName("last");
clear.addStyleName("small");
clear.addStyleName("icon-only");
diff --git a/uitest/src/com/vaadin/tests/themes/valo/DateFields.java b/uitest/src/com/vaadin/tests/themes/valo/DateFields.java
index a9a9018dbb..5ea4a32fd2 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/DateFields.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/DateFields.java
@@ -136,6 +136,12 @@ public class DateFields extends VerticalLayout implements View {
date.addStyleName("large");
row.addComponent(date);
+ date = new DateField("Borderless");
+ date.setValue(new Date());
+ date.setResolution(Resolution.DAY);
+ date.addStyleName("borderless");
+ row.addComponent(date);
+
date = new DateField("Week numbers");
date.setValue(new Date());
date.setResolution(Resolution.DAY);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Forms.java b/uitest/src/com/vaadin/tests/themes/valo/Forms.java
index da147cbdc9..9451b5c5d3 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Forms.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Forms.java
@@ -20,6 +20,7 @@ import java.util.Date;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.server.UserError;
+import com.vaadin.shared.ui.MarginInfo;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
@@ -57,7 +58,7 @@ public class Forms extends VerticalLayout implements View {
addComponent(form);
Label section = new Label("Personal Info");
- section.addStyleName("h4");
+ section.addStyleName("h2");
form.addComponent(section);
TextField name = new TextField("Name");
@@ -84,7 +85,7 @@ public class Forms extends VerticalLayout implements View {
form.addComponent(sex);
section = new Label("Contact Info");
- section.addStyleName("h4");
+ section.addStyleName("h3");
form.addComponent(section);
TextField email = new TextField("Email");
@@ -139,22 +140,26 @@ public class Forms extends VerticalLayout implements View {
shortbio.setRows(2);
form.addComponent(shortbio);
- RichTextArea bio = new RichTextArea("Bio");
+ final RichTextArea bio = new RichTextArea("Bio");
bio.setWidth("100%");
+ bio.setValue("<div><p><span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>A communi observantia non est recedendum.</span> <span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Ab illo tempore, ab est sed immemorabili.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span></p><p><span>Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Cum sociis natoque penatibus et magnis dis parturient.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Tityre, tu patulae recubans sub tegmine fagi dolor.</span></p><p><span>Curabitur blandit tempus ardua ridiculus sed magna.</span> <span>Phasellus laoreet lorem vel dolor tempus vehicula.</span> <span>Etiam habebis sem dicantur magna mollis euismod.</span> <span>Hi omnes lingua, institutis, legibus inter se differunt.</span></p></div>");
form.addComponent(bio);
form.setReadOnly(true);
+ bio.setReadOnly(true);
Button edit = new Button("Edit", new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
boolean readOnly = form.isReadOnly();
if (readOnly) {
+ bio.setReadOnly(false);
form.setReadOnly(false);
form.removeStyleName("light");
event.getButton().setCaption("Save");
event.getButton().addStyleName("primary");
} else {
+ bio.setReadOnly(true);
form.setReadOnly(true);
form.addStyleName("light");
event.getButton().setCaption("Edit");
@@ -163,7 +168,16 @@ public class Forms extends VerticalLayout implements View {
}
});
- addComponent(edit);
+ HorizontalLayout footer = new HorizontalLayout();
+ footer.setMargin(new MarginInfo(true, false, true, false));
+ footer.setSpacing(true);
+ footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
+ form.addComponent(footer);
+ footer.addComponent(edit);
+
+ Label lastModified = new Label("Last modified by you a minute ago");
+ lastModified.addStyleName("light");
+ footer.addComponent(lastModified);
}
@Override
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Panels.java b/uitest/src/com/vaadin/tests/themes/valo/Panels.java
index 62bb600bde..74baef066b 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Panels.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Panels.java
@@ -111,7 +111,7 @@ public class Panels extends VerticalLayout implements View {
Button action = new Button();
action.setIcon(FontAwesome.PENCIL);
- action.addStyleName("borderless");
+ action.addStyleName("borderless-colored");
action.addStyleName("small");
action.addStyleName("icon-only");
panelCaption.addComponent(action);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Tables.java b/uitest/src/com/vaadin/tests/themes/valo/Tables.java
index 05cbf1e934..aff8b93079 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Tables.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Tables.java
@@ -16,16 +16,21 @@
package com.vaadin.tests.themes.valo;
import com.vaadin.data.Container;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropHandler;
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.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.RowHeaderMode;
import com.vaadin.ui.Table.TableDragMode;
import com.vaadin.ui.TreeTable;
import com.vaadin.ui.VerticalLayout;
@@ -37,6 +42,23 @@ public class Tables extends VerticalLayout implements View {
static final Container hierarchicalContainer = ValoThemeTest
.generateContainer(200, true);
+ CheckBox hierarchical = new CheckBox("Hierarchical");
+ CheckBox footer = new CheckBox("Footer", true);
+ CheckBox sized = new CheckBox("Sized");
+ CheckBox expandRatios = new CheckBox("Expand ratios");
+ CheckBox stripes = new CheckBox("Sripes", true);
+ CheckBox verticalLines = new CheckBox("Vertical lines", true);
+ CheckBox horizontalLines = new CheckBox("Horizontal lines", true);
+ CheckBox borderless = new CheckBox("Borderless");
+ CheckBox headers = new CheckBox("Header", true);
+ CheckBox compact = new CheckBox("Compact");
+ CheckBox small = new CheckBox("Small");
+ CheckBox rowIndex = new CheckBox("Row index", false);
+ CheckBox rowIcon = new CheckBox("Row icon", true);
+ CheckBox rowCaption = new CheckBox("Row caption", false);
+
+ Table table;
+
public Tables() {
setMargin(true);
setSpacing(true);
@@ -45,81 +67,70 @@ public class Tables extends VerticalLayout implements View {
h1.addStyleName("h1");
addComponent(h1);
- Table table = getTable("Normal");
- addComponent(table);
-
- table = getTable("Footer");
- table.setFooterVisible(true);
- table.setColumnFooter(ValoThemeTest.CAPTION_PROPERTY, "caption");
- table.setColumnFooter(ValoThemeTest.DESCRIPTION_PROPERTY, "description");
- table.setColumnFooter(ValoThemeTest.ICON_PROPERTY, "icon");
- table.setColumnFooter(ValoThemeTest.INDEX_PROPERTY, "index");
- addComponent(table);
-
- table = getTable("Sized ");
- table.setWidth("300px");
- addComponent(table);
-
- table = getTable("Sized w/ expand ratios");
- table.setWidth("100%");
- table.setColumnExpandRatio(ValoThemeTest.CAPTION_PROPERTY, 1.0f);
- table.setColumnExpandRatio(ValoThemeTest.DESCRIPTION_PROPERTY, 1.0f);
- // table.setColumnExpandRatio(ValoThemeTest.ICON_PROPERTY, 1.0f);
- // table.setColumnExpandRatio(ValoThemeTest.INDEX_PROPERTY, 1.0f);
- addComponent(table);
-
- table = getTable("No stripes");
- table.addStyleName("no-stripes");
- addComponent(table);
-
- table = getTable("No vertical lines");
- table.addStyleName("no-vertical-lines");
- addComponent(table);
-
- table = getTable("No horizontal lines");
- table.addStyleName("no-horizontal-lines");
- addComponent(table);
-
- table = getTable("Borderless");
- table.addStyleName("borderless");
- addComponent(table);
-
- table = getTable("No headers");
- table.addStyleName("no-header");
- addComponent(table);
-
- table = getTable("Compact");
- table.addStyleName("compact");
- addComponent(table);
-
- table = getTable("Small");
- table.addStyleName("small");
- addComponent(table);
-
- h1 = new Label("Tree Tables");
- h1.addStyleName("h1");
- addComponent(h1);
+ HorizontalLayout wrap = new HorizontalLayout();
+ wrap.addStyleName("wrapping");
+ wrap.setSpacing(true);
+ addComponent(wrap);
- addComponent(new Label(
- "TreeTables have all the same features as Tables, but they support hierarchical containers as well."));
-
- table = getTreeTable(null);
- addComponent(table);
- }
+ wrap.addComponents(hierarchical, footer, sized, expandRatios, stripes,
+ verticalLines, horizontalLines, borderless, headers, compact,
+ small, rowIndex, rowCaption, rowIcon);
- static TreeTable getTreeTable(String caption) {
- TreeTable table = new TreeTable(caption);
- configure(table, true);
- return table;
- }
+ ValueChangeListener update = new ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ if (table == null) {
+ table = new Table();
+ table.setContainerDataSource(normalContainer);
+ addComponent(table);
+ }
+ if (hierarchical.getValue() && table instanceof Table) {
+ removeComponent(table);
+ table = new TreeTable();
+ table.setContainerDataSource(hierarchicalContainer);
+ addComponent(table);
+ } else if (!hierarchical.getValue()
+ && table instanceof TreeTable) {
+ removeComponent(table);
+ table = new Table();
+ table.setContainerDataSource(normalContainer);
+ addComponent(table);
+ }
+
+ configure(table, footer.getValue(), sized.getValue(),
+ expandRatios.getValue(), stripes.getValue(),
+ verticalLines.getValue(), horizontalLines.getValue(),
+ borderless.getValue(), headers.getValue(),
+ compact.getValue(), small.getValue(),
+ rowIndex.getValue(), rowCaption.getValue(),
+ rowIcon.getValue());
+ }
+ };
+
+ hierarchical.addValueChangeListener(update);
+ footer.addValueChangeListener(update);
+ sized.addValueChangeListener(update);
+ expandRatios.addValueChangeListener(update);
+ stripes.addValueChangeListener(update);
+ verticalLines.addValueChangeListener(update);
+ horizontalLines.addValueChangeListener(update);
+ borderless.addValueChangeListener(update);
+ headers.addValueChangeListener(update);
+ compact.addValueChangeListener(update);
+ small.addValueChangeListener(update);
+ rowIndex.addValueChangeListener(update);
+ rowCaption.addValueChangeListener(update);
+ rowIcon.addValueChangeListener(update);
+
+ footer.setValue(false);
- static Table getTable(String caption) {
- Table table = new Table(caption);
- configure(table, false);
- return table;
}
- static void configure(Table table, boolean hierarchical) {
+ static void configure(Table table, boolean footer, boolean sized,
+ boolean expandRatios, boolean stripes, boolean verticalLines,
+ boolean horizontalLines, boolean borderless, boolean headers,
+ boolean compact, boolean small, boolean rowIndex,
+ boolean rowCaption, boolean rowIcon) {
table.setSelectable(true);
table.setMultiSelect(true);
table.setSortEnabled(true);
@@ -139,14 +150,99 @@ public class Tables extends VerticalLayout implements View {
Notification.show(event.getTransferable().toString());
}
});
- Container tableData = hierarchical ? hierarchicalContainer
- : normalContainer;
- table.setContainerDataSource(tableData);
- table.select(tableData.getItemIds().iterator().next());
- // table.setSortContainerPropertyId(ValoThemeTest.CAPTION_PROPERTY);
- // table.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY);
table.setColumnAlignment(ValoThemeTest.DESCRIPTION_PROPERTY,
Align.RIGHT);
+ table.setColumnAlignment(ValoThemeTest.INDEX_PROPERTY, Align.CENTER);
+
+ table.setFooterVisible(footer);
+ if (footer) {
+ table.setColumnFooter(ValoThemeTest.CAPTION_PROPERTY, "caption");
+ table.setColumnFooter(ValoThemeTest.DESCRIPTION_PROPERTY,
+ "description");
+ table.setColumnFooter(ValoThemeTest.ICON_PROPERTY, "icon");
+ table.setColumnFooter(ValoThemeTest.INDEX_PROPERTY, "index");
+ }
+
+ if (sized) {
+ table.setWidth("400px");
+ table.setHeight("300px");
+ } else {
+ table.setSizeUndefined();
+ }
+
+ if (expandRatios) {
+ if (!sized) {
+ table.setWidth("100%");
+ }
+ }
+ table.setColumnExpandRatio(ValoThemeTest.CAPTION_PROPERTY,
+ expandRatios ? 1.0f : 0);
+ table.setColumnExpandRatio(ValoThemeTest.DESCRIPTION_PROPERTY,
+ expandRatios ? 1.0f : 0);
+
+ if (!stripes) {
+ table.addStyleName("no-stripes");
+ } else {
+ table.removeStyleName("no-stripes");
+ }
+
+ if (!verticalLines) {
+ table.addStyleName("no-vertical-lines");
+ } else {
+ table.removeStyleName("no-vertical-lines");
+ }
+
+ if (!horizontalLines) {
+ table.addStyleName("no-horizontal-lines");
+ } else {
+ table.removeStyleName("no-horizontal-lines");
+ }
+
+ if (borderless) {
+ table.addStyleName("borderless");
+ } else {
+ table.removeStyleName("borderless");
+ }
+
+ if (!headers) {
+ table.addStyleName("no-header");
+ } else {
+ table.removeStyleName("no-header");
+ }
+
+ if (compact) {
+ table.addStyleName("compact");
+ } else {
+ table.removeStyleName("compact");
+ }
+
+ if (small) {
+ table.addStyleName("small");
+ } else {
+ table.removeStyleName("small");
+ }
+
+ if (!rowIndex && !rowCaption && rowIcon) {
+ table.setRowHeaderMode(RowHeaderMode.HIDDEN);
+ }
+
+ if (rowIndex) {
+ table.setRowHeaderMode(RowHeaderMode.INDEX);
+ }
+
+ if (rowCaption) {
+ table.setRowHeaderMode(RowHeaderMode.PROPERTY);
+ table.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY);
+ } else {
+ table.setItemCaptionPropertyId(null);
+ }
+
+ if (rowIcon) {
+ table.setRowHeaderMode(RowHeaderMode.ICON_ONLY);
+ table.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY);
+ } else {
+ table.setItemIconPropertyId(null);
+ }
}
@Override
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java b/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java
index cf1fa699c8..e070af9b95 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java
@@ -19,6 +19,7 @@ import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
+import com.vaadin.shared.ui.MarginInfo;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
@@ -39,7 +40,7 @@ public class Tabsheets extends VerticalLayout implements View {
h1.addStyleName("h1");
addComponent(h1);
- final HorizontalLayout wrap = new HorizontalLayout();
+ HorizontalLayout wrap = new HorizontalLayout();
wrap.setSpacing(true);
wrap.addStyleName("wrapping");
addComponent(wrap);
@@ -60,6 +61,20 @@ public class Tabsheets extends VerticalLayout implements View {
icon.setImmediate(true);
wrap.addComponent(icon);
+ final CheckBox disable = new CheckBox("Disable Tabs");
+ disable.setImmediate(true);
+ wrap.addComponent(disable);
+
+ Label h3 = new Label("Additional Styles");
+ h3.addStyleName("h3");
+ addComponent(h3);
+
+ wrap = new HorizontalLayout();
+ wrap.setSpacing(true);
+ wrap.addStyleName("wrapping");
+ wrap.setMargin(new MarginInfo(false, false, true, false));
+ addComponent(wrap);
+
final CheckBox framed = new CheckBox("Framed", true);
framed.setImmediate(true);
wrap.addComponent(framed);
@@ -76,6 +91,10 @@ public class Tabsheets extends VerticalLayout implements View {
padded.setImmediate(true);
wrap.addComponent(padded);
+ final CheckBox compact = new CheckBox("Compact");
+ compact.setImmediate(true);
+ wrap.addComponent(compact);
+
final CheckBox iconsOnTop = new CheckBox("Icons on top");
iconsOnTop.setImmediate(true);
wrap.addComponent(iconsOnTop);
@@ -91,6 +110,7 @@ public class Tabsheets extends VerticalLayout implements View {
style += centered.getValue() ? " centered-tabs" : "";
style += equal.getValue() ? " equal-width-tabs" : "";
style += padded.getValue() ? " padded-tabbar" : "";
+ style += compact.getValue() ? " compact-tabbar" : "";
style += iconsOnTop.getValue() ? " icons-on-top" : "";
style += selectedOnly.getValue() ? " only-selected-closable"
: "";
@@ -100,7 +120,7 @@ public class Tabsheets extends VerticalLayout implements View {
}
tabs = getTabSheet(caption.getValue(), style.trim(),
closable.getValue(), overflow.getValue(),
- icon.getValue());
+ icon.getValue(), disable.getValue());
addComponent(tabs);
}
};
@@ -108,10 +128,12 @@ public class Tabsheets extends VerticalLayout implements View {
overflow.addValueChangeListener(update);
caption.addValueChangeListener(update);
icon.addValueChangeListener(update);
+ disable.addValueChangeListener(update);
framed.addValueChangeListener(update);
centered.addValueChangeListener(update);
equal.addValueChangeListener(update);
padded.addValueChangeListener(update);
+ compact.addValueChangeListener(update);
iconsOnTop.addValueChangeListener(update);
selectedOnly.addValueChangeListener(update);
@@ -119,8 +141,8 @@ public class Tabsheets extends VerticalLayout implements View {
icon.setValue(true);
}
- TabSheet getTabSheet(boolean caption, String style, boolean closable,
- boolean scrolling, boolean icon) {
+ static TabSheet getTabSheet(boolean caption, String style,
+ boolean closable, boolean scrolling, boolean icon, boolean disable) {
TabSheet ts = new TabSheet();
ts.addStyleName(style);
@@ -138,6 +160,12 @@ public class Tabsheets extends VerticalLayout implements View {
}
Tab t = ts.addTab(content, tabcaption);
t.setClosable(closable);
+ t.setEnabled(!disable);
+
+ // First tab is always enabled
+ if (i == 1) {
+ t.setEnabled(true);
+ }
if (icon) {
t.setIcon(TestIcon.get(false));
diff --git a/uitest/src/com/vaadin/tests/themes/valo/TextFields.java b/uitest/src/com/vaadin/tests/themes/valo/TextFields.java
index 1201071f84..b65433f0db 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/TextFields.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/TextFields.java
@@ -17,10 +17,12 @@ 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.ui.Button;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.PasswordField;
import com.vaadin.ui.RichTextArea;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
@@ -82,6 +84,20 @@ public class TextFields extends VerticalLayout implements View {
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.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.setIcon(TestIcon.get());
+ row.addComponent(tf);
+
tf = new TextField("16px supported by default");
tf.setInputPrompt("Image icon");
tf.addStyleName("inline-icon");
@@ -122,6 +138,36 @@ public class TextFields extends VerticalLayout implements View {
tf.setIcon(TestIcon.get());
row.addComponent(tf);
+ tf = new TextField("Right-aligned");
+ tf.setValue("1,234");
+ tf.addStyleName("align-right");
+ row.addComponent(tf);
+
+ tf = new TextField("Centered");
+ tf.setInputPrompt("Guess what?");
+ tf.addStyleName("align-center");
+ row.addComponent(tf);
+
+ PasswordField pwf = new PasswordField("Password");
+ pwf.setInputPrompt("Secret words");
+ pwf.addStyleName("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.setIcon(FontAwesome.LOCK);
+ row.addComponent(pwf);
+
+ pwf = new PasswordField("Password, centered");
+ pwf.setInputPrompt("Secret words");
+ pwf.addStyleName("inline-icon");
+ pwf.addStyleName("align-center");
+ pwf.setIcon(FontAwesome.LOCK);
+ row.addComponent(pwf);
+
h1 = new Label("Text Areas");
h1.addStyleName("h1");
addComponent(h1);
@@ -172,9 +218,24 @@ public class TextFields extends VerticalLayout implements View {
ta.setInputPrompt("Write your comment…");
row.addComponent(ta);
+ ta = new TextArea("Right-aligned");
+ ta.addStyleName("align-right");
+ ta.setValue("Field value, spanning multiple lines of text");
+ row.addComponent(ta);
+
+ ta = new TextArea("Centered");
+ ta.addStyleName("align-center");
+ ta.setValue("Field value, spanning multiple lines of text");
+ row.addComponent(ta);
+
RichTextArea rta = new RichTextArea();
rta.setValue("<b>Some</b> <i>rich</i> content");
row.addComponent(rta);
+
+ rta = new RichTextArea("Read-only");
+ rta.setValue("<b>Some</b> <i>rich</i> content");
+ rta.setReadOnly(true);
+ row.addComponent(rta);
}
@Override
diff --git a/uitest/src/com/vaadin/tests/themes/valo/RandomTests.java b/uitest/src/com/vaadin/tests/themes/valo/ValoMiscTests.java
index 26e2cd4eb6..222dd90e49 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/RandomTests.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ValoMiscTests.java
@@ -15,28 +15,26 @@
*/
package com.vaadin.tests.themes.valo;
-import com.vaadin.navigator.View;
-import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
+import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.InlineDateField;
-import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
-import com.vaadin.ui.Table;
+import com.vaadin.ui.TreeTable;
+import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
-public class RandomTests extends VerticalLayout implements View {
- public RandomTests() {
- setMargin(true);
+public class ValoMiscTests extends UI {
- Label h1 = new Label("Random Tests");
- h1.addStyleName("h1");
- addComponent(h1);
+ VerticalLayout layout = new VerticalLayout();
+
+ public ValoMiscTests() {
+ layout.setMargin(true);
Panel p = new Panel();
- addComponent(p);
+ // layout.addComponent(p);
HorizontalLayout row = new HorizontalLayout();
p.setHeight("300px");
@@ -56,7 +54,7 @@ public class RandomTests extends VerticalLayout implements View {
p.setContent(row);
p = new Panel();
- addComponent(p);
+ // layout.addComponent(p);
p.setHeight("400px");
VerticalLayout col = new VerticalLayout();
@@ -70,14 +68,18 @@ public class RandomTests extends VerticalLayout implements View {
p.setContent(col);
- Table t = Tables.getTable(null);
- t.setSizeFull();
- p.setContent(t);
+ TreeTable table = new TreeTable();
+ table.setWidth("100%");
+ table.setContainerDataSource(Tables.hierarchicalContainer);
+ Tables.configure(table, true, false, false, true, true, true, false,
+ true, false, false, false, false, false);
+ layout.addComponent(table);
+
}
@Override
- public void enter(ViewChangeEvent event) {
- // TODO Auto-generated method stub
+ protected void init(VaadinRequest request) {
+ setContent(layout);
}
}