diff options
author | Aleksi Hietanen <aleksi@vaadin.com> | 2016-08-10 14:18:47 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-08-26 07:49:25 +0000 |
commit | 4a6a632b1f57a1ddbb437036cb5d17f98f827b47 (patch) | |
tree | 0a2091302a829adcfe86fd4d77545a271fa5c0b6 /uitest | |
parent | 24a888a2d1dc198d1d88c9e0dbdde1cfe8b0a7f1 (diff) | |
download | vaadin-framework-4a6a632b1f57a1ddbb437036cb5d17f98f827b47.tar.gz vaadin-framework-4a6a632b1f57a1ddbb437036cb5d17f98f827b47.zip |
Update TextArea to extend AbstractFieldNew (#53)
Change-Id: I72400695f3b015add07be9709e48b5f99ce619cf
Diffstat (limited to 'uitest')
22 files changed, 149 insertions, 150 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtain.java b/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtain.java index fd0c372da7..bb51bc4d64 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtain.java +++ b/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtain.java @@ -15,6 +15,7 @@ */ package com.vaadin.tests.components.draganddropwrapper; +import com.vaadin.data.HasValue.ValueChangeListener; import com.vaadin.event.FieldEvents.FocusEvent; import com.vaadin.event.FieldEvents.FocusListener; import com.vaadin.event.dd.DragAndDropEvent; @@ -23,15 +24,13 @@ import com.vaadin.event.dd.acceptcriteria.AcceptAll; import com.vaadin.event.dd.acceptcriteria.AcceptCriterion; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.ui.AbstractTextField; import com.vaadin.ui.DragAndDropWrapper; import com.vaadin.ui.DragAndDropWrapper.DragStartMode; import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.TextArea; +import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -import com.vaadin.v7.data.Property.ValueChangeEvent; -import com.vaadin.v7.data.Property.ValueChangeListener; -import com.vaadin.v7.ui.AbstractField; -import com.vaadin.v7.ui.TextArea; -import com.vaadin.v7.ui.TextField; /** * Test UI for text area inside {@link DragAndDropWrapper}: text area should @@ -47,16 +46,12 @@ public class DragAndDropFocusObtain extends AbstractTestUIWithLog { @Override public void focus(FocusEvent event) { log("Field '" + event.getComponent().getCaption() + "' focused"); - } }; - private ValueChangeListener listener = new ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - AbstractField f = (AbstractField) event.getProperty(); - log("Value of " + f.getCaption() + " changed to " + f.getValue()); - } + private ValueChangeListener<String> listener = event -> { + log("Value of " + ((AbstractTextField) event.getSource()).getCaption() + + " changed to " + event.getValue()); }; @Override @@ -89,29 +84,29 @@ public class DragAndDropFocusObtain extends AbstractTestUIWithLog { private VerticalLayout createLayout() { VerticalLayout dndLayout = new VerticalLayout(); - TextArea area = new TextArea("Text area 1"); + final TextArea area = new TextArea("Text area 1"); area.setValue("text"); area.addValueChangeListener(listener); area.addFocusListener(focusListener); dndLayout.addComponent(area); - area = new TextArea("Text area 2"); - area.setValue("text"); - area.addValueChangeListener(listener); - area.addFocusListener(focusListener); - dndLayout.addComponent(area); + final TextArea area2 = new TextArea("Text area 2"); + area2.setValue("text"); + area2.addValueChangeListener(listener); + area2.addFocusListener(focusListener); + dndLayout.addComponent(area2); - TextField field = new TextField("Text field 1"); + final TextField field = new TextField("Text field 1"); field.setValue("text"); field.addValueChangeListener(listener); field.addFocusListener(focusListener); dndLayout.addComponent(field); - field = new TextField("Text field 2"); - field.setValue("text"); - field.addValueChangeListener(listener); - field.addFocusListener(focusListener); - dndLayout.addComponent(field); + final TextField field2 = new TextField("Text field 2"); + field2.setValue("text"); + field2.addValueChangeListener(listener); + field2.addFocusListener(focusListener); + dndLayout.addComponent(field2); return dndLayout; } diff --git a/uitest/src/main/java/com/vaadin/tests/components/textarea/ScrollCursor.java b/uitest/src/main/java/com/vaadin/tests/components/textarea/ScrollCursor.java index f61dbb303b..a588e9c862 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textarea/ScrollCursor.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textarea/ScrollCursor.java @@ -4,7 +4,7 @@ import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; -import com.vaadin.v7.ui.TextArea; +import com.vaadin.ui.TextArea; /** * @author denis @@ -37,7 +37,7 @@ public class ScrollCursor extends TestBase { @Override public void buttonClick(ClickEvent event) { - textArea.setWordwrap(false); + textArea.setWordWrap(false); } }); diff --git a/uitest/src/main/java/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java b/uitest/src/main/java/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java index ef7a13befe..9eeab8905e 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java @@ -1,20 +1,17 @@ package com.vaadin.tests.components.textarea; -import com.vaadin.event.FieldEvents.TextChangeEvent; -import com.vaadin.event.FieldEvents.TextChangeListener; +import com.vaadin.shared.ui.textfield.ValueChangeMode; import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.AbstractField; +import com.vaadin.ui.AbstractTextField; import com.vaadin.ui.Button; import com.vaadin.ui.Label; -import com.vaadin.v7.ui.AbstractField; -import com.vaadin.v7.ui.AbstractTextField; -import com.vaadin.v7.ui.AbstractTextField.TextChangeEventMode; -import com.vaadin.v7.ui.TextArea; -import com.vaadin.v7.ui.TextField; +import com.vaadin.ui.TextArea; +import com.vaadin.ui.TextField; public class TextAreaCursorPosition extends TestBase { - private TextField cursorPosition = new TextField( - "Cursor position"); + private TextField cursorPosition = new TextField("Cursor position"); @Override public void setup() { @@ -31,16 +28,11 @@ public class TextAreaCursorPosition extends TestBase { public void addListener(AbstractField newField) { AbstractTextField newTextField = (AbstractTextField) newField; - newTextField.setTextChangeEventMode(TextChangeEventMode.EAGER); - - newTextField.addTextChangeListener(new TextChangeListener() { - @Override - public void textChange(TextChangeEvent event) { - AbstractTextField component = (AbstractTextField) event - .getComponent(); - cursorPosition.setValue( - String.valueOf(component.getCursorPosition())); - } + newTextField.setValueChangeMode(ValueChangeMode.EAGER); + newTextField.addValueChangeListener(event -> { + AbstractTextField component = (AbstractTextField) event.getSource(); + cursorPosition + .setValue(String.valueOf(component.getCursorPosition())); }); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/textarea/TextAreaSizeResetted.java b/uitest/src/main/java/com/vaadin/tests/components/textarea/TextAreaSizeResetted.java index 5fe4a4bfa6..ca858ffaeb 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textarea/TextAreaSizeResetted.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textarea/TextAreaSizeResetted.java @@ -24,8 +24,8 @@ import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.Component; import com.vaadin.ui.CssLayout; import com.vaadin.ui.Label; +import com.vaadin.ui.TextArea; import com.vaadin.ui.TextField; -import com.vaadin.v7.ui.TextArea; /** * Ticket #14080 @@ -73,6 +73,17 @@ public class TextAreaSizeResetted extends AbstractTestUI { textArea.setWidth(TEXTAREAWIDTH + "px"); textArea.setValue("This is a text."); + Label serverHeight = new Label(); + Label text = new Label(); + textArea.addValueChangeListener( + event -> text.setValue(event.getValue())); + Button hbutton = new Button("check height", new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + serverHeight.setValue(textArea.getHeight() + " "); + } + }); Button button = new Button("Change Height", new ClickListener() { @Override @@ -88,6 +99,9 @@ public class TextAreaSizeResetted extends AbstractTestUI { layout.addComponent(textField); layout.addComponent(button); layout.addComponent(pollIndicator); + layout.addComponent(hbutton); + layout.addComponent(serverHeight); + layout.addComponent(text); addPollListener(new UIEvents.PollListener() { @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/textarea/Wordwrap.java b/uitest/src/main/java/com/vaadin/tests/components/textarea/Wordwrap.java index 905e07191e..b393ff3105 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textarea/Wordwrap.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textarea/Wordwrap.java @@ -4,7 +4,7 @@ import com.vaadin.tests.components.TestBase; import com.vaadin.tests.util.LoremIpsum; import com.vaadin.ui.CheckBox; import com.vaadin.ui.HorizontalLayout; -import com.vaadin.v7.ui.TextArea; +import com.vaadin.ui.TextArea; public class Wordwrap extends TestBase { @@ -13,11 +13,11 @@ public class Wordwrap extends TestBase { HorizontalLayout layout = new HorizontalLayout(); TextArea area1 = new TextArea("Wrapping"); - area1.setWordwrap(true); // The default + area1.setWordWrap(true); // The default area1.setValue(LoremIpsum.get(50) + "\n" + "Another row"); final TextArea area2 = new TextArea("Nonwrapping"); - area2.setWordwrap(false); + area2.setWordWrap(false); area2.setValue(LoremIpsum.get(50) + "\n" + "Another row"); layout.addComponent(area1); @@ -30,7 +30,7 @@ public class Wordwrap extends TestBase { onoff.setValue(false); onoff.addValueChangeListener(event -> { boolean wrap = event.getValue(); - area2.setWordwrap(wrap); + area2.setWordWrap(wrap); if (wrap) { area2.setCaption("Wrapping"); } else { diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java index 087d9d8273..961c88374c 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java @@ -6,8 +6,8 @@ import com.vaadin.shared.ui.textfield.ValueChangeMode; import com.vaadin.tests.components.TestBase; import com.vaadin.tests.util.Log; import com.vaadin.tests.util.TestUtils; +import com.vaadin.ui.TextArea; import com.vaadin.ui.TextField; -import com.vaadin.v7.ui.TextArea; public class TextChangeEvents extends TestBase { Log l = new Log(10); @@ -56,7 +56,11 @@ public class TextChangeEvents extends TestBase { getLayout().addComponent(to); TextArea ta = new TextArea("Default text area"); - ta.addTextChangeListener(inputEventListener); + ta.addValueChangeListener(listener -> { + l.log("Text change event for " + ta.getCaption() + + ", text content currently:'" + listener.getValue() + + "' Cursor at index:" + ta.getCursorPosition()); + }); getLayout().addComponent(ta); VaadinDeveloperNameField vd = new VaadinDeveloperNameField(); diff --git a/uitest/src/main/java/com/vaadin/tests/declarative/DeclarativeEditor.java b/uitest/src/main/java/com/vaadin/tests/declarative/DeclarativeEditor.java index ad0d9b7137..e0862415f0 100644 --- a/uitest/src/main/java/com/vaadin/tests/declarative/DeclarativeEditor.java +++ b/uitest/src/main/java/com/vaadin/tests/declarative/DeclarativeEditor.java @@ -22,13 +22,12 @@ import java.io.IOException; import org.apache.commons.io.IOUtils; import com.vaadin.annotations.Theme; -import com.vaadin.event.FieldEvents.TextChangeEvent; -import com.vaadin.event.FieldEvents.TextChangeListener; import com.vaadin.server.VaadinRequest; import com.vaadin.ui.Component; import com.vaadin.ui.HasComponents; import com.vaadin.ui.HorizontalSplitPanel; import com.vaadin.ui.Panel; +import com.vaadin.ui.TextArea; import com.vaadin.ui.UI; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.declarative.Design; @@ -37,7 +36,6 @@ import com.vaadin.v7.data.Property.ReadOnlyException; import com.vaadin.v7.data.Property.ValueChangeEvent; import com.vaadin.v7.data.Property.ValueChangeListener; import com.vaadin.v7.data.Property.ValueChangeNotifier; -import com.vaadin.v7.ui.TextArea; @Theme("valo") public class DeclarativeEditor extends UI { @@ -61,13 +59,9 @@ public class DeclarativeEditor extends UI { } catch (IOException e) { e.printStackTrace(); } - editor.addTextChangeListener(new TextChangeListener() { - - @Override - public void textChange(TextChangeEvent event) { - editor.setComponentError(null); - updateTree(event.getText()); - } + editor.addValueChangeListener(listener -> { + editor.setComponentError(null); + updateTree(listener.getValue()); }); Panel editorPanel = new Panel(editor); diff --git a/uitest/src/main/java/com/vaadin/tests/fieldgroup/BasicPersonForm.java b/uitest/src/main/java/com/vaadin/tests/fieldgroup/BasicPersonForm.java index edb2188c5c..5c580b5f3d 100644 --- a/uitest/src/main/java/com/vaadin/tests/fieldgroup/BasicPersonForm.java +++ b/uitest/src/main/java/com/vaadin/tests/fieldgroup/BasicPersonForm.java @@ -162,8 +162,8 @@ public class BasicPersonForm extends AbstractTestUIWithLog { addComponent(discardButton); addComponent(showBean); email.addValidator(new EmailValidator("Must be a valid address")); - lastName.addValidator(new StringLengthValidator( - "Must be min 5 chars", 5, null, true)); + lastName.addValidator(new StringLengthValidator("Must be min 5 chars", + 5, null, true)); age.addValidator(new IntegerRangeValidator( "Must be between 0 and 150, {0} is not", 0, 150)); diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/FormLayoutWithInvisibleComponent.java b/uitest/src/main/java/com/vaadin/tests/layouts/FormLayoutWithInvisibleComponent.java index 149519ba3c..76a3dba08f 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/FormLayoutWithInvisibleComponent.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/FormLayoutWithInvisibleComponent.java @@ -3,7 +3,7 @@ package com.vaadin.tests.layouts; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.CheckBox; import com.vaadin.ui.FormLayout; -import com.vaadin.v7.ui.TextArea; +import com.vaadin.ui.TextArea; public class FormLayoutWithInvisibleComponent extends TestBase { diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/OrderedLayoutBasics.java b/uitest/src/main/java/com/vaadin/tests/layouts/OrderedLayoutBasics.java index e8e7c2ea99..0c0670c54d 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/OrderedLayoutBasics.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/OrderedLayoutBasics.java @@ -17,10 +17,10 @@ import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Layout; import com.vaadin.ui.Panel; +import com.vaadin.ui.TextArea; +import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; import com.vaadin.v7.ui.ListSelect; -import com.vaadin.v7.ui.TextArea; -import com.vaadin.v7.ui.TextField; public class OrderedLayoutBasics extends TestBase { @@ -140,8 +140,7 @@ public class OrderedLayoutBasics extends TestBase { ol.setWidth(""); ol.setCaption("Fixed height (200px) and dynamic width"); - TextField tf = new TextField( - "100px high TextField, valign: bottom"); + TextField tf = new TextField("100px high TextField, valign: bottom"); tf.setHeight("100px"); tf.setWidth(""); ol.addComponent(tf); @@ -243,8 +242,7 @@ public class OrderedLayoutBasics extends TestBase { ol.addComponent(tf); ol.setComponentAlignment(tf, Alignment.TOP_LEFT); - tf = new TextField( - "100% high, 50px wide TextField, valign: bottom"); + tf = new TextField("100% high, 50px wide TextField, valign: bottom"); tf.setHeight("100%"); tf.setWidth("50px"); ol.addComponent(tf); @@ -299,8 +297,7 @@ public class OrderedLayoutBasics extends TestBase { ol.addComponent(tf); ol.setComponentAlignment(tf, Alignment.TOP_LEFT); - tf = new TextField( - "100% high, 50px wide TextField, valign: bottom"); + tf = new TextField("100% high, 50px wide TextField, valign: bottom"); tf.setHeight("100%"); tf.setWidth("50px"); ol.addComponent(tf); @@ -399,6 +396,7 @@ public class OrderedLayoutBasics extends TestBase { // ol.setWidth(""); ol.setCaption("Fixed width (" + ol.getWidth() + "px) and fixed height (" + ol.getHeight() + "px) / layout_field_100pct_button_field"); + TextArea tf; tf = new TextArea("300px x 300px Field"); @@ -440,6 +438,7 @@ public class OrderedLayoutBasics extends TestBase { // ol.setWidth(""); ol.setCaption("Fixed width (" + ol.getWidth() + "px) and fixed height (" + ol.getHeight() + "px) / layout_basic_test"); + TextArea tf; tf = new TextArea("300px x 300px Field"); @@ -481,6 +480,7 @@ public class OrderedLayoutBasics extends TestBase { // ol.setWidth(""); ol.setCaption("Fixed width (" + ol.getWidth() + "px) and fixed height (" + ol.getHeight() + "px) / layout_symmetric_fields"); + TextArea tf; tf = new TextArea("300px x 300px Field"); @@ -519,6 +519,7 @@ public class OrderedLayoutBasics extends TestBase { // ol.setWidth(""); ol.setCaption("Fixed width (" + ol.getWidth() + "px) and fixed height (" + ol.getHeight() + "px) / layout_leftAndRight"); + TextArea tf; // tf = new TextField("100%x100% Field"); diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java index 0daa8a23a0..97f9d29226 100644 --- a/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java +++ b/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java @@ -43,15 +43,13 @@ import com.vaadin.ui.Panel; import com.vaadin.ui.TabSheet; import com.vaadin.ui.TabSheet.SelectedTabChangeEvent; import com.vaadin.ui.TabSheet.SelectedTabChangeListener; +import com.vaadin.ui.TextArea; +import com.vaadin.ui.TextField; 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; -import com.vaadin.v7.data.Property.ValueChangeEvent; -import com.vaadin.v7.data.Property.ValueChangeListener; -import com.vaadin.v7.ui.TextArea; -import com.vaadin.v7.ui.TextField; public class CommonParts extends VerticalLayout implements View { public CommonParts() { @@ -156,33 +154,27 @@ public class CommonParts extends VerticalLayout implements View { setSpacing(true); setMargin(true); - title.setInputPrompt("Title for the notification"); - title.addValueChangeListener(new ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - if (title.getValue() == null - || title.getValue().length() == 0) { - notification.setCaption(null); - } else { - notification.setCaption(title.getValue()); - } + title.setPlaceholder("Title for the notification"); + title.addValueChangeListener(event -> { + if (title.getValue() == null + || title.getValue().length() == 0) { + notification.setCaption(null); + } else { + notification.setCaption(title.getValue()); } }); title.setValue("Notification Title"); title.setWidth("100%"); addComponent(title); - description.setInputPrompt("Description for the notification"); + description.setPlaceholder("Description for the notification"); description.addStyleName(ValoTheme.TEXTAREA_SMALL); - description.addValueChangeListener(new ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - if (description.getValue() == null - || description.getValue().length() == 0) { - notification.setDescription(null); - } else { - notification.setDescription(description.getValue()); - } + description.addValueChangeListener(listener -> { + if (description.getValue() == null + || description.getValue().length() == 0) { + notification.setDescription(null); + } else { + notification.setDescription(description.getValue()); } }); description.setValue( @@ -257,21 +249,17 @@ public class CommonParts extends VerticalLayout implements View { group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); addComponent(group); - delay.setInputPrompt("Infinite"); + delay.setPlaceholder("Infinite"); delay.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); delay.addStyleName(ValoTheme.TEXTFIELD_SMALL); delay.setWidth("7em"); - delay.addValueChangeListener(new ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - try { - notification.setDelayMsec( - Integer.parseInt(delay.getValue())); - } catch (Exception e) { - notification.setDelayMsec(-1); - delay.setValue(""); - } - + delay.addValueChangeListener(event -> { + try { + notification.setDelayMsec( + Integer.parseInt(delay.getValue())); + } catch (Exception e) { + notification.setDelayMsec(-1); + delay.setValue(""); } }); delay.setValue("1000"); diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/TextFields.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/TextFields.java index 7d924c876d..4daf6f90e0 100644 --- a/uitest/src/main/java/com/vaadin/tests/themes/valo/TextFields.java +++ b/uitest/src/main/java/com/vaadin/tests/themes/valo/TextFields.java @@ -24,11 +24,11 @@ import com.vaadin.ui.CssLayout; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.PasswordField; +import com.vaadin.ui.TextArea; +import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.themes.ValoTheme; import com.vaadin.v7.ui.RichTextArea; -import com.vaadin.v7.ui.TextArea; -import com.vaadin.v7.ui.TextField; public class TextFields extends VerticalLayout implements View { private TestIcon testIcon = new TestIcon(140); @@ -46,22 +46,22 @@ public class TextFields extends VerticalLayout implements View { addComponent(row); TextField tf = new TextField("Normal"); - tf.setInputPrompt("First name"); + tf.setPlaceholder("First name"); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField("Custom color"); - tf.setInputPrompt("Email"); + tf.setPlaceholder("Email"); tf.addStyleName("color1"); row.addComponent(tf); tf = new TextField("User Color"); - tf.setInputPrompt("Gender"); + tf.setPlaceholder("Gender"); tf.addStyleName("color2"); row.addComponent(tf); tf = new TextField("Themed"); - tf.setInputPrompt("Age"); + tf.setPlaceholder("Age"); tf.addStyleName("color3"); row.addComponent(tf); @@ -77,7 +77,7 @@ public class TextFields extends VerticalLayout implements View { row.addComponent(tf); tf = new TextField("Read-only"); - tf.setInputPrompt("Nationality"); + tf.setPlaceholder("Nationality"); tf.setValue("Finnish"); tf.setReadOnly(true); row.addComponent(tf); @@ -94,27 +94,27 @@ public class TextFields extends VerticalLayout implements View { row.addComponent(tf); tf = new TextField("Icon inside"); - tf.setInputPrompt("Ooh, an icon"); + tf.setPlaceholder("Ooh, an 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.setPlaceholder("Ooh, an 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.setPlaceholder("Ooh, an 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.setPlaceholder("Image icon"); tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); tf.setIcon(testIcon.get(true, 16)); row.addComponent(tf); @@ -136,7 +136,7 @@ public class TextFields extends VerticalLayout implements View { row.addComponent(group); tf = new TextField(); - tf.setInputPrompt("Grouped with a button"); + tf.setPlaceholder("Grouped with a button"); tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); tf.setIcon(testIcon.get()); tf.setWidth("260px"); @@ -147,7 +147,7 @@ public class TextFields extends VerticalLayout implements View { group.addComponent(button); tf = new TextField("Borderless"); - tf.setInputPrompt("Write here…"); + tf.setPlaceholder("Write here…"); tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); tf.addStyleName(ValoTheme.TEXTFIELD_BORDERLESS); tf.setIcon(testIcon.get()); @@ -159,7 +159,7 @@ public class TextFields extends VerticalLayout implements View { row.addComponent(tf); tf = new TextField("Centered"); - tf.setInputPrompt("Guess what?"); + tf.setPlaceholder("Guess what?"); tf.addStyleName(ValoTheme.TEXTFIELD_ALIGN_CENTER); row.addComponent(tf); @@ -203,18 +203,18 @@ public class TextFields extends VerticalLayout implements View { addComponent(row); TextArea ta = new TextArea("Normal"); - ta.setInputPrompt("Write your comment…"); + ta.setPlaceholder("Write your comment…"); row.addComponent(ta); ta = new TextArea("Inline icon"); - ta.setInputPrompt("Inline icon not really working"); + ta.setPlaceholder("Inline icon not really working"); ta.addStyleName("inline-icon"); ta.setIcon(testIcon.get()); row.addComponent(ta); ta = new TextArea("Custom color"); ta.addStyleName("color1"); - ta.setInputPrompt("Write your comment…"); + ta.setPlaceholder("Write your comment…"); row.addComponent(ta); ta = new TextArea("Custom color, read-only"); @@ -230,17 +230,17 @@ public class TextFields extends VerticalLayout implements View { ta = new TextArea("Small"); ta.addStyleName(ValoTheme.TEXTAREA_SMALL); - ta.setInputPrompt("Write your comment…"); + ta.setPlaceholder("Write your comment…"); row.addComponent(ta); ta = new TextArea("Large"); ta.addStyleName(ValoTheme.TEXTAREA_LARGE); - ta.setInputPrompt("Write your comment…"); + ta.setPlaceholder("Write your comment…"); row.addComponent(ta); ta = new TextArea("Borderless"); ta.addStyleName(ValoTheme.TEXTAREA_BORDERLESS); - ta.setInputPrompt("Write your comment…"); + ta.setPlaceholder("Write your comment…"); row.addComponent(ta); ta = new TextArea("Right-aligned"); @@ -255,12 +255,12 @@ public class TextFields extends VerticalLayout implements View { ta = new TextArea("Tiny"); ta.addStyleName(ValoTheme.TEXTAREA_TINY); - ta.setInputPrompt("Write your comment…"); + ta.setPlaceholder("Write your comment…"); row.addComponent(ta); ta = new TextArea("Huge"); ta.addStyleName(ValoTheme.TEXTAREA_HUGE); - ta.setInputPrompt("Write your comment…"); + ta.setPlaceholder("Write your comment…"); row.addComponent(ta); RichTextArea rta = new RichTextArea(); diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/superText/ExtraSuperTextAreaConnector.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/superText/ExtraSuperTextAreaConnector.java index 20c849389d..b9037208f9 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/superText/ExtraSuperTextAreaConnector.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/superText/ExtraSuperTextAreaConnector.java @@ -1,8 +1,8 @@ package com.vaadin.tests.widgetset.client.superText; +import com.vaadin.client.ui.textarea.TextAreaConnector; import com.vaadin.shared.ui.Connect; import com.vaadin.tests.widgetset.server.ExtraSuperTextArea; -import com.vaadin.v7.client.ui.textarea.TextAreaConnector; @Connect(ExtraSuperTextArea.class) public class ExtraSuperTextAreaConnector extends TextAreaConnector { diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/superText/SuperTextAreaConnector.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/superText/SuperTextAreaConnector.java index c114fcc7fb..fda1fc6f0a 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/superText/SuperTextAreaConnector.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/superText/SuperTextAreaConnector.java @@ -1,8 +1,8 @@ package com.vaadin.tests.widgetset.client.superText; +import com.vaadin.client.ui.textarea.TextAreaConnector; import com.vaadin.shared.ui.Connect; import com.vaadin.tests.widgetset.server.SuperTextArea; -import com.vaadin.v7.client.ui.textarea.TextAreaConnector; /** * @author artamonov diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/server/ExtraSuperTextArea.java b/uitest/src/main/java/com/vaadin/tests/widgetset/server/ExtraSuperTextArea.java index 5470a4ba12..b741c099b5 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/server/ExtraSuperTextArea.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/server/ExtraSuperTextArea.java @@ -1,7 +1,7 @@ package com.vaadin.tests.widgetset.server; import com.vaadin.tests.widgetset.client.superText.SuperTextAreaState; -import com.vaadin.v7.ui.TextArea; +import com.vaadin.ui.TextArea; /** * @author artamonov diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/server/OverriddenDecendants.java b/uitest/src/main/java/com/vaadin/tests/widgetset/server/OverriddenDecendants.java index f7201aa670..5fdbdd4105 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/server/OverriddenDecendants.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/server/OverriddenDecendants.java @@ -19,7 +19,7 @@ import com.vaadin.annotations.Widgetset; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.tests.widgetset.TestingWidgetSet; -import com.vaadin.v7.ui.TextArea; +import com.vaadin.ui.TextArea; /** * UI for testing that @DelegateToWidget works on derived widget states. @@ -35,21 +35,21 @@ public class OverriddenDecendants extends AbstractTestUI { TextArea normalTextArea = new TextArea(); normalTextArea.setRows(10); - normalTextArea.setWordwrap(true); + normalTextArea.setWordWrap(true); getLayout().addComponent(normalTextArea); // @DelegateToWidget will not work with overridden state in connector SuperTextArea superTextArea = new SuperTextArea(); superTextArea.setRows(10); - superTextArea.setWordwrap(true); + superTextArea.setWordWrap(true); getLayout().addComponent(superTextArea); // @DelegateToWidget will not work with overridden state in connector ExtraSuperTextArea extraSuperTextArea = new ExtraSuperTextArea(); extraSuperTextArea.setRows(10); - extraSuperTextArea.setWordwrap(true); + extraSuperTextArea.setWordWrap(true); getLayout().addComponent(extraSuperTextArea); } diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/server/SuperTextArea.java b/uitest/src/main/java/com/vaadin/tests/widgetset/server/SuperTextArea.java index ab5a8bcec2..6e73915e44 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/server/SuperTextArea.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/server/SuperTextArea.java @@ -1,7 +1,7 @@ package com.vaadin.tests.widgetset.server; import com.vaadin.tests.widgetset.client.superText.SuperTextAreaState; -import com.vaadin.v7.ui.TextArea; +import com.vaadin.ui.TextArea; /** * @author artamonov diff --git a/uitest/src/test/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtainTest.java b/uitest/src/test/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtainTest.java index f73206863e..d0aa567e20 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtainTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtainTest.java @@ -44,9 +44,8 @@ public class DragAndDropFocusObtainTest extends MultiBrowserTest { index++; } - // FIXME when old TextArea has been replaced with Vaadin 8 TextArea // Make sure we checked all fields - // Assert.assertEquals(8 + 1, index); + Assert.assertEquals(8 + 1, index); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/textarea/TextAreaSizeResettedTest.java b/uitest/src/test/java/com/vaadin/tests/components/textarea/TextAreaSizeResettedTest.java index fc4b4205cc..2850b3cf26 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/textarea/TextAreaSizeResettedTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/textarea/TextAreaSizeResettedTest.java @@ -16,7 +16,7 @@ import org.openqa.selenium.support.ui.ExpectedCondition; import com.vaadin.testbench.elements.ButtonElement; import com.vaadin.testbench.elements.LabelElement; -import com.vaadin.v7.testbench.customelements.TextAreaElement; +import com.vaadin.testbench.elements.TextAreaElement; import com.vaadin.testbench.elements.TextFieldElement; import com.vaadin.tests.tb3.MultiBrowserTest; diff --git a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicPersonFormTest.java b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicPersonFormTest.java index 9b7ebd8016..c00fda6f91 100644 --- a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicPersonFormTest.java +++ b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicPersonFormTest.java @@ -21,11 +21,11 @@ import com.vaadin.testbench.TestBenchElement; import com.vaadin.testbench.customelements.FixedNotificationElement; import com.vaadin.testbench.elements.ButtonElement; import com.vaadin.testbench.elements.CheckBoxElement; -import com.vaadin.v7.testbench.customelements.TableElement; import com.vaadin.testbench.elements.TableRowElement; -import com.vaadin.v7.testbench.customelements.TextAreaElement; import com.vaadin.tests.data.bean.Sex; import com.vaadin.tests.tb3.MultiBrowserTest; +import com.vaadin.v7.testbench.customelements.TableElement; +import com.vaadin.v7.testbench.customelements.TextAreaElement; import com.vaadin.v7.testbench.customelements.TextFieldElement; public abstract class BasicPersonFormTest extends MultiBrowserTest { diff --git a/uitest/src/test/java/com/vaadin/tests/themes/valo/ValoThemeUITest.java b/uitest/src/test/java/com/vaadin/tests/themes/valo/ValoThemeUITest.java index 4ed6e10a52..974e5ecdaa 100644 --- a/uitest/src/test/java/com/vaadin/tests/themes/valo/ValoThemeUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/themes/valo/ValoThemeUITest.java @@ -15,16 +15,20 @@ */ package com.vaadin.tests.themes.valo; +import java.util.List; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; +import org.openqa.selenium.remote.DesiredCapabilities; import com.vaadin.testbench.elements.ButtonElement; import com.vaadin.testbench.elements.CheckBoxElement; import com.vaadin.testbench.elements.CssLayoutElement; import com.vaadin.testbench.elements.LabelElement; -import com.vaadin.v7.testbench.customelements.TreeElement; +import com.vaadin.testbench.parallel.Browser; import com.vaadin.tests.tb3.MultiBrowserTest; +import com.vaadin.v7.testbench.customelements.TreeElement; public class ValoThemeUITest extends MultiBrowserTest { @@ -118,9 +122,10 @@ public class ValoThemeUITest extends MultiBrowserTest { } private void selectTreeNodeByCaption(String string) { - WebElement e = $(TreeElement.class).first().findElement( - By.xpath("//div[@class='v-tree-node-caption']//span[text()='" - + string + "']")); + WebElement e = $(TreeElement.class).first() + .findElement(By + .xpath("//div[@class='v-tree-node-caption']//span[text()='" + + string + "']")); e.click(); } @@ -312,4 +317,12 @@ public class ValoThemeUITest extends MultiBrowserTest { return false; } + @Override + public List<DesiredCapabilities> getBrowsersToTest() { + List<DesiredCapabilities> browsersToTest = getBrowserCapabilities( + Browser.IE11, Browser.FIREFOX, Browser.CHROME); + browsersToTest.add(PHANTOMJS2()); + return browsersToTest; + } + } diff --git a/uitest/src/test/java/com/vaadin/tests/widgetset/server/OverriddenDecendantsTest.java b/uitest/src/test/java/com/vaadin/tests/widgetset/server/OverriddenDecendantsTest.java index 1fd3ecc01e..78a11a1ff1 100644 --- a/uitest/src/test/java/com/vaadin/tests/widgetset/server/OverriddenDecendantsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/widgetset/server/OverriddenDecendantsTest.java @@ -21,7 +21,7 @@ import java.util.List; import org.junit.Test; -import com.vaadin.v7.testbench.customelements.TextAreaElement; +import com.vaadin.testbench.elements.TextAreaElement; import com.vaadin.tests.tb3.MultiBrowserTest; /** @@ -45,6 +45,5 @@ public class OverriddenDecendantsTest extends MultiBrowserTest { assertEquals("Text area was missing rows", "10", area.getAttribute("rows")); } - } } |