summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorDenis <denis@vaadin.com>2017-01-10 12:22:34 +0200
committerGitHub <noreply@github.com>2017-01-10 12:22:34 +0200
commit3ef30789d6ac773eed7346dcaa670426fa6f662c (patch)
tree2e5aee20b96e3a66088aa6cde13796256ec2bcf1 /uitest
parentb4af93bebf1b7e51d33330c42e3c89d5e3e4fd45 (diff)
downloadvaadin-framework-3ef30789d6ac773eed7346dcaa670426fa6f662c.tar.gz
vaadin-framework-3ef30789d6ac773eed7346dcaa670426fa6f662c.zip
Refactor AbstractDateField. (#8146)
First round for #8132.
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/TestForBasicApplicationLayout.java4
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/TestDateField.java4
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/AbstractDateFieldTest.java18
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/AriaDisabled.java4
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/CustomDateFormat.java8
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/CustomDateFormatEEE.java8
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldChangeResolution.java10
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldClose.java4
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldDayResolutionOffset.java12
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldIsValid.java5
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPopupClosing.java4
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldPopupClosingOnDetach.java4
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldReadOnly.java4
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldWhenChangingValueAndEnablingParent.java10
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/DateFields.java12
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/DisabledDateFieldPopup.java4
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/DisabledInlineDateField.java4
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/DisabledParentLayout.java11
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/InlineDateFields.java12
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/PopupClosingWithEsc.java16
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java4
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutCellSizesUI.java4
-rw-r--r--uitest/src/main/java/com/vaadin/tests/themes/valo/DateFields.java26
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldChangeResolutionTest.java20
24 files changed, 105 insertions, 107 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/TestForBasicApplicationLayout.java b/uitest/src/main/java/com/vaadin/tests/TestForBasicApplicationLayout.java
index b61f8274b2..d4d6fa90e5 100644
--- a/uitest/src/main/java/com/vaadin/tests/TestForBasicApplicationLayout.java
+++ b/uitest/src/main/java/com/vaadin/tests/TestForBasicApplicationLayout.java
@@ -19,7 +19,7 @@ package com.vaadin.tests;
import java.util.Locale;
import com.vaadin.server.Sizeable;
-import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.shared.ui.datefield.DateResolution;
import com.vaadin.tests.components.TestDateField;
import com.vaadin.ui.AbstractDateField;
import com.vaadin.ui.Button;
@@ -83,7 +83,7 @@ public class TestForBasicApplicationLayout extends CustomComponent {
controls.addComponent(click2);
reportLayout.addComponent(controls);
final AbstractDateField cal = new TestDateField();
- cal.setResolution(Resolution.DAY);
+ cal.setResolution(DateResolution.DAY);
cal.setLocale(new Locale("en", "US"));
reportLayout.addComponent(cal);
reportLayout.setExpandRatio(controls, 1);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/TestDateField.java b/uitest/src/main/java/com/vaadin/tests/components/TestDateField.java
index 6a3004ed65..f6af101cbe 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/TestDateField.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/TestDateField.java
@@ -17,13 +17,13 @@ package com.vaadin.tests.components;
import java.time.LocalDate;
-import com.vaadin.ui.AbstractDateField;
+import com.vaadin.ui.AbstractLocalDateField;
/**
* @author Vaadin Ltd
*
*/
-public class TestDateField extends AbstractDateField {
+public class TestDateField extends AbstractLocalDateField {
/**
* Constructs an empty <code>DateField</code> with no 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
index 2e39af99d1..369abcc80f 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/datefield/AbstractDateFieldTest.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/AbstractDateFieldTest.java
@@ -6,12 +6,12 @@ import java.time.LocalDate;
import java.util.LinkedHashMap;
import java.util.Locale;
-import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.shared.ui.datefield.DateResolution;
import com.vaadin.tests.components.TestDateField;
import com.vaadin.tests.components.abstractfield.AbstractFieldTest;
-import com.vaadin.ui.AbstractDateField;
+import com.vaadin.ui.AbstractLocalDateField;
-public class AbstractDateFieldTest<T extends AbstractDateField>
+public class AbstractDateFieldTest<T extends AbstractLocalDateField>
extends AbstractFieldTest<T, LocalDate> {
@SuppressWarnings("unchecked")
@@ -90,19 +90,19 @@ public class AbstractDateFieldTest<T extends AbstractDateField>
}
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);
+ LinkedHashMap<String, DateResolution> options = new LinkedHashMap<>();
+ options.put("Year", DateResolution.YEAR);
+ options.put("Month", DateResolution.MONTH);
+ options.put("Day", DateResolution.DAY);
createSelectAction("Resolution", category, options, "Year",
resolutionCommand);
}
- private Command<T, Resolution> resolutionCommand = new Command<T, Resolution>() {
+ private Command<T, DateResolution> resolutionCommand = new Command<T, DateResolution>() {
@Override
- public void execute(T c, Resolution value, Object data) {
+ public void execute(T c, DateResolution value, Object data) {
c.setResolution(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 fd0591aa3b..18bd0319fc 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
@@ -18,7 +18,7 @@ package com.vaadin.tests.components.datefield;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.tests.components.TestDateField;
-import com.vaadin.ui.AbstractDateField;
+import com.vaadin.ui.AbstractLocalDateField;
import com.vaadin.ui.VerticalLayout;
public class AriaDisabled extends AbstractReindeerTestUI {
@@ -29,7 +29,7 @@ public class AriaDisabled extends AbstractReindeerTestUI {
content.setMargin(true);
content.setSpacing(true);
- final AbstractDateField disabledDateField = new TestDateField(
+ final AbstractLocalDateField disabledDateField = new TestDateField(
"Disabled DateField");
disabledDateField.setEnabled(false);
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 049dc643f0..3016b8ae1a 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
@@ -4,18 +4,18 @@ import java.time.LocalDate;
import java.util.Locale;
import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.shared.ui.datefield.DateResolution;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.tests.components.TestDateField;
-import com.vaadin.ui.AbstractDateField;
+import com.vaadin.ui.AbstractLocalDateField;
public class CustomDateFormat extends AbstractTestUI {
@Override
protected void setup(VaadinRequest request) {
Locale locale = new Locale("fi", "FI");
- AbstractDateField df = new TestDateField();
- df.setResolution(Resolution.DAY);
+ AbstractLocalDateField df = new TestDateField();
+ df.setResolution(DateResolution.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 6d40ed8ca0..ad698231cb 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
@@ -19,19 +19,19 @@ import java.time.LocalDate;
import java.util.Locale;
import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.shared.ui.datefield.DateResolution;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.tests.components.TestDateField;
-import com.vaadin.ui.AbstractDateField;
+import com.vaadin.ui.AbstractLocalDateField;
import com.vaadin.ui.VerticalLayout;
public class CustomDateFormatEEE extends AbstractReindeerTestUI {
@Override
protected void setup(VaadinRequest request) {
- AbstractDateField df = new TestDateField(
+ AbstractLocalDateField df = new TestDateField(
"Should display 14/03/2014 Fri");
- df.setResolution(Resolution.DAY);
+ df.setResolution(DateResolution.DAY);
df.setLocale(new Locale("en", "US"));
String pattern = "dd/MM/yyyy EEE";
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 2a8d17713f..3e04594de3 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
@@ -16,9 +16,9 @@
package com.vaadin.tests.components.datefield;
import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.shared.ui.datefield.DateResolution;
import com.vaadin.tests.components.AbstractReindeerTestUI;
-import com.vaadin.ui.AbstractDateField;
+import com.vaadin.ui.AbstractLocalDateField;
import com.vaadin.ui.Button;
import com.vaadin.ui.DateField;
import com.vaadin.ui.HorizontalLayout;
@@ -32,8 +32,8 @@ public class DateFieldChangeResolution extends AbstractReindeerTestUI {
@Override
protected void setup(VaadinRequest request) {
- final AbstractDateField dateField = new DateField("Enter date");
- dateField.setResolution(Resolution.YEAR);
+ final AbstractLocalDateField dateField = new DateField("Enter date");
+ dateField.setResolution(DateResolution.YEAR);
dateField.setId(DATEFIELD_ID);
addComponent(dateField);
@@ -41,7 +41,7 @@ public class DateFieldChangeResolution extends AbstractReindeerTestUI {
addComponent(l);
HorizontalLayout hlayout = new HorizontalLayout();
addComponent(hlayout);
- for (final Resolution value : Resolution.values()) {
+ for (final DateResolution value : DateResolution.values()) {
String resolutionString = value.toString().toLowerCase();
Button button = new Button(resolutionString);
button.addClickListener(event -> dateField.setResolution(value));
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 c7f2f1df9e..8bb63cfdc7 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
@@ -18,7 +18,7 @@ package com.vaadin.tests.components.datefield;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.tests.components.TestDateField;
-import com.vaadin.ui.AbstractDateField;
+import com.vaadin.ui.AbstractLocalDateField;
public class DateFieldClose extends AbstractReindeerTestUI {
@@ -26,7 +26,7 @@ public class DateFieldClose extends AbstractReindeerTestUI {
@Override
protected void setup(VaadinRequest request) {
- final AbstractDateField df = new TestDateField();
+ final AbstractLocalDateField 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 ab8a5ab233..e38dd6895c 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
@@ -4,7 +4,7 @@ import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.shared.ui.datefield.DateResolution;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.tests.components.TestDateField;
import com.vaadin.ui.AbstractDateField;
@@ -20,7 +20,8 @@ public class DateFieldDayResolutionOffset extends AbstractReindeerTestUI {
dateValue.setId("dateValue");
final DateTimeFormatter dateformat = getDateFormat();
- final AbstractDateField dateField = getDateField(dateformat);
+ final AbstractDateField<LocalDate, DateResolution> dateField = getDateField(
+ dateformat);
addComponent(dateValue);
addComponent(dateField);
@@ -29,11 +30,12 @@ public class DateFieldDayResolutionOffset extends AbstractReindeerTestUI {
.setValue(dateformat.format(dateField.getValue())));
}
- private AbstractDateField getDateField(DateTimeFormatter dateformat) {
- final AbstractDateField dateField = new TestDateField();
+ private AbstractDateField<LocalDate, DateResolution> getDateField(
+ DateTimeFormatter dateformat) {
+ final AbstractDateField<LocalDate, DateResolution> dateField = new TestDateField();
LocalDate initialDate = dateformat.parse(initialDateString,
LocalDate::from);
- dateField.setResolution(Resolution.DAY);
+ dateField.setResolution(DateResolution.DAY);
dateField.setValue(initialDate);
return dateField;
}
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 60a84dd679..1eb96e96ed 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
@@ -6,7 +6,7 @@ import java.time.format.DateTimeFormatter;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUIWithLog;
import com.vaadin.tests.components.TestDateField;
-import com.vaadin.ui.AbstractDateField;
+import com.vaadin.ui.AbstractLocalDateField;
public class DateFieldIsValid extends AbstractTestUIWithLog {
@@ -26,7 +26,8 @@ public class DateFieldIsValid extends AbstractTestUIWithLog {
@Override
protected void setup(VaadinRequest request) {
- final AbstractDateField dateField = new TestDateField("Insert Date: ");
+ final AbstractLocalDateField dateField = new TestDateField(
+ "Insert Date: ");
dateField.setDateFormat(pattern);
dateField.addValueChangeListener(event -> log("valueChange: value: "
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 d44ca3fe5a..50275dc1f3 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
@@ -18,7 +18,7 @@ package com.vaadin.tests.components.datefield;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.tests.components.TestDateField;
-import com.vaadin.ui.AbstractDateField;
+import com.vaadin.ui.AbstractLocalDateField;
public class DateFieldPopupClosing extends AbstractReindeerTestUI {
@@ -26,7 +26,7 @@ public class DateFieldPopupClosing extends AbstractReindeerTestUI {
@Override
protected void setup(VaadinRequest request) {
- final AbstractDateField df = new TestDateField();
+ final AbstractLocalDateField 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 67d5b3b404..f260f752ce 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
@@ -21,7 +21,7 @@ import java.util.TimerTask;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.tests.components.TestDateField;
-import com.vaadin.ui.AbstractDateField;
+import com.vaadin.ui.AbstractLocalDateField;
public class DateFieldPopupClosingOnDetach extends AbstractReindeerTestUI {
@@ -30,7 +30,7 @@ public class DateFieldPopupClosingOnDetach extends AbstractReindeerTestUI {
// Use polling to notice the removal of DateField.
getUI().setPollInterval(500);
- final AbstractDateField df = new TestDateField();
+ final AbstractLocalDateField df = new TestDateField();
getLayout().addLayoutClickListener(event -> {
// Use a background Thread to remove the DateField 1 second
// after being clicked.
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 e95cabc29b..0e2df6703f 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,7 +6,7 @@ import java.util.Locale;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.tests.components.TestDateField;
-import com.vaadin.ui.AbstractDateField;
+import com.vaadin.ui.AbstractLocalDateField;
import com.vaadin.ui.Button;
public class DateFieldReadOnly extends AbstractReindeerTestUI {
@@ -23,7 +23,7 @@ public class DateFieldReadOnly extends AbstractReindeerTestUI {
@Override
protected void setup(VaadinRequest request) {
- final AbstractDateField timeField = new TestDateField(
+ final AbstractLocalDateField timeField = new TestDateField(
"A read-only datefield");
timeField.setCaption(null);
timeField.setIcon(null);
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 9c7e36f5e3..e1f8d22c4b 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
@@ -5,7 +5,7 @@ import java.time.LocalDate;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.tests.components.TestDateField;
-import com.vaadin.ui.AbstractDateField;
+import com.vaadin.ui.AbstractLocalDateField;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.DateField;
import com.vaadin.ui.VerticalLayout;
@@ -22,8 +22,8 @@ public class DateFieldWhenChangingValueAndEnablingParent
main.setMargin(true);
setContent(main);
- final AbstractDateField df1 = createDateField(true);
- final AbstractDateField df2 = createDateField(false);
+ final AbstractLocalDateField df1 = createDateField(true);
+ final AbstractLocalDateField df2 = createDateField(false);
final DateField pdf1 = createPopupDateField(true, true);
final DateField pdf2 = createPopupDateField(true, false);
final DateField pdf3 = createPopupDateField(false, true);
@@ -50,8 +50,8 @@ public class DateFieldWhenChangingValueAndEnablingParent
});
}
- private AbstractDateField createDateField(boolean enabled) {
- AbstractDateField df = new TestDateField(
+ private AbstractLocalDateField createDateField(boolean enabled) {
+ AbstractLocalDateField df = new TestDateField(
"DateField, " + (enabled ? "enabled" : "disabled"));
df.setEnabled(enabled);
df.setId("DATEFIELD_" + (enabled ? "ENABLED" : "DISABLED"));
diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFields.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFields.java
index 379644cef4..ac11263bfc 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFields.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFields.java
@@ -5,7 +5,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
-import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.shared.ui.datefield.DateResolution;
import com.vaadin.tests.components.ComponentTestCase;
import com.vaadin.ui.Component;
import com.vaadin.ui.DateField;
@@ -46,7 +46,7 @@ public class DateFields extends ComponentTestCase<DateField> {
pd.setWidth(width);
pd.setValue(LocalDate.of(1970, 05, 23));
pd.setLocale(locale);
- pd.setResolution(Resolution.YEAR);
+ pd.setResolution(DateResolution.YEAR);
return pd;
}
@@ -65,10 +65,10 @@ public class DateFields extends ComponentTestCase<DateField> {
}
private Component createResolutionSelectAction() {
- LinkedHashMap<String, Resolution> options = new LinkedHashMap<>();
- options.put("Year", Resolution.YEAR);
- options.put("Month", Resolution.MONTH);
- options.put("Day", Resolution.DAY);
+ LinkedHashMap<String, DateResolution> options = new LinkedHashMap<>();
+ options.put("Year", DateResolution.YEAR);
+ options.put("Month", DateResolution.MONTH);
+ options.put("Day", DateResolution.DAY);
return createSelectAction("Resolution", options, "Year",
(field, value, data) -> field.setResolution(value));
}
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 352d905b8d..69119c71a0 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
@@ -18,13 +18,13 @@ package com.vaadin.tests.components.datefield;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.tests.components.TestDateField;
-import com.vaadin.ui.AbstractDateField;
+import com.vaadin.ui.AbstractLocalDateField;
public class DisabledDateFieldPopup extends AbstractReindeerTestUI {
@Override
protected void setup(VaadinRequest request) {
- AbstractDateField field = new TestDateField();
+ AbstractLocalDateField field = new TestDateField();
field.setEnabled(false);
addComponent(field);
}
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 7de3da119b..dd0e2135b1 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
@@ -19,14 +19,14 @@ import java.time.LocalDate;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractReindeerTestUI;
-import com.vaadin.ui.AbstractDateField;
+import com.vaadin.ui.AbstractLocalDateField;
import com.vaadin.ui.InlineDateField;
public class DisabledInlineDateField extends AbstractReindeerTestUI {
@Override
protected void setup(VaadinRequest request) {
- AbstractDateField df = new InlineDateField("Disabled");
+ AbstractLocalDateField df = new InlineDateField("Disabled");
LocalDate date = LocalDate.of(2014, 6, 5);
df.setValue(date);
df.setEnabled(false);
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 6b28c9a700..847a25174a 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
@@ -18,7 +18,7 @@ package com.vaadin.tests.components.datefield;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.tests.components.TestDateField;
-import com.vaadin.ui.AbstractDateField;
+import com.vaadin.ui.AbstractLocalDateField;
import com.vaadin.ui.Button;
import com.vaadin.ui.VerticalLayout;
@@ -36,18 +36,13 @@ public class DisabledParentLayout extends AbstractReindeerTestUI {
content.setMargin(true);
final VerticalLayout pane = new VerticalLayout();
- AbstractDateField dateField = new TestDateField();
+ AbstractLocalDateField dateField = new TestDateField();
pane.addComponent(dateField);
content.addComponent(pane);
Button button = new Button("Test");
- button.addClickListener(new Button.ClickListener() {
- @Override
- public void buttonClick(Button.ClickEvent event) {
- pane.setEnabled(!pane.isEnabled());
- }
- });
+ button.addClickListener(event -> pane.setEnabled(!pane.isEnabled()));
content.addComponent(button);
addComponent(content);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/InlineDateFields.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/InlineDateFields.java
index 19a44774a6..a49edc1e69 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/datefield/InlineDateFields.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/InlineDateFields.java
@@ -5,7 +5,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
-import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.shared.ui.datefield.DateResolution;
import com.vaadin.tests.components.ComponentTestCase;
import com.vaadin.ui.Component;
import com.vaadin.ui.InlineDateField;
@@ -51,7 +51,7 @@ public class InlineDateFields extends ComponentTestCase<InlineDateField> {
pd.setWidth(width);
pd.setValue(LocalDate.of(1970, 05, 23));
pd.setLocale(locale);
- pd.setResolution(Resolution.YEAR);
+ pd.setResolution(DateResolution.YEAR);
return pd;
}
@@ -70,10 +70,10 @@ public class InlineDateFields extends ComponentTestCase<InlineDateField> {
}
private Component createResolutionSelectAction() {
- LinkedHashMap<String, Resolution> options = new LinkedHashMap<>();
- options.put("Year", Resolution.YEAR);
- options.put("Month", Resolution.MONTH);
- options.put("Day", Resolution.DAY);
+ LinkedHashMap<String, DateResolution> options = new LinkedHashMap<>();
+ options.put("Year", DateResolution.YEAR);
+ options.put("Month", DateResolution.MONTH);
+ options.put("Day", DateResolution.DAY);
return createSelectAction("Resolution", options, "Year",
(field, value, data) -> field.setResolution(value));
}
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 54614dd7aa..3de76b970e 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
@@ -16,27 +16,27 @@
package com.vaadin.tests.components.datefield;
import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.shared.ui.datefield.DateResolution;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.tests.components.TestDateField;
-import com.vaadin.ui.AbstractDateField;
+import com.vaadin.ui.AbstractLocalDateField;
import com.vaadin.ui.VerticalLayout;
public class PopupClosingWithEsc extends AbstractReindeerTestUI {
@Override
protected void setup(VaadinRequest request) {
- AbstractDateField df1 = new TestDateField("Day");
+ AbstractLocalDateField df1 = new TestDateField("Day");
df1.setId("day");
- df1.setResolution(Resolution.DAY);
+ df1.setResolution(DateResolution.DAY);
- AbstractDateField df2 = new TestDateField("Month");
+ AbstractLocalDateField df2 = new TestDateField("Month");
df2.setId("month");
- df2.setResolution(Resolution.MONTH);
+ df2.setResolution(DateResolution.MONTH);
- AbstractDateField df3 = new TestDateField("Year");
+ AbstractLocalDateField df3 = new TestDateField("Year");
df3.setId("year");
- df3.setResolution(Resolution.YEAR);
+ df3.setResolution(DateResolution.YEAR);
VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
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 ee3bea20eb..a3e0896b04 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
@@ -5,7 +5,7 @@ import java.util.Locale;
import java.util.stream.Stream;
import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.shared.ui.datefield.DateResolution;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.DateField;
@@ -52,7 +52,7 @@ public class PopupDateFieldExtendedRange extends AbstractReindeerTestUI {
private DateField makeDateField() {
DateField pdf = new DateField();
- pdf.setResolution(Resolution.DAY);
+ pdf.setResolution(DateResolution.DAY);
pdf.setValue(LocalDate.of(2011, 1, 1));
return pdf;
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutCellSizesUI.java b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutCellSizesUI.java
index ab20c110db..39fc3f8e31 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutCellSizesUI.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutCellSizesUI.java
@@ -1,7 +1,7 @@
package com.vaadin.tests.components.gridlayout;
import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.shared.ui.datefield.DateResolution;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.GridLayout;
@@ -32,7 +32,7 @@ public class GridLayoutCellSizesUI extends AbstractReindeerTestUI {
grid.addComponent(new Button("3x1 button"), 1, 1, 3, 1);
grid.addComponent(new Label("1x2 cell"), 1, 2, 1, 3);
final InlineDateField date = new InlineDateField("A 2x2 date field");
- date.setResolution(Resolution.DAY);
+ date.setResolution(DateResolution.DAY);
grid.addComponent(date, 2, 2, 3, 3);
grid.setMargin(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 3012261fea..dc6f5ccf48 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,7 +22,7 @@ import java.util.Locale;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.server.UserError;
-import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.shared.ui.datefield.DateResolution;
import com.vaadin.tests.components.TestDateField;
import com.vaadin.ui.AbstractDateField;
import com.vaadin.ui.Button;
@@ -90,58 +90,58 @@ public class DateFields extends VerticalLayout implements View {
date = new TestDateField("Day resolution");
setDate(date);
- date.setResolution(Resolution.DAY);
+ date.setResolution(DateResolution.DAY);
row.addComponent(date);
date = new TestDateField("Month resolution");
setDate(date);
- date.setResolution(Resolution.MONTH);
+ date.setResolution(DateResolution.MONTH);
row.addComponent(date);
date = new TestDateField("Year resolution");
setDate(date);
- date.setResolution(Resolution.YEAR);
+ date.setResolution(DateResolution.YEAR);
row.addComponent(date);
date = new TestDateField("Custom color");
setDate(date);
- date.setResolution(Resolution.DAY);
+ date.setResolution(DateResolution.DAY);
date.addStyleName("color1");
row.addComponent(date);
date = new TestDateField("Custom color");
setDate(date);
- date.setResolution(Resolution.DAY);
+ date.setResolution(DateResolution.DAY);
date.addStyleName("color2");
row.addComponent(date);
date = new TestDateField("Custom color");
setDate(date);
- date.setResolution(Resolution.DAY);
+ date.setResolution(DateResolution.DAY);
date.addStyleName("color3");
row.addComponent(date);
date = new TestDateField("Small");
setDate(date);
- date.setResolution(Resolution.DAY);
+ date.setResolution(DateResolution.DAY);
date.addStyleName(ValoTheme.DATEFIELD_SMALL);
row.addComponent(date);
date = new TestDateField("Large");
setDate(date);
- date.setResolution(Resolution.DAY);
+ date.setResolution(DateResolution.DAY);
date.addStyleName(ValoTheme.DATEFIELD_LARGE);
row.addComponent(date);
date = new TestDateField("Borderless");
setDate(date);
- date.setResolution(Resolution.DAY);
+ date.setResolution(DateResolution.DAY);
date.addStyleName(ValoTheme.DATEFIELD_BORDERLESS);
row.addComponent(date);
date = new TestDateField("Week numbers");
setDate(date);
- date.setResolution(Resolution.DAY);
+ date.setResolution(DateResolution.DAY);
date.setLocale(new Locale("fi", "fi"));
date.setShowISOWeekNumbers(true);
row.addComponent(date);
@@ -153,13 +153,13 @@ public class DateFields extends VerticalLayout implements View {
date = new TestDateField("Tiny");
setDate(date);
- date.setResolution(Resolution.DAY);
+ date.setResolution(DateResolution.DAY);
date.addStyleName(ValoTheme.DATEFIELD_TINY);
row.addComponent(date);
date = new TestDateField("Huge");
setDate(date);
- date.setResolution(Resolution.DAY);
+ date.setResolution(DateResolution.DAY);
date.addStyleName(ValoTheme.DATEFIELD_HUGE);
row.addComponent(date);
diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldChangeResolutionTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldChangeResolutionTest.java
index 975bb93d2f..1ab54ff12b 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldChangeResolutionTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldChangeResolutionTest.java
@@ -24,7 +24,7 @@ import org.junit.Test;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
-import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.shared.ui.datefield.DateResolution;
import com.vaadin.testbench.By;
import com.vaadin.tests.tb3.MultiBrowserTest;
@@ -37,19 +37,19 @@ public class DateFieldChangeResolutionTest extends MultiBrowserTest {
public void changeResolutionBetweenYearAndMonth() throws Exception {
initialize();
click(resolutionMonth);
- checkHeaderAndBody(Resolution.MONTH, true);
+ checkHeaderAndBody(DateResolution.MONTH, true);
click(resolutionYear);
- checkHeaderAndBody(Resolution.YEAR, true);
+ checkHeaderAndBody(DateResolution.YEAR, true);
}
@Test
public void changeResolutionToDayThenMonth() throws Exception {
initialize();
- checkHeaderAndBody(Resolution.YEAR, true); // check the initial state
+ checkHeaderAndBody(DateResolution.YEAR, true); // check the initial state
click(resolutionDay);
- checkHeaderAndBody(Resolution.DAY, true);
+ checkHeaderAndBody(DateResolution.DAY, true);
click(resolutionMonth);
- checkHeaderAndBody(Resolution.MONTH, true);
+ checkHeaderAndBody(DateResolution.MONTH, true);
}
@Test
@@ -66,7 +66,7 @@ public class DateFieldChangeResolutionTest extends MultiBrowserTest {
// Change resolutions and check that the selected date is not lost and
// that the calendar has the correct resolution.
click(resolutionYear);
- checkHeaderAndBody(Resolution.YEAR, false);
+ checkHeaderAndBody(DateResolution.YEAR, false);
}
private void initialize() {
@@ -81,19 +81,19 @@ public class DateFieldChangeResolutionTest extends MultiBrowserTest {
resolutionYear = driver.findElement(By.id(BUTTON_BASE_ID + "year"));
}
- private void checkHeaderAndBody(Resolution resolution,
+ private void checkHeaderAndBody(DateResolution resolution,
boolean textFieldIsEmpty) throws Exception {
// Popup date field has all kinds of strange timers on the
// client side
sleep(100);
// Open the popup calendar, perform checks and close the popup.
openPopupDateField();
- if (resolution.compareTo(Resolution.MONTH) <= 0) {
+ if (resolution.compareTo(DateResolution.MONTH) <= 0) {
checkMonthHeader();
} else {
checkYearHeader();
}
- if (resolution.compareTo(Resolution.DAY) <= 0) {
+ if (resolution.compareTo(DateResolution.DAY) <= 0) {
assertTrue(
"A calendar with the chosen resolution should have a body",
calendarHasBody());