summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2014-08-04 16:14:50 +0300
committerVaadin Code Review <review@vaadin.com>2014-08-05 09:57:06 +0000
commit42ddcf1fac14265e0791da6b0cabd610985072eb (patch)
treec251442233c13fac860d4a2d900135c1e6150e5c /uitest/src/com/vaadin/tests
parent303db6bcd83d052d2d8b11f1422078fa5473187e (diff)
downloadvaadin-framework-42ddcf1fac14265e0791da6b0cabd610985072eb.tar.gz
vaadin-framework-42ddcf1fac14265e0791da6b0cabd610985072eb.zip
Removed randomness from test application
Change-Id: I823dfd3401c1cc5b2ca66428636043f2af58f0f7
Diffstat (limited to 'uitest/src/com/vaadin/tests')
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Accordions.java9
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java29
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java55
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ColorPickers.java4
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Forms.java14
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/MenuBars.java6
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Panels.java21
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/StringGenerator.java32
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java9
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/TestIcon.java13
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/TextFields.java24
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java34
12 files changed, 144 insertions, 106 deletions
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Accordions.java b/uitest/src/com/vaadin/tests/themes/valo/Accordions.java
index f483655bcd..c32be01d8d 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Accordions.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Accordions.java
@@ -44,6 +44,7 @@ public class Accordions extends VerticalLayout implements View {
}
Accordion getAccordion(String caption) {
+ TestIcon testIcon = new TestIcon(0);
Accordion ac = new Accordion();
ac.setCaption(caption);
ac.addTab(new VerticalLayout() {
@@ -52,28 +53,28 @@ public class Accordions extends VerticalLayout implements View {
addComponent(new Label(
"Fabio vel iudice vincam, sunt in culpa qui officia. Ut enim ad minim veniam, quis nostrud exercitation."));
}
- }, "First Caption", TestIcon.get());
+ }, "First Caption", testIcon.get());
ac.addTab(new VerticalLayout() {
{
setMargin(true);
addComponent(new Label(
"Gallia est omnis divisa in partes tres, quarum."));
}
- }, "Second Caption", TestIcon.get());
+ }, "Second Caption", testIcon.get());
ac.addTab(new VerticalLayout() {
{
setMargin(true);
addComponent(new Label(
"Nihil hic munitissimus habendi senatus locus, nihil horum? Sed haec quis possit intrepidus aestimare tellus."));
}
- }, "Third Caption", TestIcon.get());
+ }, "Third Caption", testIcon.get());
ac.addTab(new VerticalLayout() {
{
setMargin(true);
addComponent(new Label(
"Inmensae subtilitatis, obscuris et malesuada fames. Quisque ut dolor gravida, placerat libero vel, euismod."));
}
- }, "Custom Caption Style", TestIcon.get()).setStyleName("color1");
+ }, "Custom Caption Style", testIcon.get()).setStyleName("color1");
return ac;
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java b/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java
index ce08d9ba08..758d2de200 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java
@@ -66,61 +66,62 @@ public class ButtonsAndLinks extends VerticalLayout implements View {
button.addStyleName("danger");
row.addComponent(button);
+ TestIcon testIcon = new TestIcon(10);
button = new Button("Small");
button.addStyleName("small");
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
row.addComponent(button);
button = new Button("Large");
button.addStyleName("large");
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
row.addComponent(button);
button = new Button("Top");
button.addStyleName("icon-align-top");
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
row.addComponent(button);
button = new Button("Image icon");
- button.setIcon(TestIcon.get(true, 16));
+ button.setIcon(testIcon.get(true, 16));
row.addComponent(button);
button = new Button("Image icon");
button.addStyleName("icon-align-right");
- button.setIcon(TestIcon.get(true));
+ button.setIcon(testIcon.get(true));
row.addComponent(button);
button = new Button("Photos");
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
row.addComponent(button);
button = new Button();
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
button.addStyleName("icon-only");
row.addComponent(button);
button = new Button("Borderless");
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
button.addStyleName("borderless");
row.addComponent(button);
button = new Button("Borderless, colored");
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
button.addStyleName("borderless-colored");
row.addComponent(button);
button = new Button("Quiet");
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
button.addStyleName("quiet");
row.addComponent(button);
button = new Button("Link style");
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
button.addStyleName("link");
row.addComponent(button);
button = new Button("Icon on right");
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
button.addStyleName("icon-align-right");
row.addComponent(button);
@@ -154,7 +155,7 @@ public class ButtonsAndLinks extends VerticalLayout implements View {
link = new Link("Link with icon", new ExternalResource(
"https://vaadin.com"));
link.addStyleName("color3");
- link.setIcon(TestIcon.get());
+ link.setIcon(testIcon.get());
row.addComponent(link);
link = new Link("Small", new ExternalResource("https://vaadin.com"));
@@ -166,7 +167,7 @@ public class ButtonsAndLinks extends VerticalLayout implements View {
row.addComponent(link);
link = new Link(null, new ExternalResource("https://vaadin.com"));
- link.setIcon(TestIcon.get());
+ link.setIcon(testIcon.get());
link.addStyleName("large");
row.addComponent(link);
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java b/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java
index a2daeff2f8..c7a2610a21 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java
@@ -57,17 +57,18 @@ public class CheckBoxes extends VerticalLayout implements View {
check.addStyleName("color1");
row.addComponent(check);
+ TestIcon testIcon = new TestIcon(30);
check = new CheckBox("Custom color", true);
check.addStyleName("color2");
- check.setIcon(TestIcon.get());
+ check.setIcon(testIcon.get());
row.addComponent(check);
check = new CheckBox("With Icon", true);
- check.setIcon(TestIcon.get());
+ check.setIcon(testIcon.get());
row.addComponent(check);
check = new CheckBox();
- check.setIcon(TestIcon.get(true));
+ check.setIcon(testIcon.get(true));
row.addComponent(check);
check = new CheckBox("Small", true);
@@ -94,9 +95,9 @@ public class CheckBoxes extends VerticalLayout implements View {
.addItem("Option Two, with a longer caption that should wrap when the components width is explicitly set.");
options.addItem("Option Three");
options.select("Option One");
- options.setItemIcon("Option One", TestIcon.get());
- options.setItemIcon(two, TestIcon.get());
- options.setItemIcon("Option Three", TestIcon.get(true));
+ options.setItemIcon("Option One", testIcon.get());
+ options.setItemIcon(two, testIcon.get());
+ options.setItemIcon("Option Three", testIcon.get(true));
row.addComponent(options);
options = new OptionGroup("Choose many, explicit width");
@@ -107,9 +108,9 @@ public class CheckBoxes extends VerticalLayout implements View {
.addItem("Option Two, with a longer caption that should wrap when the components width is explicitly set.");
options.addItem("Option Three");
options.select("Option One");
- options.setItemIcon("Option One", TestIcon.get());
- options.setItemIcon(two, TestIcon.get());
- options.setItemIcon("Option Three", TestIcon.get(true));
+ options.setItemIcon("Option One", testIcon.get());
+ options.setItemIcon(two, testIcon.get());
+ options.setItemIcon("Option Three", testIcon.get(true));
row.addComponent(options);
options = new OptionGroup("Choose one, small");
@@ -119,9 +120,9 @@ public class CheckBoxes extends VerticalLayout implements View {
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));
+ 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");
@@ -131,9 +132,9 @@ public class CheckBoxes extends VerticalLayout implements View {
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));
+ 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");
@@ -143,9 +144,9 @@ public class CheckBoxes extends VerticalLayout implements View {
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));
+ 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");
@@ -155,9 +156,9 @@ public class CheckBoxes extends VerticalLayout implements View {
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));
+ 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");
@@ -166,9 +167,9 @@ public class CheckBoxes extends VerticalLayout implements View {
two = options.addItem("Option Two, with a longer caption");
options.addItem("Option Three");
options.select("Option One");
- options.setItemIcon("Option One", TestIcon.get());
- options.setItemIcon(two, TestIcon.get());
- options.setItemIcon("Option Three", TestIcon.get());
+ options.setItemIcon("Option One", testIcon.get());
+ options.setItemIcon(two, testIcon.get());
+ options.setItemIcon("Option Three", testIcon.get());
row.addComponent(options);
options = new OptionGroup("Horizontal items, explicit width");
@@ -179,9 +180,9 @@ public class CheckBoxes extends VerticalLayout implements View {
two = options.addItem("Option Two, with a longer caption");
options.addItem("Option Three");
options.select("Option One");
- options.setItemIcon("Option One", TestIcon.get());
- options.setItemIcon(two, TestIcon.get());
- options.setItemIcon("Option Three", TestIcon.get());
+ options.setItemIcon("Option One", testIcon.get());
+ options.setItemIcon(two, testIcon.get());
+ options.setItemIcon("Option Three", testIcon.get());
row.addComponent(options);
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ColorPickers.java b/uitest/src/com/vaadin/tests/themes/valo/ColorPickers.java
index b841b0b116..a7fd60ea51 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/ColorPickers.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ColorPickers.java
@@ -37,9 +37,11 @@ public class ColorPickers extends VerticalLayout implements View {
row.setSpacing(true);
addComponent(row);
+ TestIcon testIcon = new TestIcon(40);
+
ColorPicker cp = new ColorPicker();
cp.setDefaultCaptionEnabled(true);
- cp.setIcon(TestIcon.get());
+ cp.setIcon(testIcon.get());
cp.setColor(new Color(138, 73, 115));
row.addComponent(cp);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Forms.java b/uitest/src/com/vaadin/tests/themes/valo/Forms.java
index 2cea8e3f38..6f1b8bbf7a 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Forms.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Forms.java
@@ -60,10 +60,10 @@ public class Forms extends VerticalLayout implements View {
Label section = new Label("Personal Info");
section.addStyleName("h2");
form.addComponent(section);
+ StringGenerator sg = new StringGenerator();
TextField name = new TextField("Name");
- name.setValue(ValoThemeUI.nextString(true) + " "
- + ValoThemeUI.nextString(true));
+ name.setValue(sg.nextString(true) + " " + sg.nextString(true));
name.setWidth("50%");
form.addComponent(name);
@@ -72,8 +72,7 @@ public class Forms extends VerticalLayout implements View {
form.addComponent(birthday);
TextField username = new TextField("Username");
- username.setValue(ValoThemeUI.nextString(false)
- + ValoThemeUI.nextString(false));
+ username.setValue(sg.nextString(false) + sg.nextString(false));
username.setRequired(true);
form.addComponent(username);
@@ -89,15 +88,14 @@ public class Forms extends VerticalLayout implements View {
form.addComponent(section);
TextField email = new TextField("Email");
- email.setValue(ValoThemeUI.nextString(false) + "@"
- + ValoThemeUI.nextString(false) + ".com");
+ email.setValue(sg.nextString(false) + "@" + sg.nextString(false)
+ + ".com");
email.setWidth("50%");
email.setRequired(true);
form.addComponent(email);
TextField location = new TextField("Location");
- location.setValue(ValoThemeUI.nextString(true) + ", "
- + ValoThemeUI.nextString(true));
+ location.setValue(sg.nextString(true) + ", " + sg.nextString(true));
location.setWidth("50%");
location.setComponentError(new UserError("This address doesn't exist"));
form.addComponent(location);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java b/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java
index f15f43254a..88eea73513 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java
@@ -120,14 +120,16 @@ public class MenuBars extends VerticalLayout implements View {
view.addItem("Zoom In", click);
view.addItem("Zoom Out", click);
+ TestIcon testIcon = new TestIcon(50);
+
MenuItem fav = menubar.addItem("", check);
- fav.setIcon(TestIcon.get());
+ fav.setIcon(testIcon.get());
fav.setStyleName("icon-only");
fav.setCheckable(true);
fav.setChecked(true);
fav = menubar.addItem("", check);
- fav.setIcon(TestIcon.get());
+ fav.setIcon(testIcon.get());
fav.setStyleName("icon-only");
fav.setCheckable(true);
fav.setCheckable(true);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Panels.java b/uitest/src/com/vaadin/tests/themes/valo/Panels.java
index 74baef066b..8a17244693 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Panels.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Panels.java
@@ -40,45 +40,46 @@ public class Panels extends VerticalLayout implements View {
row.addStyleName("wrapping");
row.setSpacing(true);
addComponent(row);
+ TestIcon testIcon = new TestIcon(60);
Panel panel = new Panel("Normal");
- panel.setIcon(TestIcon.get());
+ panel.setIcon(testIcon.get());
panel.setContent(panelContent());
row.addComponent(panel);
panel = new Panel("Sized");
- panel.setIcon(TestIcon.get());
+ panel.setIcon(testIcon.get());
panel.setWidth("10em");
panel.setHeight("250px");
panel.setContent(panelContent());
row.addComponent(panel);
panel = new Panel("Custom Caption");
- panel.setIcon(TestIcon.get());
+ panel.setIcon(testIcon.get());
panel.addStyleName("color1");
panel.setContent(panelContent());
row.addComponent(panel);
panel = new Panel("Custom Caption");
- panel.setIcon(TestIcon.get());
+ panel.setIcon(testIcon.get());
panel.addStyleName("color2");
panel.setContent(panelContent());
row.addComponent(panel);
panel = new Panel("Custom Caption");
- panel.setIcon(TestIcon.get());
+ panel.setIcon(testIcon.get());
panel.addStyleName("color3");
panel.setContent(panelContent());
row.addComponent(panel);
panel = new Panel("Borderless style");
- panel.setIcon(TestIcon.get());
+ panel.setIcon(testIcon.get());
panel.addStyleName("borderless");
panel.setContent(panelContent());
row.addComponent(panel);
panel = new Panel("Borderless + scroll divider");
- panel.setIcon(TestIcon.get());
+ panel.setIcon(testIcon.get());
panel.addStyleName("borderless");
panel.addStyleName("scroll-divider");
panel.setContent(panelContentScroll());
@@ -86,13 +87,13 @@ public class Panels extends VerticalLayout implements View {
row.addComponent(panel);
panel = new Panel("Well style");
- panel.setIcon(TestIcon.get());
+ panel.setIcon(testIcon.get());
panel.addStyleName("well");
panel.setContent(panelContent());
row.addComponent(panel);
CssLayout layout = new CssLayout();
- layout.setIcon(TestIcon.get());
+ layout.setIcon(testIcon.get());
layout.setCaption("Panel style layout");
layout.addStyleName("card");
layout.addComponent(panelContent());
@@ -131,7 +132,7 @@ public class Panels extends VerticalLayout implements View {
layout.setWidth("14em");
layout = new CssLayout();
- layout.setIcon(TestIcon.get());
+ layout.setIcon(testIcon.get());
layout.setCaption("Well style layout");
layout.addStyleName("well");
layout.addComponent(panelContent());
diff --git a/uitest/src/com/vaadin/tests/themes/valo/StringGenerator.java b/uitest/src/com/vaadin/tests/themes/valo/StringGenerator.java
new file mode 100644
index 0000000000..7e5cc0f691
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/themes/valo/StringGenerator.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.themes.valo;
+
+public class StringGenerator {
+ static String[] strings = new String[] { "lorem", "ipsum", "dolor", "sit",
+ "amet", "consectetur", "quid", "securi", "etiam", "tamquam", "eu",
+ "fugiat", "nulla", "pariatur" };
+ int stringCount = -1;
+
+ String nextString(boolean capitalize) {
+ if (++stringCount >= strings.length) {
+ stringCount = 0;
+ }
+ return capitalize ? strings[stringCount].substring(0, 1).toUpperCase()
+ + strings[stringCount].substring(1) : strings[stringCount];
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java b/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java
index 5ae0b04399..5e77292471 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java
@@ -149,12 +149,15 @@ public class Tabsheets extends VerticalLayout implements View {
static TabSheet getTabSheet(boolean caption, String style,
boolean closable, boolean scrolling, boolean icon, boolean disable) {
+ TestIcon testIcon = new TestIcon(60);
+
TabSheet ts = new TabSheet();
ts.addStyleName(style);
+ StringGenerator sg = new StringGenerator();
for (int i = 1; i <= (scrolling ? 10 : 3); i++) {
- String tabcaption = caption ? ValoThemeUI.nextString(true) + " "
- + ValoThemeUI.nextString(false) : null;
+ String tabcaption = caption ? sg.nextString(true) + " "
+ + sg.nextString(false) : null;
VerticalLayout content = new VerticalLayout();
content.setMargin(true);
@@ -174,7 +177,7 @@ public class Tabsheets extends VerticalLayout implements View {
}
if (icon) {
- t.setIcon(TestIcon.get(false));
+ t.setIcon(testIcon.get(false));
}
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/TestIcon.java b/uitest/src/com/vaadin/tests/themes/valo/TestIcon.java
index f067df830a..469f6bc31d 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/TestIcon.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/TestIcon.java
@@ -30,15 +30,21 @@ import com.vaadin.server.ThemeResource;
*/
public class TestIcon {
- public static Resource get() {
+ int iconCount = 0;
+
+ public TestIcon(int startIndex) {
+ iconCount = startIndex;
+ }
+
+ public Resource get() {
return get(false, 32);
}
- public static Resource get(boolean isImage) {
+ public Resource get(boolean isImage) {
return get(isImage, 32);
}
- public static Resource get(boolean isImage, int imageSize) {
+ public Resource get(boolean isImage, int imageSize) {
if (!isImage) {
if (++iconCount >= ICONS.size()) {
iconCount = 0;
@@ -51,5 +57,4 @@ public class TestIcon {
static List<FontAwesome> ICONS = Collections.unmodifiableList(Arrays
.asList(FontAwesome.values()));
- static int iconCount = 0;
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/TextFields.java b/uitest/src/com/vaadin/tests/themes/valo/TextFields.java
index cbe7a8a0b3..f8606bb7c9 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/TextFields.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/TextFields.java
@@ -30,6 +30,8 @@ import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
public class TextFields extends VerticalLayout implements View {
+ private TestIcon testIcon = new TestIcon(140);
+
public TextFields() {
setMargin(true);
@@ -44,7 +46,7 @@ public class TextFields extends VerticalLayout implements View {
TextField tf = new TextField("Normal");
tf.setInputPrompt("First name");
- tf.setIcon(TestIcon.get());
+ tf.setIcon(testIcon.get());
row.addComponent(tf);
tf = new TextField("Custom color");
@@ -87,45 +89,45 @@ public class TextFields extends VerticalLayout implements View {
tf = new TextField("Large");
tf.setValue("Field value");
tf.addStyleName("large");
- tf.setIcon(TestIcon.get(true));
+ tf.setIcon(testIcon.get(true));
row.addComponent(tf);
tf = new TextField("Icon inside");
tf.setInputPrompt("Ooh, an icon");
tf.addStyleName("inline-icon");
- tf.setIcon(TestIcon.get());
+ 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());
+ 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());
+ tf.setIcon(testIcon.get());
row.addComponent(tf);
tf = new TextField("16px supported by default");
tf.setInputPrompt("Image icon");
tf.addStyleName("inline-icon");
- tf.setIcon(TestIcon.get(true, 16));
+ tf.setIcon(testIcon.get(true, 16));
row.addComponent(tf);
tf = new TextField();
tf.setValue("Font, no caption");
tf.addStyleName("inline-icon");
- tf.setIcon(TestIcon.get());
+ tf.setIcon(testIcon.get());
row.addComponent(tf);
tf = new TextField();
tf.setValue("Image, no caption");
tf.addStyleName("inline-icon");
- tf.setIcon(TestIcon.get(true, 16));
+ tf.setIcon(testIcon.get(true, 16));
row.addComponent(tf);
CssLayout group = new CssLayout();
@@ -135,7 +137,7 @@ public class TextFields extends VerticalLayout implements View {
tf = new TextField();
tf.setInputPrompt("Grouped with a button");
tf.addStyleName("inline-icon");
- tf.setIcon(TestIcon.get());
+ tf.setIcon(testIcon.get());
tf.setWidth("260px");
group.addComponent(tf);
@@ -147,7 +149,7 @@ public class TextFields extends VerticalLayout implements View {
tf.setInputPrompt("Write hereā€¦");
tf.addStyleName("inline-icon");
tf.addStyleName("borderless");
- tf.setIcon(TestIcon.get());
+ tf.setIcon(testIcon.get());
row.addComponent(tf);
tf = new TextField("Right-aligned");
@@ -196,7 +198,7 @@ public class TextFields extends VerticalLayout implements View {
ta = new TextArea("Inline icon");
ta.setInputPrompt("Inline icon not really working");
ta.addStyleName("inline-icon");
- ta.setIcon(TestIcon.get());
+ ta.setIcon(testIcon.get());
row.addComponent(ta);
ta = new TextArea("Custom color");
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java
index 8a0bf75b51..27a256665e 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java
@@ -69,6 +69,8 @@ public class ValoThemeUI extends UI {
themeVariants.put("tests-valo-flat", "Flat");
themeVariants.put("tests-valo-metro", "Metro");
}
+ private TestIcon testIcon = new TestIcon(100);
+
ValoMenuLayout root = new ValoMenuLayout();
ComponentContainer viewDisplay = root.getContentContainer();
CssLayout menu = new CssLayout();
@@ -283,7 +285,7 @@ public class ValoThemeUI extends UI {
}
b.setHtmlContentAllowed(true);
b.setPrimaryStyleName("valo-menu-item");
- b.setIcon(TestIcon.get());
+ b.setIcon(testIcon.get());
menu.addComponent(b);
count++;
}
@@ -314,19 +316,6 @@ public class ValoThemeUI extends UI {
return ns;
}
- static String[] strings = new String[] { "lorem", "ipsum", "dolor", "sit",
- "amet", "consectetur", "quid", "securi", "etiam", "tamquam", "eu",
- "fugiat", "nulla", "pariatur" };
- static int stringCount = -1;
-
- static String nextString(boolean capitalize) {
- if (++stringCount >= strings.length) {
- stringCount = 0;
- }
- return capitalize ? strings[stringCount].substring(0, 1).toUpperCase()
- + strings[stringCount].substring(1) : strings[stringCount];
- }
-
static Handler actionHandler = new Handler() {
private final Action ACTION_ONE = new Action("Action One");
private final Action ACTION_TWO = new Action("Action Two");
@@ -357,9 +346,10 @@ public class ValoThemeUI extends UI {
@SuppressWarnings("unchecked")
static Container generateContainer(final int size,
final boolean hierarchical) {
+ TestIcon testIcon = new TestIcon(90);
IndexedContainer container = hierarchical ? new HierarchicalContainer()
: new IndexedContainer();
-
+ StringGenerator sg = new StringGenerator();
container.addContainerProperty(CAPTION_PROPERTY, String.class, null);
container.addContainerProperty(ICON_PROPERTY, Resource.class, null);
container.addContainerProperty(INDEX_PROPERTY, Integer.class, null);
@@ -368,15 +358,15 @@ public class ValoThemeUI extends UI {
for (int i = 1; i < size + 1; i++) {
Item item = container.addItem(i);
item.getItemProperty(CAPTION_PROPERTY).setValue(
- nextString(true) + " " + nextString(false));
+ sg.nextString(true) + " " + sg.nextString(false));
item.getItemProperty(INDEX_PROPERTY).setValue(i);
item.getItemProperty(DESCRIPTION_PROPERTY).setValue(
- nextString(true) + " " + nextString(false) + " "
- + nextString(false));
- item.getItemProperty(ICON_PROPERTY).setValue(TestIcon.get());
+ sg.nextString(true) + " " + sg.nextString(false) + " "
+ + sg.nextString(false));
+ item.getItemProperty(ICON_PROPERTY).setValue(testIcon.get());
}
container.getItem(container.getIdByIndex(0))
- .getItemProperty(ICON_PROPERTY).setValue(TestIcon.get());
+ .getItemProperty(ICON_PROPERTY).setValue(testIcon.get());
if (hierarchical) {
for (int i = 1; i < size + 1; i++) {
@@ -384,9 +374,9 @@ public class ValoThemeUI extends UI {
String id = i + " -> " + j;
Item child = container.addItem(id);
child.getItemProperty(CAPTION_PROPERTY).setValue(
- nextString(true) + " " + nextString(false));
+ sg.nextString(true) + " " + sg.nextString(false));
child.getItemProperty(ICON_PROPERTY).setValue(
- TestIcon.get());
+ testIcon.get());
((Hierarchical) container).setChildrenAllowed(id, false);
((Hierarchical) container).setParent(id, i);
}