diff options
author | Denis Anisimov <denis@vaadin.com> | 2016-09-21 14:04:00 +0300 |
---|---|---|
committer | Denis Anisimov <denis@vaadin.com> | 2016-09-23 09:28:41 +0300 |
commit | d078a5d7dbdeea3d1bc479e2e9bf12dab30630cb (patch) | |
tree | 2948bc56d601d57ab70ffb078f097b492be093ae /uitest | |
parent | 4d16c72c32ce67204ff49a5b45c5ce3e5288b86e (diff) | |
download | vaadin-framework-d078a5d7dbdeea3d1bc479e2e9bf12dab30630cb.tar.gz vaadin-framework-d078a5d7dbdeea3d1bc479e2e9bf12dab30630cb.zip |
Rename PopupDateField to DateField #297.
DateField becomes abstract AbstractDateField, PopupDateField becomes
DateField
Change-Id: I3ac1e02d8754f0770b6a30222cb0fb2a1b9db07b
Diffstat (limited to 'uitest')
90 files changed, 587 insertions, 482 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/FocusingComponents.java b/uitest/src/main/java/com/vaadin/tests/FocusingComponents.java index 6173aea527..0de6a03986 100644 --- a/uitest/src/main/java/com/vaadin/tests/FocusingComponents.java +++ b/uitest/src/main/java/com/vaadin/tests/FocusingComponents.java @@ -1,9 +1,9 @@ package com.vaadin.tests; +import com.vaadin.tests.components.TestDateField; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.DateField; import com.vaadin.ui.GridLayout; import com.vaadin.v7.ui.AbstractSelect; import com.vaadin.v7.ui.ComboBox; @@ -31,7 +31,7 @@ public class FocusingComponents extends CustomComponent { addFocusableTest(f); addFocusableTest(new ComboBox()); addFocusableTest(new TextField()); - addFocusableTest(new DateField()); + addFocusableTest(new TestDateField()); addFocusableTest(new NativeSelect()); addFocusableTest(new ListSelect()); addFocusableTest(new OptionGroup()); diff --git a/uitest/src/main/java/com/vaadin/tests/PerformanceTestBasicComponentRendering.java b/uitest/src/main/java/com/vaadin/tests/PerformanceTestBasicComponentRendering.java index 2617da651e..4cbfbb806a 100644 --- a/uitest/src/main/java/com/vaadin/tests/PerformanceTestBasicComponentRendering.java +++ b/uitest/src/main/java/com/vaadin/tests/PerformanceTestBasicComponentRendering.java @@ -21,9 +21,9 @@ import java.util.Map; import com.vaadin.server.UserError; import com.vaadin.shared.ui.label.ContentMode; +import com.vaadin.tests.components.TestDateField; import com.vaadin.ui.Button; import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.DateField; import com.vaadin.ui.Label; import com.vaadin.ui.TabSheet; import com.vaadin.ui.VerticalLayout; @@ -85,7 +85,7 @@ public class PerformanceTestBasicComponentRendering extends CustomComponent { tf.setComponentError(new UserError("dsfjklsdf")); testContainer.addComponent(tf); - testContainer.addComponent(new DateField("DateField" + i)); + testContainer.addComponent(new TestDateField("DateField" + i)); testContainer.addComponent(new Button("Button" + i)); diff --git a/uitest/src/main/java/com/vaadin/tests/RandomLayoutStress.java b/uitest/src/main/java/com/vaadin/tests/RandomLayoutStress.java index a558532f6b..f15263203e 100644 --- a/uitest/src/main/java/com/vaadin/tests/RandomLayoutStress.java +++ b/uitest/src/main/java/com/vaadin/tests/RandomLayoutStress.java @@ -19,10 +19,11 @@ package com.vaadin.tests; import java.util.Random; import com.vaadin.server.ExternalResource; +import com.vaadin.tests.components.TestDateField; import com.vaadin.ui.AbstractComponent; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Button; import com.vaadin.ui.CustomLayout; -import com.vaadin.ui.DateField; import com.vaadin.ui.GridLayout; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; @@ -181,15 +182,15 @@ public class RandomLayoutStress extends com.vaadin.server.LegacyApplication { break; case 6: // Datefield - result = new DateField(); - ((DateField) result).setStyleName("calendar"); - ((DateField) result).setValue(new java.util.Date()); + result = new TestDateField(); + ((AbstractDateField) result).setStyleName("calendar"); + ((AbstractDateField) result).setValue(new java.util.Date()); result.setCaption("Calendar component " + caption); break; case 7: // Datefield - result = new DateField(); - ((DateField) result).setValue(new java.util.Date()); + result = new TestDateField(); + ((AbstractDateField) result).setValue(new java.util.Date()); result.setCaption("Calendar component " + caption); break; } diff --git a/uitest/src/main/java/com/vaadin/tests/TestCaptionWrapper.java b/uitest/src/main/java/com/vaadin/tests/TestCaptionWrapper.java index 4519b28a6d..108ed6b074 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestCaptionWrapper.java +++ b/uitest/src/main/java/com/vaadin/tests/TestCaptionWrapper.java @@ -21,18 +21,20 @@ import com.vaadin.server.ErrorMessage; import com.vaadin.server.ExternalResource; import com.vaadin.server.UserError; import com.vaadin.shared.ui.label.ContentMode; +import com.vaadin.tests.components.TestDateField; import com.vaadin.ui.AbstractComponent; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Button; import com.vaadin.ui.CheckBox; import com.vaadin.ui.Component.Listener; import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.DateField; import com.vaadin.ui.Embedded; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Layout; import com.vaadin.ui.Link; import com.vaadin.ui.Panel; +import com.vaadin.ui.RichTextArea; import com.vaadin.ui.Slider; import com.vaadin.ui.TabSheet; import com.vaadin.ui.Upload; @@ -41,7 +43,6 @@ import com.vaadin.ui.Window; import com.vaadin.v7.ui.NativeSelect; import com.vaadin.v7.ui.OptionGroup; import com.vaadin.v7.ui.ProgressIndicator; -import com.vaadin.ui.RichTextArea; import com.vaadin.v7.ui.Select; import com.vaadin.v7.ui.Table; import com.vaadin.v7.ui.TextField; @@ -119,7 +120,7 @@ public class TestCaptionWrapper extends CustomComponent implements Listener { test(layout, button); button.addListener(this); - final DateField df = new DateField("DateField " + count++); + final AbstractDateField df = new TestDateField("DateField " + count++); test(layout, df); final CheckBox cb = new CheckBox("Checkbox " + count++); diff --git a/uitest/src/main/java/com/vaadin/tests/TestDateField.java b/uitest/src/main/java/com/vaadin/tests/TestDateField.java index edc4b863cf..7a63c628b4 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestDateField.java +++ b/uitest/src/main/java/com/vaadin/tests/TestDateField.java @@ -21,8 +21,8 @@ import java.util.Locale; import com.vaadin.server.ClassResource; import com.vaadin.server.ErrorMessage; import com.vaadin.server.UserError; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.DateField; import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; @@ -34,7 +34,7 @@ public class TestDateField extends CustomComponent { VerticalLayout main = new VerticalLayout(); - DateField df; + AbstractDateField df; public TestDateField() { setCompositionRoot(main); @@ -45,7 +45,7 @@ public class TestDateField extends CustomComponent { main.removeAllComponents(); main.addComponent(new Label("DateField")); - df = new DateField(); + df = new com.vaadin.tests.components.TestDateField(); main.addComponent(df); final ErrorMessage errorMsg = new UserError("User error " + df); @@ -58,19 +58,23 @@ public class TestDateField extends CustomComponent { df.addStyleName("thisShouldBeHarmless"); // Another test: locale - final DateField df1 = new DateField("US locale"); + final AbstractDateField df1 = new com.vaadin.tests.components.TestDateField( + "US locale"); main.addComponent(df1); df1.setLocale(new Locale("en", "US")); - final DateField df2 = new DateField("DE locale"); + final AbstractDateField df2 = new com.vaadin.tests.components.TestDateField( + "DE locale"); main.addComponent(df2); df2.setLocale(new Locale("de", "DE")); - final DateField df3 = new DateField("RU locale"); + final AbstractDateField df3 = new com.vaadin.tests.components.TestDateField( + "RU locale"); main.addComponent(df3); df3.setLocale(new Locale("ru", "RU")); - final DateField df4 = new DateField("FI locale"); + final AbstractDateField df4 = new com.vaadin.tests.components.TestDateField( + "FI locale"); main.addComponent(df4); df4.setLocale(new Locale("fi", "FI")); } diff --git a/uitest/src/main/java/com/vaadin/tests/TestForAlignments.java b/uitest/src/main/java/com/vaadin/tests/TestForAlignments.java index 1d743a3c5f..b937c14120 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestForAlignments.java +++ b/uitest/src/main/java/com/vaadin/tests/TestForAlignments.java @@ -16,10 +16,11 @@ package com.vaadin.tests; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.DateField; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.VerticalLayout; import com.vaadin.v7.ui.TextField; @@ -36,8 +37,8 @@ public class TestForAlignments extends CustomComponent { final Button b4 = new Button("Top"); final TextField t1 = new TextField("Right aligned"); final TextField t2 = new TextField("Bottom aligned"); - final DateField d1 = new DateField("Center aligned"); - final DateField d2 = new DateField("Center aligned"); + final AbstractDateField d1 = new TestDateField("Center aligned"); + final AbstractDateField d2 = new TestDateField("Center aligned"); final VerticalLayout vert = new VerticalLayout(); vert.addComponent(b1); diff --git a/uitest/src/main/java/com/vaadin/tests/TestForBasicApplicationLayout.java b/uitest/src/main/java/com/vaadin/tests/TestForBasicApplicationLayout.java index 5b1b5c7f06..d5d70f65f5 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestForBasicApplicationLayout.java +++ b/uitest/src/main/java/com/vaadin/tests/TestForBasicApplicationLayout.java @@ -20,11 +20,12 @@ import java.util.Locale; import com.vaadin.server.Sizeable; import com.vaadin.shared.ui.datefield.Resolution; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.DateField; import com.vaadin.ui.HorizontalSplitPanel; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; @@ -81,7 +82,7 @@ public class TestForBasicApplicationLayout extends CustomComponent { controls.addComponent(click); controls.addComponent(click2); reportLayout.addComponent(controls); - final DateField cal = new DateField(); + final AbstractDateField cal = new TestDateField(); cal.setResolution(Resolution.DAY); cal.setLocale(new Locale("en", "US")); reportLayout.addComponent(cal); diff --git a/uitest/src/main/java/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java b/uitest/src/main/java/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java index 80dbee4cfb..daf772f45b 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java +++ b/uitest/src/main/java/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java @@ -19,11 +19,11 @@ package com.vaadin.tests; import java.util.Collection; import java.util.Vector; +import com.vaadin.tests.components.TestDateField; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Component; import com.vaadin.ui.ComponentContainer; import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.DateField; import com.vaadin.ui.Panel; import com.vaadin.ui.VerticalLayout; import com.vaadin.v7.ui.Select; @@ -99,7 +99,7 @@ public class TestSelectAndDatefieldInDeepLayouts extends CustomComponent { } Component getDateField() { - return new DateField(getCaption("datefield")); + return new TestDateField(getCaption("datefield")); } private Collection<String> getSelectOptions() { diff --git a/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentContainerTest.java b/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentContainerTest.java index f385dfe84c..f50be07af9 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentContainerTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentContainerTest.java @@ -14,7 +14,7 @@ import com.vaadin.ui.HasComponents.ComponentDetachListener; import com.vaadin.ui.HorizontalSplitPanel; import com.vaadin.ui.InlineDateField; import com.vaadin.ui.NativeButton; -import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.DateField; import com.vaadin.ui.TabSheet; import com.vaadin.ui.VerticalSplitPanel; import com.vaadin.ui.RichTextArea; @@ -85,7 +85,7 @@ public abstract class AbstractComponentContainerTest<T extends AbstractComponent private Command<T, ComponentSize> addPopupDateFieldCommand = new Command<T, ComponentSize>() { @Override public void execute(T c, ComponentSize size, Object data) { - PopupDateField tf = new PopupDateField(); + DateField tf = new DateField(); c.addComponent(tf); size.apply(tf); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/FocusAndBlurListeners.java b/uitest/src/main/java/com/vaadin/tests/components/FocusAndBlurListeners.java index c16b811038..a82044bf57 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/FocusAndBlurListeners.java +++ b/uitest/src/main/java/com/vaadin/tests/components/FocusAndBlurListeners.java @@ -6,12 +6,12 @@ import com.vaadin.event.FieldEvents.BlurEvent; import com.vaadin.event.FieldEvents.BlurListener; import com.vaadin.event.FieldEvents.FocusEvent; import com.vaadin.event.FieldEvents.FocusListener; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.CheckBox; import com.vaadin.ui.ComboBox; -import com.vaadin.ui.DateField; import com.vaadin.ui.Label; import com.vaadin.ui.Layout; import com.vaadin.ui.NativeButton; @@ -49,7 +49,7 @@ public class FocusAndBlurListeners extends TestBase { TextField tf = new TextField("TextField"); l.addComponent(tf); - DateField df = new DateField("DateField"); + AbstractDateField df = new TestDateField("DateField"); l.addComponent(df); ComboBox cb = new ComboBox("ComboBox"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/TestDateField.java b/uitest/src/main/java/com/vaadin/tests/components/TestDateField.java new file mode 100644 index 0000000000..26353e192b --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/TestDateField.java @@ -0,0 +1,57 @@ +/* + * Copyright 2000-2016 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.components; + +import java.util.Date; + +import com.vaadin.ui.AbstractDateField; + +/** + * @author Vaadin Ltd + * + */ +public class TestDateField extends AbstractDateField { + + /** + * Constructs an empty <code>DateField</code> with no caption. + */ + public TestDateField() { + } + + /** + * Constructs an empty <code>DateField</code> with caption. + * + * @param caption + * the caption of the datefield. + */ + public TestDateField(String caption) { + setCaption(caption); + } + + /** + * Constructs a new <code>DateField</code> with the given caption and + * initial text contents. + * + * @param caption + * the caption <code>String</code> for the editor. + * @param value + * the Date value. + */ + public TestDateField(String caption, Date value) { + setValue(value); + setCaption(caption); + } +} diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/AbstractDateFieldTest.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/AbstractDateFieldTest.java new file mode 100644 index 0000000000..0d0e88b3cb --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/AbstractDateFieldTest.java @@ -0,0 +1,146 @@ +package com.vaadin.tests.components.datefield; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.Locale; + +import com.vaadin.shared.ui.datefield.Resolution; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.tests.components.abstractfield.AbstractFieldTest; +import com.vaadin.ui.AbstractDateField; + +public class AbstractDateFieldTest<T extends AbstractDateField> + extends AbstractFieldTest<T, Date> { + + @SuppressWarnings("unchecked") + @Override + protected Class<T> getTestClass() { + return (Class<T>) TestDateField.class; + } + + private Command<T, Date> setValue = new Command<T, Date>() { + + @Override + public void execute(T c, Date value, Object data) { + c.setValue(value); + } + }; + + @Override + protected void createActions() { + super.createActions(); + createResolutionSelectAction(CATEGORY_FEATURES); + createBooleanAction("Lenient", CATEGORY_FEATURES, false, + lenientCommand); + createBooleanAction("Show week numbers", CATEGORY_FEATURES, false, + weekNumberCommand); + createDateFormatSelectAction(CATEGORY_FEATURES); + createSetValueAction(CATEGORY_FEATURES); + + } + + private void createSetValueAction(String category) { + LinkedHashMap<String, Date> options = new LinkedHashMap<>(); + options.put("(null)", null); + options.put("(current time)", new Date()); + Calendar c = Calendar.getInstance(new Locale("fi", "FI")); + c.clear(); + c.set(2010, 12 - 1, 12, 12, 0, 0); + c.set(Calendar.MILLISECOND, 0); + options.put("2010-12-12 12:00:00.000", c.getTime()); + c.clear(); + c.set(2000, 1 - 1, 2, 3, 4, 5); + c.set(Calendar.MILLISECOND, 6); + options.put("2000-01-02 03:04:05.006", c.getTime()); + createMultiClickAction("Set value", category, options, setValue, null); + } + + private void createDateFormatSelectAction(String category) { + LinkedHashMap<String, String> options = new LinkedHashMap<>(); + + options.put("-", null); + options.put("d M yyyy", "d M yyyy"); + options.put("d MM yyyy", "d MM yyyy"); + options.put("d MMM yyyy", "d MMM yyyy"); + options.put("d MMMM yyyy", "d MMMM yyyy"); + options.put("dd M yyyy", "dd M yyyy"); + options.put("ddd M yyyy", "ddd M yyyy"); + options.put("d M y", "d M y"); + options.put("d M yy", "d M yy"); + options.put("d M yyy", "d M yyy"); + options.put("d M yyyy", "d M yyyy"); + options.put("d M 'custom text' yyyy", "d M 'custom text' yyyy"); + options.put("'day:'d', month:'M', year: 'yyyy", + "'day:'d', month:'M', year: 'yyyy"); + options.put(getDatePattern(new Locale("fi", "FI"), DateFormat.LONG), + getDatePattern(new Locale("fi", "FI"), DateFormat.LONG)); + options.put(getDatePattern(new Locale("fi", "FI"), DateFormat.MEDIUM), + getDatePattern(new Locale("fi", "FI"), DateFormat.MEDIUM)); + options.put(getDatePattern(new Locale("fi", "FI"), DateFormat.SHORT), + getDatePattern(new Locale("fi", "FI"), DateFormat.SHORT)); + + createSelectAction("Date format", category, options, "-", + dateFormatCommand); + + } + + private String getDatePattern(Locale locale, int dateStyle) { + DateFormat dateFormat = DateFormat.getDateInstance(dateStyle, locale); + + if (dateFormat instanceof SimpleDateFormat) { + String pattern = ((SimpleDateFormat) dateFormat).toPattern(); + return pattern; + } + return null; + + } + + private void createResolutionSelectAction(String category) { + LinkedHashMap<String, Resolution> options = new LinkedHashMap<>(); + options.put("Year", Resolution.YEAR); + options.put("Month", Resolution.MONTH); + options.put("Day", Resolution.DAY); + options.put("Hour", Resolution.HOUR); + options.put("Min", Resolution.MINUTE); + options.put("Sec", Resolution.SECOND); + + createSelectAction("Resolution", category, options, "Year", + resolutionCommand); + } + + private Command<T, Resolution> resolutionCommand = new Command<T, Resolution>() { + + @Override + public void execute(T c, Resolution value, Object data) { + c.setResolution(value); + + } + }; + private Command<T, Boolean> lenientCommand = new Command<T, Boolean>() { + + @Override + public void execute(T c, Boolean value, Object data) { + c.setLenient(false); + + } + }; + private Command<T, Boolean> weekNumberCommand = new Command<T, Boolean>() { + + @Override + public void execute(T c, Boolean value, Object data) { + c.setShowISOWeekNumbers(value); + + } + }; + private Command<T, String> dateFormatCommand = new Command<T, String>() { + + @Override + public void execute(T c, String value, Object data) { + c.setDateFormat(value); + } + }; + +} diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/AriaDisabled.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/AriaDisabled.java index bc0ede9470..86418f3734 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/AriaDisabled.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/AriaDisabled.java @@ -17,7 +17,8 @@ package com.vaadin.tests.components.datefield; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.DateField; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.VerticalLayout; public class AriaDisabled extends AbstractTestUI { @@ -28,12 +29,13 @@ public class AriaDisabled extends AbstractTestUI { content.setMargin(true); content.setSpacing(true); - final DateField disabledDateField = new DateField("Disabled DateField"); + final AbstractDateField disabledDateField = new TestDateField( + "Disabled DateField"); disabledDateField.setEnabled(false); setContent(content); content.addComponent(disabledDateField); - content.addComponent(new DateField("Enabled DateField")); + content.addComponent(new TestDateField("Enabled DateField")); } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/CustomDateFormat.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/CustomDateFormat.java index 579df7f1a8..aa32fd3c4f 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/CustomDateFormat.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/CustomDateFormat.java @@ -5,7 +5,8 @@ import java.util.Locale; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.DateField; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; public class CustomDateFormat extends TestBase { @@ -16,7 +17,7 @@ public class CustomDateFormat extends TestBase { Calendar cal = Calendar.getInstance(); cal.set(2010, 0, 1); - DateField df = new DateField(); + AbstractDateField df = new TestDateField(); df.setResolution(Resolution.DAY); df.setLocale(locale); df.setWidth("300px"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/CustomDateFormatEEE.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/CustomDateFormatEEE.java index 575d68f291..afbd6e828f 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/CustomDateFormatEEE.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/CustomDateFormatEEE.java @@ -21,7 +21,8 @@ import java.util.Locale; import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.DateField; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.VerticalLayout; public class CustomDateFormatEEE extends AbstractTestUI { @@ -31,7 +32,8 @@ public class CustomDateFormatEEE extends AbstractTestUI { Calendar cal = Calendar.getInstance(); cal.set(2014, 2, 14); // Friday - DateField df = new DateField("Should display 14/03/2014 Fri"); + AbstractDateField df = new TestDateField( + "Should display 14/03/2014 Fri"); df.setResolution(Resolution.DAY); df.setLocale(new Locale("en", "US")); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/CustomDateFormats.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/CustomDateFormats.java index 534c92d5f4..91a76f5269 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/CustomDateFormats.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/CustomDateFormats.java @@ -9,8 +9,9 @@ import java.util.Set; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.TestBase; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Component; -import com.vaadin.ui.DateField; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.v7.data.Item; @@ -141,7 +142,7 @@ public class CustomDateFormats extends TestBase { Label serversideValueLabel = new Label(); - DateField df = new DateField(); + AbstractDateField df = new TestDateField(); df.setResolution(Resolution.DAY); df.setLocale(locale); df.setWidth("300px"); @@ -159,7 +160,7 @@ public class CustomDateFormats extends TestBase { df.setData(new Data(serversideValueLabel, pattern)); df.setValue(cal.getTime()); df.addValueChangeListener(event -> updateServerSideLabel( - (DateField) event.getConnector())); + (AbstractDateField) event.getConnector())); Label patternLabel = new Label(pattern); patternLabel.setWidth(null); @@ -181,7 +182,7 @@ public class CustomDateFormats extends TestBase { updateServerSideLabel(df); } - private void updateServerSideLabel(DateField df) { + private void updateServerSideLabel(AbstractDateField df) { Data data = (Data) df.getData(); String pattern = data.pattern; Locale locale = df.getLocale(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldChangeResolution.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldChangeResolution.java index 17b26b8288..ba8da59dfb 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldChangeResolution.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldChangeResolution.java @@ -21,10 +21,10 @@ import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.DateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; -import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.DateField; public class DateFieldChangeResolution extends AbstractTestUI { @@ -34,7 +34,7 @@ public class DateFieldChangeResolution extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { - final DateField dateField = new PopupDateField("Enter date"); + final AbstractDateField dateField = new DateField("Enter date"); dateField.setResolution(Resolution.YEAR); dateField.setId(DATEFIELD_ID); dateField.setImmediate(true); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldClose.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldClose.java index 1211646d4e..df15431d27 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldClose.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldClose.java @@ -17,7 +17,8 @@ package com.vaadin.tests.components.datefield; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.DateField; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; public class DateFieldClose extends AbstractTestUI { @@ -25,7 +26,7 @@ public class DateFieldClose extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { - final DateField df = new DateField(); + final AbstractDateField df = new TestDateField(); df.setId(DATEFIELD_ID); addComponent(df); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldDayResolutionOffset.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldDayResolutionOffset.java index 4a68e648e6..2e4d899f16 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldDayResolutionOffset.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldDayResolutionOffset.java @@ -8,7 +8,8 @@ import java.util.TimeZone; import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.DateField; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Label; public class DateFieldDayResolutionOffset extends AbstractTestUI { @@ -22,7 +23,7 @@ public class DateFieldDayResolutionOffset extends AbstractTestUI { final TimeZone timezone = TimeZone.getTimeZone("GMT"); final SimpleDateFormat dateformat = getDateFormat(timezone); - final DateField dateField = getDateField(timezone, dateformat); + final AbstractDateField dateField = getDateField(timezone, dateformat); addComponent(dateValue); addComponent(dateField); @@ -31,9 +32,9 @@ public class DateFieldDayResolutionOffset extends AbstractTestUI { .setValue(dateformat.format(dateField.getValue()))); } - private DateField getDateField(TimeZone timezone, + private AbstractDateField getDateField(TimeZone timezone, SimpleDateFormat dateformat) { - final DateField dateField = new DateField(); + final AbstractDateField dateField = new TestDateField(); try { Date initialDate = dateformat.parse(initialDateString); dateField.setResolution(Resolution.DAY); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldConnector.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldElementUI.java index 5cdc8f1396..9a41acc6d5 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldConnector.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldElementUI.java @@ -2,14 +2,14 @@ package com.vaadin.tests.components.datefield; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.components.TestDateField; import com.vaadin.ui.DateField; -import com.vaadin.ui.PopupDateField; -public class PopupDateFieldConnector extends AbstractTestUI { +public class DateFieldElementUI extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { - addComponent(new PopupDateField()); addComponent(new DateField()); + addComponent(new TestDateField()); } @Override @@ -19,6 +19,6 @@ public class PopupDateFieldConnector extends AbstractTestUI { @Override protected String getTestDescription() { - return "PopupDateFieldElement should be accessible using TB4 PopupDateFieldElement."; + return "DateFieldElement should be accessible using TB4 DateFieldElement."; } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldExtendedRange.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldExtendedRange.java index 620b9cf12a..2a9b71ccaa 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldExtendedRange.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldExtendedRange.java @@ -8,10 +8,10 @@ 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.ui.DateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.GridLayout; import com.vaadin.ui.InlineDateField; -import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.DateField; @SuppressWarnings("serial") public class DateFieldExtendedRange extends TestBase { @@ -26,7 +26,7 @@ public class DateFieldExtendedRange extends TestBase { layout.setWidth("600px"); layout.setSpacing(true); - final DateField[] fields = new DateField[6]; + final AbstractDateField[] fields = new AbstractDateField[6]; Locale fi = new Locale("fi", "FI"); Locale us = new Locale("en", "US"); @@ -43,7 +43,7 @@ public class DateFieldExtendedRange extends TestBase { "Finnish locale with week numbers"); fields[5].setShowISOWeekNumbers(true); - for (DateField f : fields) { + for (AbstractDateField f : fields) { layout.addComponent(f); } @@ -53,7 +53,7 @@ public class DateFieldExtendedRange extends TestBase { @Override public void buttonClick(ClickEvent event) { date.set(2010, 1, 16); - for (DateField f : fields) { + for (AbstractDateField f : fields) { f.setValue(date.getTime()); } } @@ -70,9 +70,9 @@ public class DateFieldExtendedRange extends TestBase { return 6718; } - private DateField makeDateField(boolean isPopup, Locale locale, + private AbstractDateField makeDateField(boolean isPopup, Locale locale, String caption) { - DateField df = isPopup ? new PopupDateField() : new InlineDateField(); + AbstractDateField df = isPopup ? new DateField() : new InlineDateField(); df.setResolution(Resolution.DAY); df.setValue(date.getTime()); df.setLocale(locale); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldIsValid.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldIsValid.java index f99c628400..f38e641b8b 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldIsValid.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldIsValid.java @@ -5,7 +5,8 @@ import java.util.Date; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUIWithLog; -import com.vaadin.ui.DateField; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; public class DateFieldIsValid extends AbstractTestUIWithLog { @@ -25,7 +26,7 @@ public class DateFieldIsValid extends AbstractTestUIWithLog { @Override protected void setup(VaadinRequest request) { - final DateField dateField = new DateField("Insert Date: "); + final AbstractDateField dateField = new TestDateField("Insert Date: "); dateField.setImmediate(true); dateField.setDateFormat(pattern); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldKeyboardInput.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldKeyboardInput.java index 1e3302333c..24b75d0603 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldKeyboardInput.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldKeyboardInput.java @@ -22,7 +22,7 @@ import java.util.Locale; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.Label; -import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.DateField; public class DateFieldKeyboardInput extends AbstractTestUI { @@ -30,7 +30,7 @@ public class DateFieldKeyboardInput extends AbstractTestUI { protected void setup(VaadinRequest request) { Calendar c = new GregorianCalendar(Locale.ENGLISH); c.set(2014, 0, 15); - final PopupDateField dateField = new PopupDateField("Select date", + final DateField dateField = new DateField("Select date", c.getTime()); dateField.setDateFormat("dd.MM.yyyy"); addComponent(dateField); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldLocale.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldLocale.java index 38bb02bc71..cf524f375c 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldLocale.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldLocale.java @@ -5,16 +5,17 @@ import java.util.Locale; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.TestBase; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.DateField; public class DateFieldLocale extends TestBase { @Override public void setup() { - final DateField dateField = new DateField("DateField"); + final AbstractDateField dateField = new TestDateField("DateField"); dateField.setLocale(new Locale("fi", "FI")); dateField.setCaption(dateField.getLocale().toString()); dateField.setValue(new Date(2013 - 1900, 7 - 1, 27)); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldMinResolution.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldMinResolution.java index d153dff443..9b6faf201a 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldMinResolution.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldMinResolution.java @@ -5,7 +5,8 @@ import java.util.Calendar; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.DateField; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.InlineDateField; import com.vaadin.ui.Label; @@ -20,7 +21,7 @@ public class DateFieldMinResolution extends TestBase { Calendar cal = Calendar.getInstance(); cal.set(2019, 1, 1, 1, 1); - DateField df = new DateField("foo"); + AbstractDateField df = new TestDateField("foo"); df.setResolution(Resolution.MINUTE); df.setDateFormat(dformat.toPattern()); df.setValue(cal.getTime()); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPopupClosing.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPopupClosing.java index dc8e8164b7..0ac843ef31 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPopupClosing.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPopupClosing.java @@ -17,7 +17,8 @@ package com.vaadin.tests.components.datefield; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.DateField; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; public class DateFieldPopupClosing extends AbstractTestUI { @@ -25,7 +26,7 @@ public class DateFieldPopupClosing extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { - final DateField df = new DateField(); + final AbstractDateField df = new TestDateField(); df.setId(DATEFIELD_ID); addComponent(df); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPopupClosingOnDetach.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPopupClosingOnDetach.java index 1526eb4a48..738bb9a9d8 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPopupClosingOnDetach.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPopupClosingOnDetach.java @@ -22,7 +22,8 @@ import com.vaadin.event.LayoutEvents.LayoutClickEvent; import com.vaadin.event.LayoutEvents.LayoutClickListener; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.DateField; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; public class DateFieldPopupClosingOnDetach extends AbstractTestUI { @@ -31,7 +32,7 @@ public class DateFieldPopupClosingOnDetach extends AbstractTestUI { // Use polling to notice the removal of DateField. getUI().setPollInterval(500); - final DateField df = new DateField(); + final AbstractDateField df = new TestDateField(); getLayout().addLayoutClickListener(new LayoutClickListener() { @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPopupOffScreen.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPopupOffScreen.java index 1f5eb4b394..afcc5295e4 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPopupOffScreen.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPopupOffScreen.java @@ -5,8 +5,9 @@ import java.util.Locale; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.AbstractTestCase; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Alignment; -import com.vaadin.ui.DateField; import com.vaadin.ui.GridLayout; import com.vaadin.ui.LegacyWindow; @@ -29,7 +30,7 @@ public class DateFieldPopupOffScreen extends AbstractTestCase { GridLayout mainLayout = new GridLayout(3, 3); mainLayout.setSizeFull(); - DateField df; + AbstractDateField df; df = createDateField(); mainLayout.addComponent(df, 2, 0); @@ -55,8 +56,8 @@ public class DateFieldPopupOffScreen extends AbstractTestCase { setMainWindow(mainWindow); } - private DateField createDateField() { - DateField df = new DateField(); + private AbstractDateField createDateField() { + AbstractDateField df = new TestDateField(); df.setLocale(new Locale("fi")); df.setResolution(Resolution.SECOND); df.setDescription( diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPopupPosition.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPopupPosition.java index f7cd0ce726..af5464f24c 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPopupPosition.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPopupPosition.java @@ -19,7 +19,7 @@ import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; -import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.DateField; /** * Test UI for date field Popup calendar. @@ -35,7 +35,7 @@ public abstract class DateFieldPopupPosition extends AbstractTestUI { Label gap = new Label(); gap.setWidth(250, Unit.PIXELS); layout.addComponent(gap); - PopupDateField field = new PopupDateField(); + DateField field = new DateField(); layout.addComponent(field); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.java index f81e12151b..b3d2102e7a 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.java @@ -1,16 +1,17 @@ package com.vaadin.tests.components.datefield; import com.vaadin.tests.components.TestBase; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.DateField; import com.vaadin.ui.InlineDateField; public class DateFieldPrimaryStyleNames extends TestBase { @Override protected void setup() { - final DateField df = new DateField(); + final AbstractDateField df = new TestDateField(); df.setPrimaryStyleName("my-datefield"); addComponent(df); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldRanges.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldRanges.java index d4912b7ebd..5db5b815e4 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldRanges.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldRanges.java @@ -8,10 +8,11 @@ import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.MarginInfo; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.CheckBox; -import com.vaadin.ui.DateField; import com.vaadin.ui.GridLayout; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.InlineDateField; @@ -30,17 +31,17 @@ public class DateFieldRanges extends AbstractTestUI { private Label label = new Label(); private NativeSelect resoSelect = new NativeSelect("Resolution"); - private DateField fromRange = new DateField("Range start"); - private DateField toRange = new DateField("Range end"); - private DateField valueDF = new DateField("Value"); + private AbstractDateField fromRange = new TestDateField("Range start"); + private AbstractDateField toRange = new TestDateField("Range end"); + private AbstractDateField valueDF = new TestDateField("Value"); private CheckBox immediateCB = new CheckBox("Immediate"); private Button recreate = new Button("Recreate static datefields"); private Button clearRangeButton = new Button("Clear range"); private GridLayout currentStaticContainer; - private DateField inlineDynamicDateField; - private DateField dynamicDateField; + private AbstractDateField inlineDynamicDateField; + private AbstractDateField dynamicDateField; private Calendar createCalendar() { Calendar c = Calendar.getInstance(); @@ -183,11 +184,11 @@ public class DateFieldRanges extends AbstractTestUI { endCal.add(Calendar.DATE, 30); GridLayout gl = new GridLayout(2, 2); gl.setSpacing(true); - DateField df = createDateField(startCal.getTime(), endCal.getTime(), - null, Resolution.DAY, false); + AbstractDateField df = createDateField(startCal.getTime(), + endCal.getTime(), null, Resolution.DAY, false); gl.addComponent(df); - DateField inline = createDateField(startCal.getTime(), endCal.getTime(), - null, Resolution.DAY, true); + AbstractDateField inline = createDateField(startCal.getTime(), + endCal.getTime(), null, Resolution.DAY, true); gl.addComponent(inline); inline.setId("staticInline"); VerticalLayout vl = new VerticalLayout(); @@ -195,18 +196,18 @@ public class DateFieldRanges extends AbstractTestUI { return gl; } - private DateField createDateField(Date rangeStart, Date rangeEnd, + private AbstractDateField createDateField(Date rangeStart, Date rangeEnd, Date value, Resolution resolution, boolean inline) { - DateField df = null; + AbstractDateField df = null; if (inline) { df = new InlineDateField(); } else { - df = new DateField(); + df = new TestDateField(); } - final DateField gg = df; + final AbstractDateField gg = df; updateValuesForDateField(df); df.addValueChangeListener(event -> { @@ -223,7 +224,7 @@ public class DateFieldRanges extends AbstractTestUI { } - private void updateValuesForDateField(DateField df) { + private void updateValuesForDateField(AbstractDateField df) { Date fromVal = fromRange.getValue(); Date toVal = toRange.getValue(); Date value = valueDF.getValue(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldReadOnly.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldReadOnly.java index 9addeca5cf..339eff6972 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldReadOnly.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldReadOnly.java @@ -6,10 +6,11 @@ import java.util.Locale; import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.DateField; public class DateFieldReadOnly extends AbstractTestUI { @@ -25,7 +26,8 @@ public class DateFieldReadOnly extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { - final DateField timeField = new DateField("A read-only datefield"); + final AbstractDateField timeField = new TestDateField( + "A read-only datefield"); timeField.setResolution(Resolution.SECOND); timeField.setDateFormat("HH:mm:ss"); timeField.setCaption(null); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTest.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTest.java index 155ce35059..01e6500d35 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTest.java @@ -1,145 +1,52 @@ package com.vaadin.tests.components.datefield; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; import java.util.LinkedHashMap; -import java.util.Locale; -import com.vaadin.shared.ui.datefield.Resolution; -import com.vaadin.tests.components.abstractfield.AbstractFieldTest; import com.vaadin.ui.DateField; -public class DateFieldTest<T extends DateField> - extends AbstractFieldTest<T, Date> { +public class DateFieldTest extends AbstractDateFieldTest<DateField> { - @SuppressWarnings("unchecked") @Override - protected Class<T> getTestClass() { - return (Class<T>) DateField.class; + protected Class<DateField> getTestClass() { + return DateField.class; } - private Command<T, Date> setValue = new Command<T, Date>() { - - @Override - public void execute(T c, Date value, Object data) { - c.setValue(value); - } - }; - @Override protected void createActions() { super.createActions(); - createResolutionSelectAction(CATEGORY_FEATURES); - createBooleanAction("Lenient", CATEGORY_FEATURES, false, - lenientCommand); - createBooleanAction("Show week numbers", CATEGORY_FEATURES, false, - weekNumberCommand); - createDateFormatSelectAction(CATEGORY_FEATURES); - createSetValueAction(CATEGORY_FEATURES); - - } - private void createSetValueAction(String category) { - LinkedHashMap<String, Date> options = new LinkedHashMap<>(); - options.put("(null)", null); - options.put("(current time)", new Date()); - Calendar c = Calendar.getInstance(new Locale("fi", "FI")); - c.clear(); - c.set(2010, 12 - 1, 12, 12, 0, 0); - c.set(Calendar.MILLISECOND, 0); - options.put("2010-12-12 12:00:00.000", c.getTime()); - c.clear(); - c.set(2000, 1 - 1, 2, 3, 4, 5); - c.set(Calendar.MILLISECOND, 6); - options.put("2000-01-02 03:04:05.006", c.getTime()); - createMultiClickAction("Set value", category, options, setValue, null); + createInputPromptSelectAction(CATEGORY_FEATURES); + createTextEnabledAction(CATEGORY_FEATURES); } - private void createDateFormatSelectAction(String category) { + private void createInputPromptSelectAction(String category) { LinkedHashMap<String, String> options = new LinkedHashMap<>(); + options.put("<none>", null); + options.put("Please enter date", "Please enter date"); + options.put("åäöÅÄÖ", "åäöÅÄÖ"); - options.put("-", null); - options.put("d M yyyy", "d M yyyy"); - options.put("d MM yyyy", "d MM yyyy"); - options.put("d MMM yyyy", "d MMM yyyy"); - options.put("d MMMM yyyy", "d MMMM yyyy"); - options.put("dd M yyyy", "dd M yyyy"); - options.put("ddd M yyyy", "ddd M yyyy"); - options.put("d M y", "d M y"); - options.put("d M yy", "d M yy"); - options.put("d M yyy", "d M yyy"); - options.put("d M yyyy", "d M yyyy"); - options.put("d M 'custom text' yyyy", "d M 'custom text' yyyy"); - options.put("'day:'d', month:'M', year: 'yyyy", - "'day:'d', month:'M', year: 'yyyy"); - options.put(getDatePattern(new Locale("fi", "FI"), DateFormat.LONG), - getDatePattern(new Locale("fi", "FI"), DateFormat.LONG)); - options.put(getDatePattern(new Locale("fi", "FI"), DateFormat.MEDIUM), - getDatePattern(new Locale("fi", "FI"), DateFormat.MEDIUM)); - options.put(getDatePattern(new Locale("fi", "FI"), DateFormat.SHORT), - getDatePattern(new Locale("fi", "FI"), DateFormat.SHORT)); + createSelectAction("Input prompt", category, options, "<none>", + new Command<DateField, String>() { - createSelectAction("Date format", category, options, "-", - dateFormatCommand); + @Override + public void execute(DateField c, String value, + Object data) { + c.setInputPrompt(value); + } + }); } - private String getDatePattern(Locale locale, int dateStyle) { - DateFormat dateFormat = DateFormat.getDateInstance(dateStyle, locale); + private void createTextEnabledAction(String category) { + this.createBooleanAction("Text field enabled", category, true, + new Command<DateField, Boolean>() { - if (dateFormat instanceof SimpleDateFormat) { - String pattern = ((SimpleDateFormat) dateFormat).toPattern(); - return pattern; - } - return null; + @Override + public void execute(DateField c, Boolean value, + Object data) { + c.setTextFieldEnabled(value); + } + }); } - - private void createResolutionSelectAction(String category) { - LinkedHashMap<String, Resolution> options = new LinkedHashMap<>(); - options.put("Year", Resolution.YEAR); - options.put("Month", Resolution.MONTH); - options.put("Day", Resolution.DAY); - options.put("Hour", Resolution.HOUR); - options.put("Min", Resolution.MINUTE); - options.put("Sec", Resolution.SECOND); - - createSelectAction("Resolution", category, options, "Year", - resolutionCommand); - } - - private Command<T, Resolution> resolutionCommand = new Command<T, Resolution>() { - - @Override - public void execute(T c, Resolution value, Object data) { - c.setResolution(value); - - } - }; - private Command<T, Boolean> lenientCommand = new Command<T, Boolean>() { - - @Override - public void execute(T c, Boolean value, Object data) { - c.setLenient(false); - - } - }; - private Command<T, Boolean> weekNumberCommand = new Command<T, Boolean>() { - - @Override - public void execute(T c, Boolean value, Object data) { - c.setShowISOWeekNumbers(value); - - } - }; - private Command<T, String> dateFormatCommand = new Command<T, String>() { - - @Override - public void execute(T c, String value, Object data) { - c.setDateFormat(value); - } - }; - } diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldTextEnabled.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTextEnabled.java index e1470797bc..4c5c7f9668 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldTextEnabled.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTextEnabled.java @@ -2,16 +2,16 @@ package com.vaadin.tests.components.datefield; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.CheckBox; -import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.DateField; -public class PopupDateFieldTextEnabled extends TestBase { +public class DateFieldTextEnabled extends TestBase { private static final String ENABLED = "DateField text box enabled"; private static final String DISABLED = "DateField text box disabled"; @Override public void setup() { - final PopupDateField field = new PopupDateField(); + final DateField field = new DateField(); final CheckBox box = new CheckBox(ENABLED, true); box.addValueChangeListener(event -> { field.setTextFieldEnabled(event.getValue()); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTimezone.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTimezone.java index 69b331287b..19120be547 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTimezone.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTimezone.java @@ -10,8 +10,9 @@ import java.util.TimeZone; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.TestBase; +import com.vaadin.tests.components.TestDateField; import com.vaadin.tests.util.Log; -import com.vaadin.ui.DateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.v7.data.Property; import com.vaadin.v7.data.Property.ValueChangeEvent; import com.vaadin.v7.shared.ui.combobox.FilteringMode; @@ -22,7 +23,7 @@ public class DateFieldTimezone extends TestBase { private static final TimeZone UTC = TimeZone.getTimeZone("UTC"); private static final Locale EN = Locale.ENGLISH; private final Log log = new Log(5); - private final DateField dateField = new DateField(); + private final AbstractDateField dateField = new TestDateField(); private static final String nullValue = ""; @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldUnparsableDate.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldUnparsableDate.java index 3427701e40..17c9f47c35 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldUnparsableDate.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldUnparsableDate.java @@ -4,12 +4,12 @@ import java.util.Date; import com.vaadin.data.Result; import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.DateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.v7.data.util.converter.Converter; public class DateFieldUnparsableDate extends TestBase { - public class MyDateField extends DateField { + public class MyDateField extends AbstractDateField { Date oldDate = null; public MyDateField(String caption) { @@ -24,7 +24,7 @@ public class DateFieldUnparsableDate extends TestBase { } } - public class MyDateField2 extends DateField { + public class MyDateField2 extends AbstractDateField { public MyDateField2(String caption) { super(caption); } @@ -36,7 +36,7 @@ public class DateFieldUnparsableDate extends TestBase { } } - public class MyDateField3 extends DateField { + public class MyDateField3 extends AbstractDateField { public MyDateField3(String caption) { super(caption); } @@ -48,7 +48,7 @@ public class DateFieldUnparsableDate extends TestBase { } } - public class MyDateField4 extends DateField { + public class MyDateField4 extends AbstractDateField { public MyDateField4(String caption) { super(caption); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldValueChangeEvents.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldValueChangeEvents.java index a65cf18d01..b100cd4c23 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldValueChangeEvents.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldValueChangeEvents.java @@ -25,7 +25,8 @@ import java.util.Calendar; import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.AbstractTestUIWithLog; -import com.vaadin.ui.DateField; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.HorizontalLayout; import com.vaadin.v7.data.Property.ValueChangeEvent; import com.vaadin.v7.data.Property.ValueChangeListener; @@ -36,7 +37,7 @@ import com.vaadin.v7.ui.NativeSelect; * @since * @author Vaadin Ltd */ -public class PopupDateFieldValueChangeEvents extends AbstractTestUIWithLog { +public class DateFieldValueChangeEvents extends AbstractTestUIWithLog { private int count = 0; @@ -55,7 +56,8 @@ public class PopupDateFieldValueChangeEvents extends AbstractTestUIWithLog { Calendar calendar = Calendar.getInstance(); calendar.set(2010, 1, 1, 18, 19, 20); - final DateField df = new DateField(null, calendar.getTime()); + final AbstractDateField df = new TestDateField(null, + calendar.getTime()); df.setResolution(Resolution.SECOND); df.setImmediate(true); hl.addComponent(df); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldWhenChangingValueAndEnablingParent.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldWhenChangingValueAndEnablingParent.java index 8943d058ae..6a7550d0c8 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldWhenChangingValueAndEnablingParent.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldWhenChangingValueAndEnablingParent.java @@ -4,9 +4,10 @@ import java.util.Date; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.CheckBox; import com.vaadin.ui.DateField; -import com.vaadin.ui.PopupDateField; import com.vaadin.ui.VerticalLayout; public class DateFieldWhenChangingValueAndEnablingParent @@ -21,12 +22,12 @@ public class DateFieldWhenChangingValueAndEnablingParent main.setMargin(true); setContent(main); - final DateField df1 = createDateField(true); - final DateField df2 = createDateField(false); - final PopupDateField pdf1 = createPopupDateField(true, true); - final PopupDateField pdf2 = createPopupDateField(true, false); - final PopupDateField pdf3 = createPopupDateField(false, true); - final PopupDateField pdf4 = createPopupDateField(false, false); + final AbstractDateField df1 = createDateField(true); + final AbstractDateField df2 = createDateField(false); + final DateField pdf1 = createPopupDateField(true, true); + final DateField pdf2 = createPopupDateField(true, false); + final DateField pdf3 = createPopupDateField(false, true); + final DateField pdf4 = createPopupDateField(false, false); sub.addComponent(df1); sub.addComponent(df2); @@ -49,17 +50,17 @@ public class DateFieldWhenChangingValueAndEnablingParent }); } - private DateField createDateField(boolean enabled) { - DateField df = new DateField( + private AbstractDateField createDateField(boolean enabled) { + AbstractDateField df = new TestDateField( "DateField, " + (enabled ? "enabled" : "disabled")); df.setEnabled(enabled); df.setId("DATEFIELD_" + (enabled ? "ENABLED" : "DISABLED")); return df; } - private PopupDateField createPopupDateField(boolean enabled, + private DateField createPopupDateField(boolean enabled, boolean textInputEnabled) { - PopupDateField df = new PopupDateField("PopupDateField, " + DateField df = new DateField("PopupDateField, " + (enabled ? "enabled" : "disabled") + ", text input " + (textInputEnabled ? "enabled" : "disabled")); df.setEnabled(enabled); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFields.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFields.java index 4847bb0c70..ac77215245 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFields.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFields.java @@ -8,24 +8,24 @@ import java.util.Locale; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.ComponentTestCase; import com.vaadin.ui.Component; -import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.DateField; @SuppressWarnings("serial") -public class PopupDateFields extends ComponentTestCase<PopupDateField> { +public class DateFields extends ComponentTestCase<DateField> { private static final Locale[] LOCALES = new Locale[] { Locale.US, Locale.TAIWAN, new Locale("fi", "FI") }; @Override - protected Class<PopupDateField> getTestClass() { - return PopupDateField.class; + protected Class<DateField> getTestClass() { + return DateField.class; } @Override protected void initializeComponents() { for (Locale locale : LOCALES) { - PopupDateField pd = createPopupDateField("Undefined width", "-1", + DateField pd = createPopupDateField("Undefined width", "-1", locale); pd.setId("Locale-" + locale.toString() + "-undefined-wide"); addTestComponent(pd); @@ -40,9 +40,9 @@ public class PopupDateFields extends ComponentTestCase<PopupDateField> { } - private PopupDateField createPopupDateField(String caption, String width, + private DateField createPopupDateField(String caption, String width, Locale locale) { - PopupDateField pd = new PopupDateField( + DateField pd = new DateField( caption + "(" + locale.toString() + ")"); pd.setWidth(width); pd.setValue(new Date(12312312313L)); @@ -74,10 +74,10 @@ public class PopupDateFields extends ComponentTestCase<PopupDateField> { options.put("Min", Resolution.MINUTE); options.put("Sec", Resolution.SECOND); return createSelectAction("Resolution", options, "Year", - new Command<PopupDateField, Resolution>() { + new Command<DateField, Resolution>() { @Override - public void execute(PopupDateField c, Resolution value, + public void execute(DateField c, Resolution value, Object data) { c.setResolution(value); @@ -92,10 +92,10 @@ public class PopupDateFields extends ComponentTestCase<PopupDateField> { options.put("åäöÅÄÖ", "åäöÅÄÖ"); return createSelectAction("Input prompt", options, "<none>", - new Command<PopupDateField, String>() { + new Command<DateField, String>() { @Override - public void execute(PopupDateField c, String value, + public void execute(DateField c, String value, Object data) { c.setInputPrompt(value); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DatePopupStyleName.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DatePopupStyleName.java index 64f8695308..4e1c59c4a6 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DatePopupStyleName.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DatePopupStyleName.java @@ -5,14 +5,15 @@ import java.util.Date; import com.vaadin.server.UserError; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.DateField; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; public class DatePopupStyleName extends TestBase { @Override public void setup() { setTheme("reindeer-tests"); - final DateField df = new DateField(); + final AbstractDateField df = new TestDateField(); df.setValue(new Date(1203910239L)); df.setResolution(Resolution.SECOND); df.setWidth("200px"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateRangeWithSqlDate.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateRangeWithSqlDate.java index e710be35e5..eb4044c4ae 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateRangeWithSqlDate.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateRangeWithSqlDate.java @@ -19,7 +19,7 @@ import java.util.Locale; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.DateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.InlineDateField; public class DateRangeWithSqlDate extends AbstractTestUI { @@ -34,7 +34,7 @@ public class DateRangeWithSqlDate extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { - DateField df = new InlineDateField(); + AbstractDateField df = new InlineDateField(); df.setLocale(Locale.US); df.setRangeStart(startDate); df.setRangeEnd(endDate); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DisabledDateFieldPopup.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DisabledDateFieldPopup.java index 047a0ea617..06b7e4c8e0 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DisabledDateFieldPopup.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DisabledDateFieldPopup.java @@ -17,13 +17,14 @@ package com.vaadin.tests.components.datefield; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.DateField; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; public class DisabledDateFieldPopup extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { - DateField field = new DateField(); + AbstractDateField field = new TestDateField(); field.setEnabled(false); addComponent(field); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DisabledDateFieldWidth.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DisabledDateFieldWidth.java index cd7026483a..ce44506afa 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DisabledDateFieldWidth.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DisabledDateFieldWidth.java @@ -2,16 +2,17 @@ package com.vaadin.tests.components.datefield; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.TestBase; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.DateField; import com.vaadin.ui.GridLayout; public class DisabledDateFieldWidth extends TestBase { @Override public void setup() { - final DateField dateField1 = new DateField("DateField"); + final AbstractDateField dateField1 = new TestDateField("DateField"); dateField1.setResolution(Resolution.YEAR); dateField1.setEnabled(false); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DisabledInlineDateField.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DisabledInlineDateField.java index fa86c6dc14..1669f3da22 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DisabledInlineDateField.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DisabledInlineDateField.java @@ -20,7 +20,7 @@ import java.util.Date; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.DateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.InlineDateField; public class DisabledInlineDateField extends AbstractTestUI { @@ -34,7 +34,7 @@ public class DisabledInlineDateField extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { - DateField df = new InlineDateField("Disabled"); + AbstractDateField df = new InlineDateField("Disabled"); df.setValue(testDate); df.setEnabled(false); addComponent(df); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DisabledParentLayout.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DisabledParentLayout.java index 09b90e57c9..ed16a747c0 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DisabledParentLayout.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DisabledParentLayout.java @@ -17,8 +17,9 @@ package com.vaadin.tests.components.datefield; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Button; -import com.vaadin.ui.DateField; import com.vaadin.ui.VerticalLayout; /** @@ -35,7 +36,7 @@ public class DisabledParentLayout extends AbstractTestUI { content.setMargin(true); final VerticalLayout pane = new VerticalLayout(); - DateField dateField = new DateField(); + AbstractDateField dateField = new TestDateField(); // If the field is immediate, the UI behaves differently (the value is // updated and an error is indicated earlier instead of showing the date // selector on the first click as the test expects. Keeping as diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.java index 576d49aa18..b280f751fd 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.java @@ -7,9 +7,9 @@ import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.DateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.InlineDateField; -import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.DateField; import com.vaadin.ui.VerticalLayout; /** @@ -25,7 +25,7 @@ public class DynamicallyChangeDateRange extends AbstractTestUI { layout.setMargin(true); setContent(layout); - final PopupDateField df = new PopupDateField(); + final DateField df = new DateField(); df.setValue(new Date(2012 - 1900, 5 - 1, 12)); setRange(df, 5); layout.addComponent(df); @@ -62,7 +62,7 @@ public class DynamicallyChangeDateRange extends AbstractTestUI { * @param df * @param i */ - private void setRange(DateField df, int days) { + private void setRange(AbstractDateField df, int days) { df.setRangeStart( new Date(df.getValue().getTime() - days * 24 * 60 * 60 * 1000)); df.setRangeEnd( diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/InlineDateFieldTest.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/InlineDateFieldTest.java index 1c8d8cfae6..bf10cce66d 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/InlineDateFieldTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/InlineDateFieldTest.java @@ -2,7 +2,7 @@ package com.vaadin.tests.components.datefield; import com.vaadin.ui.InlineDateField; -public class InlineDateFieldTest extends DateFieldTest<InlineDateField> { +public class InlineDateFieldTest extends AbstractDateFieldTest<InlineDateField> { @Override protected Class<InlineDateField> getTestClass() { diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/LenientMode.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/LenientMode.java index 72fed3605e..1e108fca15 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/LenientMode.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/LenientMode.java @@ -7,8 +7,9 @@ import com.vaadin.data.HasValue.ValueChange; import com.vaadin.data.HasValue.ValueChangeListener; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.TestBase; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Button; -import com.vaadin.ui.DateField; public class LenientMode extends TestBase implements ValueChangeListener<Date> { @@ -30,14 +31,14 @@ public class LenientMode extends TestBase implements ValueChangeListener<Date> { @SuppressWarnings("deprecation") Date d = new Date(2009 - 1900, 12 - 1, 31, 23, 59, 59); - DateField df = new DateField("Lenient "); + AbstractDateField df = new TestDateField("Lenient "); df.setLocale(new Locale("fi")); df.setResolution(Resolution.DAY); df.setLenient(true); df.setImmediate(true); df.setValue(d); - DateField df2 = new DateField("Normal "); + AbstractDateField df2 = new TestDateField("Normal "); df2.setLocale(new Locale("fi")); df2.setResolution(Resolution.DAY); // df2.setLenient(false); @@ -51,13 +52,13 @@ public class LenientMode extends TestBase implements ValueChangeListener<Date> { df.addValueChangeListener(this); df2.addValueChangeListener(this); - df = new DateField("Lenient with time"); + df = new TestDateField("Lenient with time"); df.setLocale(new Locale("fi")); df.setLenient(true); df.setImmediate(true); df.setValue(d); - df2 = new DateField("Normal with time"); + df2 = new TestDateField("Normal with time"); df2.setLocale(new Locale("fi")); // df2.setLenient(false); df2.setValue(null); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/LocaleChange.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/LocaleChange.java index a7d527b41e..71e4db4076 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/LocaleChange.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/LocaleChange.java @@ -23,10 +23,11 @@ import java.util.Locale; import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.DateField; public class LocaleChange extends AbstractTestUI { @@ -46,7 +47,7 @@ public class LocaleChange extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { - final DateField df = new DateField(); + final AbstractDateField df = new TestDateField(); df.setLocale(locale24hClock); df.setResolution(Resolution.SECOND); df.setValue(dateValue); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/LowResolution.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/LowResolution.java index 16673fefe7..c5a1d371b4 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/LowResolution.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/LowResolution.java @@ -5,14 +5,14 @@ import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.CheckBox; import com.vaadin.ui.InlineDateField; -import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.DateField; @SuppressWarnings("serial") public class LowResolution extends TestBase { @Override protected void setup() { - final PopupDateField dateField = new PopupDateField(); + final DateField dateField = new DateField(); dateField.setValue(new java.util.Date()); dateField.setResolution(Resolution.MONTH); dateField.addValueChangeListener(event -> getMainWindow() @@ -20,7 +20,7 @@ public class LowResolution extends TestBase { dateField.setImmediate(true); getLayout().addComponent(dateField); - final PopupDateField dateField3 = new PopupDateField(); + final DateField dateField3 = new DateField(); // dateField.setValue(new java.util.Date()); dateField3.setResolution(Resolution.YEAR); dateField3.addValueChangeListener(event -> getMainWindow() diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/NarrowPopupDateFieldInTable.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/NarrowPopupDateFieldInTable.java index ed7573ef3d..2cced8482b 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/NarrowPopupDateFieldInTable.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/NarrowPopupDateFieldInTable.java @@ -2,7 +2,7 @@ package com.vaadin.tests.components.datefield; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Component; -import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.DateField; import com.vaadin.v7.ui.Table; public class NarrowPopupDateFieldInTable extends TestBase { @@ -11,7 +11,7 @@ public class NarrowPopupDateFieldInTable extends TestBase { @Override public void setup() { - PopupDateField df = new PopupDateField(); + DateField df = new DateField(); df.setWidth("100%"); Table t = new Table(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupClosingWithEsc.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupClosingWithEsc.java index 94fefcb429..64c24beec9 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupClosingWithEsc.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupClosingWithEsc.java @@ -18,26 +18,27 @@ package com.vaadin.tests.components.datefield; import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.DateField; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.VerticalLayout; public class PopupClosingWithEsc extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { - DateField df0 = new DateField("Minute"); + AbstractDateField df0 = new TestDateField("Minute"); df0.setId("minute"); df0.setResolution(Resolution.MINUTE); - DateField df1 = new DateField("Day"); + AbstractDateField df1 = new TestDateField("Day"); df1.setId("day"); df1.setResolution(Resolution.DAY); - DateField df2 = new DateField("Month"); + AbstractDateField df2 = new TestDateField("Month"); df2.setId("month"); df2.setResolution(Resolution.MONTH); - DateField df3 = new DateField("Year"); + AbstractDateField df3 = new TestDateField("Year"); df3.setId("year"); df3.setResolution(Resolution.YEAR); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java index 2608e6e081..ed4b2d8d77 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java @@ -9,7 +9,7 @@ import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.DateField; @SuppressWarnings("serial") public class PopupDateFieldExtendedRange extends AbstractTestUI { @@ -22,7 +22,7 @@ public class PopupDateFieldExtendedRange extends AbstractTestUI { getLayout().setSpacing(true); - final PopupDateField[] fields = new PopupDateField[3]; + final DateField[] fields = new DateField[3]; fields[0] = makeDateField(); fields[0].setLocale(new Locale("fi", "FI")); @@ -37,7 +37,7 @@ public class PopupDateFieldExtendedRange extends AbstractTestUI { fields[2].setShowISOWeekNumbers(true); fields[2].setCaption("Finnish locale with week numbers"); - for (PopupDateField f : fields) { + for (DateField f : fields) { addComponent(f); } @@ -45,7 +45,7 @@ public class PopupDateFieldExtendedRange extends AbstractTestUI { @Override public void buttonClick(ClickEvent event) { date.set(2010, 1, 16); - for (PopupDateField f : fields) { + for (DateField f : fields) { f.setValue(date.getTime()); } } @@ -62,8 +62,8 @@ public class PopupDateFieldExtendedRange extends AbstractTestUI { return 6718; } - private PopupDateField makeDateField() { - PopupDateField pdf = new PopupDateField(); + private DateField makeDateField() { + DateField pdf = new DateField(); pdf.setResolution(Resolution.DAY); pdf.setValue(date.getTime()); return pdf; diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldInputPrompt.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldInputPrompt.java index 3403cccfb2..9ff366e2d0 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldInputPrompt.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldInputPrompt.java @@ -17,7 +17,7 @@ package com.vaadin.tests.components.datefield; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.DateField; import com.vaadin.ui.TextField; /** @@ -29,7 +29,7 @@ import com.vaadin.ui.TextField; public class PopupDateFieldInputPrompt extends AbstractTestUI { private TextField text = new TextField("TextField"); - private PopupDateField dateField = new PopupDateField(); + private DateField dateField = new DateField(); @Override protected void setup(VaadinRequest request) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldLocaleTest.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldLocaleTest.java index 5933581a30..5ea0eb0e70 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldLocaleTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldLocaleTest.java @@ -6,7 +6,7 @@ import java.util.Locale; import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.DateField; public class PopupDateFieldLocaleTest extends AbstractTestUI { @@ -21,7 +21,7 @@ public class PopupDateFieldLocaleTest extends AbstractTestUI { cal.set(Calendar.SECOND, 1); cal.set(Calendar.MILLISECOND, 1); - final PopupDateField pdf = new PopupDateField(); + final DateField pdf = new DateField(); pdf.setLocale(Locale.ENGLISH); pdf.setValue(cal.getTime()); pdf.setImmediate(true); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldPopup.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldPopup.java index 8bb816181c..a2d276fde3 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldPopup.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldPopup.java @@ -5,7 +5,7 @@ import java.util.Locale; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.DateField; public class PopupDateFieldPopup extends TestBase { @@ -20,7 +20,7 @@ public class PopupDateFieldPopup extends TestBase { cal.set(Calendar.SECOND, 1); cal.set(Calendar.MILLISECOND, 1); - PopupDateField pdf = new PopupDateField(); + DateField pdf = new DateField(); pdf.setLocale(Locale.US); pdf.setValue(cal.getTime()); pdf.setImmediate(true); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldStates.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldStates.java index aae4a213c6..bcfb00e88c 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldStates.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldStates.java @@ -7,7 +7,7 @@ import java.util.GregorianCalendar; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.GridLayout; -import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.DateField; @SuppressWarnings("serial") public class PopupDateFieldStates extends AbstractTestUI { @@ -35,9 +35,9 @@ public class PopupDateFieldStates extends AbstractTestUI { return 14565; } - private static PopupDateField createPopupDateField(final boolean enabled, + private static DateField createPopupDateField(final boolean enabled, final boolean textFieldEnabled) { - final PopupDateField popupDatefield = new PopupDateField(); + final DateField popupDatefield = new DateField(); Calendar cal = GregorianCalendar.getInstance(); cal.set(Calendar.DATE, 3); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldTest.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldTest.java deleted file mode 100644 index 54a23b5666..0000000000 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.vaadin.tests.components.datefield; - -import java.util.LinkedHashMap; - -import com.vaadin.ui.PopupDateField; - -public class PopupDateFieldTest extends DateFieldTest<PopupDateField> { - - @Override - protected Class<PopupDateField> getTestClass() { - return PopupDateField.class; - } - - @Override - protected void createActions() { - super.createActions(); - - createInputPromptSelectAction(CATEGORY_FEATURES); - createTextEnabledAction(CATEGORY_FEATURES); - } - - private void createInputPromptSelectAction(String category) { - LinkedHashMap<String, String> options = new LinkedHashMap<>(); - options.put("<none>", null); - options.put("Please enter date", "Please enter date"); - options.put("åäöÅÄÖ", "åäöÅÄÖ"); - - createSelectAction("Input prompt", category, options, "<none>", - new Command<PopupDateField, String>() { - - @Override - public void execute(PopupDateField c, String value, - Object data) { - c.setInputPrompt(value); - - } - }); - } - - private void createTextEnabledAction(String category) { - this.createBooleanAction("Text field enabled", category, true, - new Command<PopupDateField, Boolean>() { - - @Override - public void execute(PopupDateField c, Boolean value, - Object data) { - c.setTextFieldEnabled(value); - } - - }); - } -} diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/TestDatefieldYear.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/TestDatefieldYear.java index eb7545812e..da8860c111 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/TestDatefieldYear.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/TestDatefieldYear.java @@ -5,7 +5,8 @@ import java.util.Locale; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.DateField; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; public class TestDatefieldYear extends TestBase { @@ -22,7 +23,8 @@ public class TestDatefieldYear extends TestBase { @Override protected void setup() { @SuppressWarnings("deprecation") - DateField df = new DateField("Year", new Date(2009 - 1900, 4 - 1, 1)); + AbstractDateField df = new TestDateField("Year", + new Date(2009 - 1900, 4 - 1, 1)); df.setLocale(new Locale("en", "US")); df.setResolution(Resolution.YEAR); df.setResolution(Resolution.MONTH); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java index cf42fcad75..6c83ee4b0e 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java @@ -4,16 +4,17 @@ import java.util.Date; import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.TestBase; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.DateField; public class WidthRecalculationOnEnableStateChange extends TestBase { @Override public void setup() { setTheme("reindeer-tests"); - final DateField df = new DateField(); + final AbstractDateField df = new TestDateField(); df.setValue(new Date(1203910239L)); df.setResolution(Resolution.SECOND); df.setWidth("200px"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/formlayout/FormLayoutErrorHover.java b/uitest/src/main/java/com/vaadin/tests/components/formlayout/FormLayoutErrorHover.java index e9e58d9228..85774a8efe 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/formlayout/FormLayoutErrorHover.java +++ b/uitest/src/main/java/com/vaadin/tests/components/formlayout/FormLayoutErrorHover.java @@ -18,14 +18,14 @@ package com.vaadin.tests.components.formlayout; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.FormLayout; -import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.DateField; public class FormLayoutErrorHover extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { FormLayout formLayout = new FormLayout(); - PopupDateField fromDate = new PopupDateField("Date"); + DateField fromDate = new DateField("Date"); fromDate.setImmediate(true); formLayout.addComponent(fromDate); diff --git a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/LayoutAfterHidingError.java b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/LayoutAfterHidingError.java index 88fd65213c..ea0a123ef8 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/LayoutAfterHidingError.java +++ b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/LayoutAfterHidingError.java @@ -19,10 +19,11 @@ package com.vaadin.tests.components.gridlayout; import com.vaadin.server.UserError; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.DateField; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Panel; @@ -38,7 +39,7 @@ public class LayoutAfterHidingError extends AbstractTestUI { gl.setWidth("100%"); panel.setContent(gl); - final DateField df = new DateField(); + final AbstractDateField df = new TestDateField(); df.setWidth("100%"); gl.addComponent(df); diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TableChildMeasurementHint.java b/uitest/src/main/java/com/vaadin/tests/components/table/TableChildMeasurementHint.java index 8b4338187e..b6cb87616d 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/TableChildMeasurementHint.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/TableChildMeasurementHint.java @@ -2,11 +2,12 @@ package com.vaadin.tests.components.table; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.DateField; import com.vaadin.ui.GridLayout; import com.vaadin.ui.HasChildMeasurementHint.ChildMeasurementHint; import com.vaadin.ui.HorizontalLayout; @@ -152,7 +153,7 @@ public class TableChildMeasurementHint extends AbstractTestUI { table.addGeneratedColumn("First_Name" + 4, new Table.ColumnGenerator() { @Override public Object generateCell(Table components, Object o, Object o2) { - DateField b = new DateField("DateField"); + AbstractDateField b = new TestDateField("DateField"); b.setWidthUndefined(); return b; } diff --git a/uitest/src/main/java/com/vaadin/tests/components/tabsheet/ScrollbarsInNestedTabsheets.java b/uitest/src/main/java/com/vaadin/tests/components/tabsheet/ScrollbarsInNestedTabsheets.java index 55b4d59f80..9210314c0c 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/tabsheet/ScrollbarsInNestedTabsheets.java +++ b/uitest/src/main/java/com/vaadin/tests/components/tabsheet/ScrollbarsInNestedTabsheets.java @@ -1,7 +1,7 @@ package com.vaadin.tests.components.tabsheet; import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.DateField; +import com.vaadin.tests.components.TestDateField; import com.vaadin.ui.Label; import com.vaadin.ui.Layout; import com.vaadin.ui.TabSheet; @@ -32,14 +32,14 @@ public class ScrollbarsInNestedTabsheets extends TestBase { private Layout getDummyLayout1() { final VerticalLayout l = new VerticalLayout(); - l.addComponent(new DateField("Date")); + l.addComponent(new TestDateField("Date")); return l; } private Layout getDummyLayout2() { final VerticalLayout l = new VerticalLayout(); - l.addComponent(new DateField("Date")); + l.addComponent(new TestDateField("Date")); l.addComponent(new TextField("TextField")); return l; diff --git a/uitest/src/main/java/com/vaadin/tests/components/uitest/components/DatesCssTest.java b/uitest/src/main/java/com/vaadin/tests/components/uitest/components/DatesCssTest.java index cb97e8ee84..c6dbd4e025 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/uitest/components/DatesCssTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/uitest/components/DatesCssTest.java @@ -3,12 +3,13 @@ package com.vaadin.tests.components.uitest.components; import java.util.Calendar; import java.util.GregorianCalendar; +import com.vaadin.tests.components.TestDateField; import com.vaadin.tests.components.uitest.TestSampler; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Component; import com.vaadin.ui.DateField; import com.vaadin.ui.GridLayout; import com.vaadin.ui.InlineDateField; -import com.vaadin.ui.PopupDateField; import com.vaadin.ui.themes.ChameleonTheme; public class DatesCssTest extends GridLayout { @@ -28,7 +29,7 @@ public class DatesCssTest extends GridLayout { createDateFieldWith("Small", ChameleonTheme.DATEFIELD_SMALL, null); createDateFieldWith("Big", ChameleonTheme.DATEFIELD_BIG, null); - DateField df = new PopupDateField("Popup date field"); + AbstractDateField df = new DateField("Popup date field"); df.setId("datefield" + debugIdCounter++); df.setValue(cal.getTime()); addComponent(df); @@ -47,7 +48,7 @@ public class DatesCssTest extends GridLayout { private void createDateFieldWith(String caption, String primaryStyleName, String width) { - DateField df = new DateField("Date field"); + AbstractDateField df = new TestDateField("Date field"); df.setId("datefield" + debugIdCounter++); df.setValue(cal.getTime()); diff --git a/uitest/src/main/java/com/vaadin/tests/declarative/PotusForm.java b/uitest/src/main/java/com/vaadin/tests/declarative/PotusForm.java index 1eb6d21bb4..28525efc0f 100644 --- a/uitest/src/main/java/com/vaadin/tests/declarative/PotusForm.java +++ b/uitest/src/main/java/com/vaadin/tests/declarative/PotusForm.java @@ -17,7 +17,7 @@ package com.vaadin.tests.declarative; import com.vaadin.annotations.DesignRoot; import com.vaadin.ui.Button; -import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.DateField; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.declarative.Design; import com.vaadin.v7.data.fieldgroup.PropertyId; @@ -34,9 +34,9 @@ public class PotusForm extends VerticalLayout { @PropertyId("party") public ComboBox party; @PropertyId("tookOffice") - public PopupDateField tookOffice; + public DateField tookOffice; @PropertyId("leftOffice") - public PopupDateField leftOffice; + public DateField leftOffice; public Button save; public Button revert; diff --git a/uitest/src/main/java/com/vaadin/tests/fieldgroup/DateForm.java b/uitest/src/main/java/com/vaadin/tests/fieldgroup/DateForm.java index 964a87a614..af8f5b4692 100644 --- a/uitest/src/main/java/com/vaadin/tests/fieldgroup/DateForm.java +++ b/uitest/src/main/java/com/vaadin/tests/fieldgroup/DateForm.java @@ -79,8 +79,7 @@ public class DateForm extends AbstractTestUIWithLog { protected void setup(VaadinRequest request) { setLocale(Locale.US); addComponent(log); - final FieldGroup fieldGroup = new BeanFieldGroup<>( - DateObject.class); + final FieldGroup fieldGroup = new BeanFieldGroup<>(DateObject.class); fieldGroup.setBuffered(true); fieldGroup.buildAndBindMemberFields(this); @@ -128,7 +127,7 @@ public class DateForm extends AbstractTestUIWithLog { addComponent(showBean); DateObject d = new DateObject(new Date(443457289789L), - new Date(443457289789L), new Date(443457289789L), + new Date(443543689789L), new Date(443457289789L), new Date(443457289789L)); fieldGroup.setItemDataSource(new BeanItem<>(d)); } diff --git a/uitest/src/main/java/com/vaadin/tests/fields/TabIndexes.java b/uitest/src/main/java/com/vaadin/tests/fields/TabIndexes.java index 12539b84cd..08ee0f605d 100644 --- a/uitest/src/main/java/com/vaadin/tests/fields/TabIndexes.java +++ b/uitest/src/main/java/com/vaadin/tests/fields/TabIndexes.java @@ -13,7 +13,7 @@ import com.vaadin.ui.Component; import com.vaadin.ui.GridLayout; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.InlineDateField; -import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.DateField; import com.vaadin.ui.RichTextArea; import com.vaadin.ui.Slider; import com.vaadin.v7.ui.ComboBox; @@ -97,7 +97,7 @@ public class TabIndexes extends AbstractTestUIWithLog { fields.add(new NativeSelect()); fields.add(new ListSelect()); fields.add(new TextField()); - fields.add(new PopupDateField()); + fields.add(new DateField()); fields.add(new InlineDateField()); OptionGroup og = new OptionGroup(); og.addItem("Item 1"); diff --git a/uitest/src/main/java/com/vaadin/tests/fonticon/FontIcons.java b/uitest/src/main/java/com/vaadin/tests/fonticon/FontIcons.java index 6959b1a852..0db298da7e 100644 --- a/uitest/src/main/java/com/vaadin/tests/fonticon/FontIcons.java +++ b/uitest/src/main/java/com/vaadin/tests/fonticon/FontIcons.java @@ -31,7 +31,6 @@ import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.CheckBox; import com.vaadin.ui.Component; -import com.vaadin.ui.DateField; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Link; @@ -50,6 +49,7 @@ import com.vaadin.v7.ui.ComboBox; import com.vaadin.v7.ui.ListSelect; import com.vaadin.v7.ui.NativeSelect; import com.vaadin.v7.ui.OptionGroup; +import com.vaadin.v7.ui.PopupDateField; import com.vaadin.v7.ui.Table; import com.vaadin.v7.ui.Table.Align; import com.vaadin.v7.ui.Table.RowHeaderMode; @@ -110,9 +110,10 @@ public class FontIcons extends AbstractTestUI { layout.addComponent(gl); // Basic components, caption icon only - Class<?>[] components = { Button.class, CheckBox.class, DateField.class, - NativeButton.class, Link.class, Label.class, Panel.class, - Slider.class, TextArea.class, TextField.class, Upload.class }; + Class<?>[] components = { Button.class, CheckBox.class, + PopupDateField.class, NativeButton.class, Link.class, + Label.class, Panel.class, Slider.class, TextArea.class, + TextField.class, Upload.class }; for (Class<?> clazz : components) { Component c; try { diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java b/uitest/src/main/java/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java index 0cd4eb9f32..957821a450 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java @@ -7,6 +7,7 @@ import com.vaadin.data.HasRequired; import com.vaadin.server.ThemeResource; import com.vaadin.server.UserError; import com.vaadin.tests.components.TestBase; +import com.vaadin.tests.components.TestDateField; import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -15,7 +16,6 @@ import com.vaadin.ui.CheckBox; import com.vaadin.ui.ComboBox; import com.vaadin.ui.Component; import com.vaadin.ui.CssLayout; -import com.vaadin.ui.DateField; import com.vaadin.ui.FormLayout; import com.vaadin.ui.GridLayout; import com.vaadin.ui.HorizontalLayout; @@ -200,7 +200,7 @@ public class CaptionsInLayoutsWaiAria extends TestBase { components.add(new TextArea("Default TextArea.")); // components.add(new RichTextArea("Default RichtTextArea")); components.add(new PasswordField("Default Password")); - components.add(new DateField("Default DateField")); + components.add(new TestDateField("Default DateField")); // PopupDateField popupDateField = new // PopupDateField("Default DateField"); diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseRegError.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseRegError.java index 857b7e51ce..b855982463 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseRegError.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseRegError.java @@ -16,10 +16,10 @@ package com.vaadin.tests.layouts.layouttester; import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.TestDateField; import com.vaadin.ui.AbstractLayout; import com.vaadin.ui.Button; import com.vaadin.ui.CheckBox; -import com.vaadin.ui.DateField; import com.vaadin.ui.Label; import com.vaadin.ui.TabSheet; import com.vaadin.v7.ui.ComboBox; @@ -52,7 +52,7 @@ public class BaseRegError extends BaseLayoutTestUI { l1.addComponent(createLabelsFields(TextField.class, true, "")); l2.addComponent(createLabelsFields(ComboBox.class, true, "")); - l2.addComponent(createLabelsFields(DateField.class, true, "")); + l2.addComponent(createLabelsFields(TestDateField.class, true, "")); l2.addComponent(createLabelsFields(NativeSelect.class, true, "")); l2.addComponent(createLabelsFields(CheckBox.class, true, "")); diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutRegError.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutRegError.java index a62ebe7a34..8be3b36605 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutRegError.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutRegError.java @@ -16,9 +16,9 @@ package com.vaadin.tests.layouts.layouttester.GridLayout; import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.TestDateField; import com.vaadin.ui.Button; import com.vaadin.ui.CheckBox; -import com.vaadin.ui.DateField; import com.vaadin.ui.Label; import com.vaadin.ui.TabSheet; import com.vaadin.v7.ui.ComboBox; @@ -46,7 +46,7 @@ public class GridLayoutRegError extends GridBaseLayoutTestUI { layout.addComponent(createLabelsFields(TextField.class, true, "")); layout.addComponent(createLabelsFields(ComboBox.class, true, "")); - layout.addComponent(createLabelsFields(DateField.class, true, "")); + layout.addComponent(createLabelsFields(TestDateField.class, true, "")); layout.addComponent(createLabelsFields(NativeSelect.class, true, "")); layout.addComponent(createLabelsFields(CheckBox.class, true, "")); diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/DateFields.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/DateFields.java index 784c82304c..c9797709da 100644 --- a/uitest/src/main/java/com/vaadin/tests/themes/valo/DateFields.java +++ b/uitest/src/main/java/com/vaadin/tests/themes/valo/DateFields.java @@ -22,11 +22,12 @@ import com.vaadin.navigator.View; import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; import com.vaadin.server.UserError; import com.vaadin.shared.ui.datefield.Resolution; +import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.CssLayout; -import com.vaadin.ui.DateField; import com.vaadin.ui.FormLayout; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.InlineDateField; @@ -50,16 +51,16 @@ public class DateFields extends VerticalLayout implements View { row.setSpacing(true); addComponent(row); - DateField date = new DateField("Default resolution"); + AbstractDateField date = new TestDateField("Default resolution"); setDate(date); row.addComponent(date); - date = new DateField("Error"); + date = new TestDateField("Error"); setDate(date); date.setComponentError(new UserError("Fix it, now!")); row.addComponent(date); - date = new DateField("Error, borderless"); + date = new TestDateField("Error, borderless"); setDate(date); date.setComponentError(new UserError("Fix it, now!")); date.addStyleName(ValoTheme.DATEFIELD_BORDERLESS); @@ -70,7 +71,7 @@ public class DateFields extends VerticalLayout implements View { group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); row.addComponent(group); - final DateField date2 = new DateField(); + final TestDateField date2 = new TestDateField(); group.addComponent(date2); Button today = new Button("Today", new ClickListener() { @@ -81,109 +82,109 @@ public class DateFields extends VerticalLayout implements View { }); group.addComponent(today); - date = new DateField("Default resolution, explicit size"); + date = new TestDateField("Default resolution, explicit size"); setDate(date); row.addComponent(date); date.setWidth("260px"); date.setHeight("60px"); - date = new DateField("Second resolution"); + date = new TestDateField("Second resolution"); setDate(date); date.setResolution(Resolution.SECOND); row.addComponent(date); - date = new DateField("Minute resolution"); + date = new TestDateField("Minute resolution"); setDate(date); date.setResolution(Resolution.MINUTE); row.addComponent(date); - date = new DateField("Hour resolution"); + date = new TestDateField("Hour resolution"); setDate(date); date.setResolution(Resolution.HOUR); row.addComponent(date); - date = new DateField("Disabled"); + date = new TestDateField("Disabled"); setDate(date); date.setResolution(Resolution.HOUR); date.setEnabled(false); row.addComponent(date); - date = new DateField("Day resolution"); + date = new TestDateField("Day resolution"); setDate(date); date.setResolution(Resolution.DAY); row.addComponent(date); - date = new DateField("Month resolution"); + date = new TestDateField("Month resolution"); setDate(date); date.setResolution(Resolution.MONTH); row.addComponent(date); - date = new DateField("Year resolution"); + date = new TestDateField("Year resolution"); setDate(date); date.setResolution(Resolution.YEAR); row.addComponent(date); - date = new DateField("Custom color"); + date = new TestDateField("Custom color"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("color1"); row.addComponent(date); - date = new DateField("Custom color"); + date = new TestDateField("Custom color"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("color2"); row.addComponent(date); - date = new DateField("Custom color"); + date = new TestDateField("Custom color"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("color3"); row.addComponent(date); - date = new DateField("Small"); + date = new TestDateField("Small"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName(ValoTheme.DATEFIELD_SMALL); row.addComponent(date); - date = new DateField("Large"); + date = new TestDateField("Large"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName(ValoTheme.DATEFIELD_LARGE); row.addComponent(date); - date = new DateField("Borderless"); + date = new TestDateField("Borderless"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName(ValoTheme.DATEFIELD_BORDERLESS); row.addComponent(date); - date = new DateField("Week numbers"); + date = new TestDateField("Week numbers"); setDate(date); date.setResolution(Resolution.DAY); date.setLocale(new Locale("fi", "fi")); date.setShowISOWeekNumbers(true); row.addComponent(date); - date = new DateField("US locale"); + date = new TestDateField("US locale"); setDate(date); date.setResolution(Resolution.SECOND); date.setLocale(new Locale("en", "US")); row.addComponent(date); - date = new DateField("Custom format"); + date = new TestDateField("Custom format"); setDate(date); date.setDateFormat("E dd/MM/yyyy"); row.addComponent(date); - date = new DateField("Tiny"); + date = new TestDateField("Tiny"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName(ValoTheme.DATEFIELD_TINY); row.addComponent(date); - date = new DateField("Huge"); + date = new TestDateField("Huge"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName(ValoTheme.DATEFIELD_HUGE); @@ -201,8 +202,7 @@ public class DateFields extends VerticalLayout implements View { row.addComponent(date); PropertysetItem item = new PropertysetItem(); - item.addItemProperty("date", - new ObjectProperty<>(getDefaultDate())); + item.addItemProperty("date", new ObjectProperty<>(getDefaultDate())); FormLayout form = new FormLayout(); form.setMargin(false); @@ -215,7 +215,7 @@ public class DateFields extends VerticalLayout implements View { row.addComponent(form); } - private void setDateRange(DateField date) { + private void setDateRange(AbstractDateField date) { date.setRangeStart(getDefaultDate()); Date endDate = getDefaultDate(); @@ -223,7 +223,7 @@ public class DateFields extends VerticalLayout implements View { date.setRangeEnd(endDate); } - private void setDate(DateField date) { + private void setDate(AbstractDateField date) { date.setValue(getDefaultDate()); } diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/Forms.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/Forms.java index c7a677de7f..a47e3af78b 100644 --- a/uitest/src/main/java/com/vaadin/tests/themes/valo/Forms.java +++ b/uitest/src/main/java/com/vaadin/tests/themes/valo/Forms.java @@ -21,20 +21,21 @@ 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.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.CheckBox; -import com.vaadin.ui.DateField; import com.vaadin.ui.FormLayout; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; +import com.vaadin.ui.RichTextArea; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.themes.ValoTheme; import com.vaadin.v7.ui.ComboBox; import com.vaadin.v7.ui.OptionGroup; -import com.vaadin.ui.RichTextArea; import com.vaadin.v7.ui.TextArea; import com.vaadin.v7.ui.TextField; @@ -69,7 +70,7 @@ public class Forms extends VerticalLayout implements View { name.setWidth("50%"); form.addComponent(name); - DateField birthday = new DateField("Birthday"); + AbstractDateField birthday = new TestDateField("Birthday"); birthday.setValue(new Date(80, 0, 31)); form.addComponent(birthday); diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/Tables.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/Tables.java index 3baa249473..bce3d32161 100644 --- a/uitest/src/main/java/com/vaadin/tests/themes/valo/Tables.java +++ b/uitest/src/main/java/com/vaadin/tests/themes/valo/Tables.java @@ -22,9 +22,10 @@ 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.tests.components.TestDateField; +import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Button; import com.vaadin.ui.CheckBox; -import com.vaadin.ui.DateField; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Notification; @@ -198,7 +199,7 @@ public class Tables extends VerticalLayout implements View { @Override public Object generateCell(Table source, Object itemId, Object columnId) { - DateField tf = new DateField(); + AbstractDateField tf = new TestDateField(); tf.addStyleName(ValoTheme.TABLE_COMPACT); if ((Integer) itemId % 2 == 0) { tf.addStyleName(ValoTheme.DATEFIELD_BORDERLESS); diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldTestTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/AbstractDateFieldTestTest.java index a66018b7dd..caaf84b8f7 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldTestTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/AbstractDateFieldTestTest.java @@ -25,7 +25,7 @@ import org.openqa.selenium.interactions.Actions; import com.vaadin.testbench.elements.NotificationElement; import com.vaadin.tests.tb3.MultiBrowserTest; -public class DateFieldTestTest extends MultiBrowserTest { +public class AbstractDateFieldTestTest extends MultiBrowserTest { @Test public void testMakingRequired() throws InterruptedException { diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldDayResolutionOffsetTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldDayResolutionOffsetTest.java index f1969c5aff..ffe8239da1 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldDayResolutionOffsetTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldDayResolutionOffsetTest.java @@ -7,7 +7,7 @@ import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import com.vaadin.testbench.elements.DateFieldElement; +import com.vaadin.testbench.customelements.AbstractDateFieldElement; import com.vaadin.testbench.elements.LabelElement; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -35,7 +35,7 @@ public class DateFieldDayResolutionOffsetTest extends MultiBrowserTest { } private void openDatePicker() { - DateFieldElement dateField = $(DateFieldElement.class).first(); + AbstractDateFieldElement dateField = $(AbstractDateFieldElement.class).first(); dateField.findElement(By.tagName("button")).click(); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldElementTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldElementTest.java new file mode 100644 index 0000000000..ce87676cc2 --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldElementTest.java @@ -0,0 +1,26 @@ +package com.vaadin.tests.components.datefield; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.Is.is; + +import org.junit.Test; + +import com.vaadin.testbench.customelements.AbstractDateFieldElement; +import com.vaadin.testbench.elements.DateFieldElement; +import com.vaadin.tests.tb3.SingleBrowserTest; + +public class DateFieldElementTest extends SingleBrowserTest { + + @Test + public void dateFieldElementIsLocated() { + openTestURL(); + + assertThat($(DateFieldElement.class).all().size(), is(1)); + assertThat($(AbstractDateFieldElement.class).all().size(), is(2)); + } + + @Override + protected Class<?> getUIClass() { + return DateFieldElementUI.class; + } +}
\ No newline at end of file diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldIsValidTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldIsValidTest.java index 9832dd9a15..7e6955a024 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldIsValidTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldIsValidTest.java @@ -21,8 +21,8 @@ import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; import com.vaadin.testbench.By; +import com.vaadin.testbench.customelements.AbstractDateFieldElement; import com.vaadin.testbench.elements.ButtonElement; -import com.vaadin.testbench.elements.DateFieldElement; import com.vaadin.tests.tb3.MultiBrowserTest; /** @@ -36,7 +36,7 @@ public class DateFieldIsValidTest extends MultiBrowserTest { waitForElementVisible(By.id("Log")); waitForElementVisible(By.className("v-datefield")); - WebElement dateTextbox = $(DateFieldElement.class).first() + WebElement dateTextbox = $(AbstractDateFieldElement.class).first() .findElement(By.className("v-textfield")); ButtonElement button = $(ButtonElement.class).first(); diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldPopupClosingOnDetachTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldPopupClosingOnDetachTest.java index 1047ee7e87..adc4652522 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldPopupClosingOnDetachTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldPopupClosingOnDetachTest.java @@ -20,6 +20,7 @@ import java.io.IOException; import org.junit.Test; import org.openqa.selenium.By; +import com.vaadin.testbench.customelements.AbstractDateFieldElement; import com.vaadin.testbench.elements.DateFieldElement; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -31,7 +32,7 @@ public class DateFieldPopupClosingOnDetachTest extends MultiBrowserTest { openTestURL(); // Open the DateField popup. - DateFieldElement df = $(DateFieldElement.class).first(); + DateFieldElement df = $(AbstractDateFieldElement.class).first(); df.findElement(By.tagName("button")).click(); // Test UI will remove the DateField after 1 second. diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldPopupClosingTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldPopupClosingTest.java index c0b01992d7..09267cfa65 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldPopupClosingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldPopupClosingTest.java @@ -10,6 +10,7 @@ import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.ExpectedConditions; +import com.vaadin.testbench.customelements.AbstractDateFieldElement; import com.vaadin.testbench.elements.DateFieldElement; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -69,7 +70,7 @@ public class DateFieldPopupClosingTest extends MultiBrowserTest { } private WebElement getToggleButton() { - DateFieldElement dateField = $(DateFieldElement.class).first(); + DateFieldElement dateField = $(AbstractDateFieldElement.class).first(); return dateField.findElement(By.tagName("button")); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldReadOnlyTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldReadOnlyTest.java index 08aac1e259..0791b3dd9c 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldReadOnlyTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldReadOnlyTest.java @@ -6,8 +6,8 @@ import org.junit.Test; import org.openqa.selenium.Keys; import com.vaadin.testbench.By; +import com.vaadin.testbench.customelements.AbstractDateFieldElement; import com.vaadin.testbench.elements.ButtonElement; -import com.vaadin.testbench.elements.DateFieldElement; import com.vaadin.tests.tb3.MultiBrowserTest; public class DateFieldReadOnlyTest extends MultiBrowserTest { @@ -36,7 +36,7 @@ public class DateFieldReadOnlyTest extends MultiBrowserTest { private void openPopup() { // waiting for openPopup() in TB4 beta1: // http://dev.vaadin.com/ticket/13766 - $(DateFieldElement.class).first().findElement(By.tagName("button")) + $(AbstractDateFieldElement.class).first().findElement(By.tagName("button")) .click(); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/PopupDateFieldValueChangeEventsTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldValueChangeEventsTest.java index c29b6de36d..5f6373ee57 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/PopupDateFieldValueChangeEventsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldValueChangeEventsTest.java @@ -23,12 +23,12 @@ import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.Select; import com.vaadin.testbench.By; -import com.vaadin.testbench.elements.DateFieldElement; +import com.vaadin.testbench.customelements.AbstractDateFieldElement; import com.vaadin.testbench.elements.LabelElement; import com.vaadin.testbench.elements.NativeSelectElement; import com.vaadin.tests.tb3.MultiBrowserTest; -public class PopupDateFieldValueChangeEventsTest extends MultiBrowserTest { +public class DateFieldValueChangeEventsTest extends MultiBrowserTest { @Test public void tb2test() throws Exception { @@ -53,7 +53,7 @@ public class PopupDateFieldValueChangeEventsTest extends MultiBrowserTest { } public WebElement getPopUpButton() { - DateFieldElement datefield = $(DateFieldElement.class).first(); + AbstractDateFieldElement datefield = $(AbstractDateFieldElement.class).first(); return datefield.findElement((By.className("v-datefield-button"))); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldWhenChangingValueAndEnablingParentTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldWhenChangingValueAndEnablingParentTest.java index f2eb27c13a..865323abac 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldWhenChangingValueAndEnablingParentTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldWhenChangingValueAndEnablingParentTest.java @@ -19,9 +19,9 @@ import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; +import com.vaadin.testbench.customelements.AbstractDateFieldElement; import com.vaadin.testbench.elements.CheckBoxElement; import com.vaadin.testbench.elements.DateFieldElement; -import com.vaadin.testbench.elements.PopupDateFieldElement; import com.vaadin.tests.tb3.SingleBrowserTest; public class DateFieldWhenChangingValueAndEnablingParentTest @@ -32,24 +32,21 @@ public class DateFieldWhenChangingValueAndEnablingParentTest openTestURL(); $(CheckBoxElement.class).first().click(); - assertState($(DateFieldElement.class).id("DATEFIELD_ENABLED"), true, + assertState($(AbstractDateFieldElement.class).id("DATEFIELD_ENABLED"), true, true); - assertState($(DateFieldElement.class).id("DATEFIELD_DISABLED"), false, - false); + assertState($(AbstractDateFieldElement.class).id("DATEFIELD_DISABLED"), + false, false); - assertState( - $(PopupDateFieldElement.class).id("DATEFIELD_ENABLED_ENABLED"), + assertState($(DateFieldElement.class).id("DATEFIELD_ENABLED_ENABLED"), true, true); - assertState( - $(PopupDateFieldElement.class).id("DATEFIELD_ENABLED_DISABLED"), + assertState($(DateFieldElement.class).id("DATEFIELD_ENABLED_DISABLED"), true, false); // disabling widget should always disable input - assertState( - $(PopupDateFieldElement.class).id("DATEFIELD_DISABLED_ENABLED"), + assertState($(DateFieldElement.class).id("DATEFIELD_DISABLED_ENABLED"), + false, false); + assertState($(DateFieldElement.class).id("DATEFIELD_DISABLED_DISABLED"), false, false); - assertState($(PopupDateFieldElement.class) - .id("DATEFIELD_DISABLED_DISABLED"), false, false); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/PopupDateFieldConnectorTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/PopupDateFieldConnectorTest.java deleted file mode 100644 index 5334327a83..0000000000 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/PopupDateFieldConnectorTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.vaadin.tests.components.datefield; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; - -import org.junit.Test; - -import com.vaadin.testbench.elements.DateFieldElement; -import com.vaadin.testbench.elements.PopupDateFieldElement; -import com.vaadin.tests.tb3.SingleBrowserTest; - -public class PopupDateFieldConnectorTest extends SingleBrowserTest { - - @Test - public void popupDateFieldElementIsLocated() { - openTestURL(); - - assertThat($(PopupDateFieldElement.class).all().size(), is(1)); - assertThat($(DateFieldElement.class).all().size(), is(2)); - } -}
\ No newline at end of file diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/PopupDateFieldInputPromptTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/PopupDateFieldInputPromptTest.java index 1b2b5c5b71..0c70457c48 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/PopupDateFieldInputPromptTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/PopupDateFieldInputPromptTest.java @@ -25,7 +25,7 @@ import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedCondition; -import com.vaadin.testbench.elements.PopupDateFieldElement; +import com.vaadin.testbench.customelements.DateFieldElement; import com.vaadin.testbench.elements.TextFieldElement; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -41,8 +41,7 @@ public class PopupDateFieldInputPromptTest extends MultiBrowserTest { public void testInputPrompt() { openTestURL(); TextFieldElement textField = $(TextFieldElement.class).first(); - final PopupDateFieldElement dateField = $(PopupDateFieldElement.class) - .first(); + final DateFieldElement dateField = $(DateFieldElement.class).first(); // ensure initial state Assert.assertFalse("DateField required when it shouldn't be.", @@ -63,7 +62,7 @@ public class PopupDateFieldInputPromptTest extends MultiBrowserTest { } private void waitForElementRequiredAndFocused( - final PopupDateFieldElement dateField, final By locator) { + final DateFieldElement dateField, final By locator) { waitUntil(new ExpectedCondition<Boolean>() { @Override @@ -84,7 +83,7 @@ public class PopupDateFieldInputPromptTest extends MultiBrowserTest { }); } - private boolean isRequired(PopupDateFieldElement dateField) { + private boolean isRequired(DateFieldElement dateField) { return dateField.getAttribute("class").contains("v-required"); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/uitest/ThemeTest.java b/uitest/src/test/java/com/vaadin/tests/components/uitest/ThemeTest.java index 387d0d6723..53be4910dd 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/uitest/ThemeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/uitest/ThemeTest.java @@ -8,8 +8,8 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import com.vaadin.testbench.By; +import com.vaadin.testbench.customelements.AbstractDateFieldElement; import com.vaadin.testbench.customelements.ComboBoxElement; -import com.vaadin.testbench.customelements.DateFieldElement; import com.vaadin.testbench.customelements.FixedNotificationElement; import com.vaadin.testbench.customelements.TableElement; import com.vaadin.testbench.customelements.WindowElement; @@ -187,13 +187,13 @@ public abstract class ThemeTest extends MultiBrowserTest { private void testDates() throws IOException { compareScreen("dates"); - $(DateFieldElement.class).id("datefield0").openPopup(); + $(AbstractDateFieldElement.class).id("datefield0").openPopup(); compareScreen("dates-first-popup"); - $(DateFieldElement.class).id("datefield1").openPopup(); + $(AbstractDateFieldElement.class).id("datefield1").openPopup(); compareScreen("dates-second-popup"); - $(DateFieldElement.class).id("datefield2").openPopup(); + $(AbstractDateFieldElement.class).id("datefield2").openPopup(); compareScreen("dates-third-popup"); - $(DateFieldElement.class).id("datefield3").openPopup(); + $(AbstractDateFieldElement.class).id("datefield3").openPopup(); compareScreen("dates-fourth-popup"); } } diff --git a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridEditorRowTest.java b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridEditorRowTest.java index 0fd537055c..3af6b0bf7e 100644 --- a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridEditorRowTest.java +++ b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridEditorRowTest.java @@ -25,9 +25,9 @@ import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; -import com.vaadin.testbench.customelements.DateFieldElement; import com.vaadin.testbench.customelements.GridElement; import com.vaadin.testbench.elements.CheckBoxElement; +import com.vaadin.testbench.elements.DateFieldElement; import com.vaadin.testbench.elements.GridElement.GridCellElement; import com.vaadin.testbench.elements.GridElement.GridEditorElement; import com.vaadin.testbench.parallel.TestCategory; diff --git a/uitest/src/test/java/com/vaadin/tests/fieldgroup/DateFormTest.java b/uitest/src/test/java/com/vaadin/tests/fieldgroup/DateFormTest.java index 0e7e872947..5bad4aa98c 100644 --- a/uitest/src/test/java/com/vaadin/tests/fieldgroup/DateFormTest.java +++ b/uitest/src/test/java/com/vaadin/tests/fieldgroup/DateFormTest.java @@ -5,9 +5,8 @@ import org.junit.Test; import org.openqa.selenium.WebElement; import com.vaadin.testbench.By; -import com.vaadin.testbench.customelements.DateFieldElement; +import com.vaadin.testbench.elements.DateFieldElement; import com.vaadin.testbench.elements.InlineDateFieldElement; -import com.vaadin.testbench.elements.PopupDateFieldElement; import com.vaadin.testbench.elements.TextFieldElement; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -18,7 +17,7 @@ public class DateFormTest extends MultiBrowserTest { openTestURL(); Assert.assertEquals("Unexpected DateField value,", "1/20/84", getDateFieldValue()); - Assert.assertEquals("Unexpected PopupDateField value,", "1/20/84", + Assert.assertEquals("Unexpected PopupDateField value,", "1/21/84", getPopupDateFieldValue()); WebElement day20 = getInlineDateFieldCalendarPanel() .findElement(By.vaadin("#day20")); @@ -36,7 +35,7 @@ public class DateFormTest extends MultiBrowserTest { } protected String getPopupDateFieldValue() { - return $(PopupDateFieldElement.class).first().getValue(); + return $(DateFieldElement.class).get(1).getValue(); } protected WebElement getInlineDateFieldCalendarPanel() { diff --git a/uitest/src/test/java/com/vaadin/tests/fonticon/FontIconsTest.java b/uitest/src/test/java/com/vaadin/tests/fonticon/FontIconsTest.java index 3f6dcb01ac..321367189f 100644 --- a/uitest/src/test/java/com/vaadin/tests/fonticon/FontIconsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/fonticon/FontIconsTest.java @@ -30,7 +30,7 @@ public class FontIconsTest extends MultiBrowserTest { @Test public void checkScreenshot() throws IOException { openTestURL(); - compareScreen("all"); + compareScreen("allFontIcons"); } @Test |