diff options
Diffstat (limited to 'shared')
3 files changed, 107 insertions, 26 deletions
diff --git a/shared/src/main/java/com/vaadin/shared/ui/datefield/AbstractDateFieldServerRpc.java b/shared/src/main/java/com/vaadin/shared/ui/datefield/AbstractDateFieldServerRpc.java new file mode 100644 index 0000000000..2ef8993fb6 --- /dev/null +++ b/shared/src/main/java/com/vaadin/shared/ui/datefield/AbstractDateFieldServerRpc.java @@ -0,0 +1,55 @@ +/* + * 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 java.util.Map; + +import com.vaadin.shared.communication.ServerRpc; + +/** + * RPC interface for calls from client to server. + * + * @since + */ +public interface AbstractDateFieldServerRpc extends ServerRpc { + + /** + * Updates the typed data string and resolution names and values. + * + * @param newDateString + * the value of the text field part. It enables analyzing invalid + * input on the server. {@code null} if the date was chosen with + * popup calendar or contains user-typed string + * @param invalidDateString + * Whether the last date string is invalid or not + * @param resolutions + * map of time unit (resolution) name and value, name is the + * lower-case resolution name e.g. "hour", "minute", and value + * can be {@code null} + */ + void update(String newDateString, boolean invalidDateString, + Map<String, Integer> resolutions); + + /** + * Indicates to the server that the client-side has lost focus. + */ + void blur(); + + /** + * Indicates to the server that the client-side has acquired focus. + */ + void focus(); +} diff --git a/shared/src/main/java/com/vaadin/shared/ui/datefield/AbstractDateFieldState.java b/shared/src/main/java/com/vaadin/shared/ui/datefield/AbstractDateFieldState.java index 5bd920389e..cd1791464c 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/datefield/AbstractDateFieldState.java +++ b/shared/src/main/java/com/vaadin/shared/ui/datefield/AbstractDateFieldState.java @@ -16,6 +16,8 @@ package com.vaadin.shared.ui.datefield; import java.util.Date; +import java.util.HashMap; +import java.util.Map; import com.vaadin.shared.AbstractFieldState; import com.vaadin.shared.annotations.NoLayout; @@ -54,4 +56,54 @@ public class AbstractDateFieldState extends AbstractFieldState { * @since 8.2 */ public String timeZoneJSON; + + /** + * The used Locale, can be {@code null}. + * + * @since + */ + public String locale; + + /** + * Overridden date format string, can be {@code null} if default formatting + * of the components locale is used. + * + * @since + */ + public String format; + + /** + * Whether the date/time interpretation is lenient. + * + * @since + */ + public boolean lenient; + + /** + * The map of {@code Resolution}s which are currently used by the component. + * + * The key is the resolution name e.g. "HOUR", "MINUTE", with possibly + * prefixed by "default-". + * + * The value can be {@code null} + * + * @since + */ + public Map<String, Integer> resolutions = new HashMap<>(); + + /** + * Determines if week numbers are shown in the date selector. + * + * @since + */ + public boolean showISOWeekNumbers; + + /** + * Was the last entered string parsable? If this flag is false, datefields + * internal validator does not pass. + * + * @since + */ + public boolean parsable = true; + } diff --git a/shared/src/main/java/com/vaadin/shared/ui/datefield/DateFieldConstants.java b/shared/src/main/java/com/vaadin/shared/ui/datefield/DateFieldConstants.java deleted file mode 100644 index b9cc88d708..0000000000 --- a/shared/src/main/java/com/vaadin/shared/ui/datefield/DateFieldConstants.java +++ /dev/null @@ -1,26 +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 java.io.Serializable; - -@Deprecated -public class DateFieldConstants implements Serializable { - - @Deprecated - public static final String ATTR_WEEK_NUMBERS = "wn"; - -} |