From d36d63fefa3ab9f4908f97772bcc6499e4f52532 Mon Sep 17 00:00:00 2001 From: Denis Anisimov Date: Tue, 27 Sep 2016 10:41:37 +0300 Subject: Make AbstractDateField based on LocalDate (#125). Change-Id: I33a4a4f0f3437a8d1733031a131afbe844c12afb --- .../vaadin/shared/ui/datefield/DateFieldState.java | 30 ++++++++++++++++++++++ .../shared/ui/datefield/PopupDateFieldState.java | 30 ---------------------- .../com/vaadin/shared/ui/datefield/Resolution.java | 21 ++------------- 3 files changed, 32 insertions(+), 49 deletions(-) create mode 100644 shared/src/main/java/com/vaadin/shared/ui/datefield/DateFieldState.java delete mode 100644 shared/src/main/java/com/vaadin/shared/ui/datefield/PopupDateFieldState.java (limited to 'shared/src') diff --git a/shared/src/main/java/com/vaadin/shared/ui/datefield/DateFieldState.java b/shared/src/main/java/com/vaadin/shared/ui/datefield/DateFieldState.java new file mode 100644 index 0000000000..f71d33fb3a --- /dev/null +++ b/shared/src/main/java/com/vaadin/shared/ui/datefield/DateFieldState.java @@ -0,0 +1,30 @@ +/* + * 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.shared.ui.datefield; + +import com.vaadin.shared.annotations.NoLayout; + +public class DateFieldState extends TextualDateFieldState { + public static final String DESCRIPTION_FOR_ASSISTIVE_DEVICES = "Arrow down key opens calendar element for choosing the date"; + + { + primaryStyleName = "v-datefield"; + } + + public boolean textFieldEnabled = true; + @NoLayout + public String descriptionForAssistiveDevices = DESCRIPTION_FOR_ASSISTIVE_DEVICES; +} diff --git a/shared/src/main/java/com/vaadin/shared/ui/datefield/PopupDateFieldState.java b/shared/src/main/java/com/vaadin/shared/ui/datefield/PopupDateFieldState.java deleted file mode 100644 index 3489346564..0000000000 --- a/shared/src/main/java/com/vaadin/shared/ui/datefield/PopupDateFieldState.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.shared.ui.datefield; - -import com.vaadin.shared.annotations.NoLayout; - -public class PopupDateFieldState extends TextualDateFieldState { - public static final String DESCRIPTION_FOR_ASSISTIVE_DEVICES = "Arrow down key opens calendar element for choosing the date"; - - { - primaryStyleName = "v-datefield"; - } - - public boolean textFieldEnabled = true; - @NoLayout - public String descriptionForAssistiveDevices = DESCRIPTION_FOR_ASSISTIVE_DEVICES; -} diff --git a/shared/src/main/java/com/vaadin/shared/ui/datefield/Resolution.java b/shared/src/main/java/com/vaadin/shared/ui/datefield/Resolution.java index 93dbb7ab83..0fc5da4803 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/datefield/Resolution.java +++ b/shared/src/main/java/com/vaadin/shared/ui/datefield/Resolution.java @@ -25,25 +25,7 @@ import java.util.List; * @since 7.0 */ public enum Resolution { - // Values from Calendar.SECOND etc. Set as ints to avoid Calendar dependency - // (does not exist on the client side) - SECOND(13), MINUTE(12), HOUR(11), DAY(5), MONTH(2), YEAR(1); - - private int calendarField; - - private Resolution(int calendarField) { - this.calendarField = calendarField; - } - - /** - * Returns the field in java.util.Calendar that corresponds to this - * resolution. - * - * @return one of the field numbers used by Calendar - */ - public int getCalendarField() { - return calendarField; - } + DAY, MONTH, YEAR; /** * Returns the resolutions that are higher or equal to the given resolution, @@ -81,4 +63,5 @@ public enum Resolution { } return resolutions; } + } -- cgit v1.2.3