Package com.vaadin.featurepack.ui
Interface NullValueCapable<V extends Serializable>
- Type Parameters:
V- the value type of the implementing component
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
FAbstractTextField
- All Known Implementing Classes:
FPasswordField,FTextArea,FTextField
Interface to provide null-handling capabilities of v7/v8 legacy Vaadin
components for their Vaadin Flow counterparts that do not inherently support
null values.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault VGets the current null representation used to displaynullvalues.Returns the controller that provides logic for handling null-value behavior.default booleanWhether the values matching the null representation will always be converted tonullvalues.default VprocessGetValue(V value) Processes the value retrieved from the underlying component before returning it to the caller.default VprocessSetValue(V value) Processes a value before setting it into the underlying component.default voidsetNullRepresentation(V nullRepresentation) Sets the representation of anullvalue.default voidsetNullSettingAllowed(boolean nullSettingAllowed) Configures whether values matching the null representation should be interpreted asnullvalues.
-
Method Details
-
getNullValueController
NullValueController<V> getNullValueController()Returns the controller that provides logic for handling null-value behavior.- Returns:
- the
NullValueControllerinstance
-
processGetValue
Processes the value retrieved from the underlying component before returning it to the caller. If the stored state indicates that the current value should be considered null, this method returns null instead of the null representation.- Parameters:
value- the value as obtained from the underlying component- Returns:
- the processed value, potentially converted to null if conditions are met
-
processSetValue
Processes a value before setting it into the underlying component. If the value isnullor matches the configured null representation and the appropriate null-setting conditions are met, the underlying component will store the null representation instead ofnull.- Parameters:
value- the intended value to set- Returns:
- the processed value, the null representation if null-setting logic applies
-
isNullSettingAllowed
default boolean isNullSettingAllowed()Whether the values matching the null representation will always be converted tonullvalues.- Returns:
trueif values matching null representation are always converted tonullvalues,falseotherwise- See Also:
-
setNullSettingAllowed
default void setNullSettingAllowed(boolean nullSettingAllowed) Configures whether values matching the null representation should be interpreted asnullvalues. Setting this totruemeans that whenever the user inputs the null representation, the logical value of the component becomesnull. Whenfalse, the null representation is displayed but the value is not automatically translated tonull. By default, this setting isfalse.- Parameters:
nullSettingAllowed-trueto always convert the null representation into anullvalue,falseotherwise
-
getNullRepresentation
Gets the current null representation used to displaynullvalues. When the component cannot natively have anullvalue, this representation is displayed in its place. If this property is set tonull, an exception will be thrown when attempting to display what should be anullvalue.- Returns:
- the current representation used in place of
nullvalues - See Also:
-
setNullRepresentation
Sets the representation of anullvalue. If this property is set tonull, attempting to display anullvalue will throw an exception.- Parameters:
nullRepresentation- the representation to use for null values
-