Package com.vaadin.flow.data.value
Enum ValueChangeMode
- java.lang.Object
-
- java.lang.Enum<ValueChangeMode>
-
- com.vaadin.flow.data.value.ValueChangeMode
-
- All Implemented Interfaces:
Serializable,Comparable<ValueChangeMode>
public enum ValueChangeMode extends Enum<ValueChangeMode>
All possible value change modes that can be set for any component extendingHasValueChangeMode. Depending on the mode used, the component'svalueis synced differently from the client to the server.- Since:
- 1.0.
- Author:
- Vaadin Ltd
-
-
Enum Constant Summary
Enum Constants Enum Constant Description EAGERSyncs the value to the server each time it's changed on the client.LAZYOn every user event, schedule a synchronization after a defined interval, cancelling the currently-scheduled event if any.ON_BLURSyncs the value to the server onblurevent, i.e.ON_CHANGESyncs the value to the server onchangeevent, i.e.TIMEOUTSyncs the value at defined intervals as long as the value changes from one event to the next.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidapplyChangeTimeout(ValueChangeMode mode, int timeout, DomListenerRegistration registration)Applies the value change timeout of the given mode on the registration of the DOM event listener that synchronizes.static StringeventForMode(ValueChangeMode mode, String immediateEventName)Gets the name of the event associated with the given mode.static ValueChangeModevalueOf(String name)Returns the enum constant of this type with the specified name.static ValueChangeMode[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
EAGER
public static final ValueChangeMode EAGER
Syncs the value to the server each time it's changed on the client. The event that triggers the synchronization is defined by the component.
-
LAZY
public static final ValueChangeMode LAZY
On every user event, schedule a synchronization after a defined interval, cancelling the currently-scheduled event if any.The recommended default timeout for input fields is
HasValueChangeMode.DEFAULT_CHANGE_TIMEOUT.
-
TIMEOUT
public static final ValueChangeMode TIMEOUT
Syncs the value at defined intervals as long as the value changes from one event to the next.
-
ON_BLUR
public static final ValueChangeMode ON_BLUR
Syncs the value to the server onblurevent, i.e. when the component looses focus.- See Also:
- Blur event description
-
ON_CHANGE
public static final ValueChangeMode ON_CHANGE
Syncs the value to the server onchangeevent, i.e. when the component value is committed.- See Also:
- Change event description
-
-
Method Detail
-
values
public static ValueChangeMode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ValueChangeMode c : ValueChangeMode.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ValueChangeMode valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
eventForMode
public static String eventForMode(ValueChangeMode mode, String immediateEventName)
Gets the name of the event associated with the given mode. If the mode isnull, then null is returned. If the mode isEAGER,LAZY, orTIMEOUT, then the provided immediate event name is returned.- Parameters:
mode- the value change modeimmediateEventName- the name of the event that is fired immediately on value change- Returns:
- the event name
- See Also:
HasValueChangeMode.setValueChangeMode(ValueChangeMode),AbstractSinglePropertyField.setSynchronizedEvent(String)
-
applyChangeTimeout
public static void applyChangeTimeout(ValueChangeMode mode, int timeout, DomListenerRegistration registration)
Applies the value change timeout of the given mode on the registration of the DOM event listener that synchronizes. It has any effect only forLAZY, orTIMEOUT.- Parameters:
mode- the value change modetimeout- Value change timeout in milliseconds.0means timeout is disabled, so the change mode will behave likeEAGERregistration- The registration of the DOM event listener that synchronizes.- See Also:
HasValueChangeMode.getValueChangeTimeout(),AbstractSinglePropertyField.getSynchronizationRegistration()
-
-