Class FAbstractField<T>
- All Implemented Interfaces:
Buffered,BufferedValidatable,Property<T>,Property.Editor,Property.ReadOnlyStatusChangeListener,Property.ReadOnlyStatusChangeNotifier,Property.ValueChangeListener,Property.ValueChangeNotifier,Property.Viewer,Field<T>,Validatable,com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.ComponentEventListener,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<AbstractField<T>,,T>, T> com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<AbstractField<T>,,T>, T> Serializable,EventListener
- Direct Known Subclasses:
AbstractField
FAbstractField has Vaadin 7 AbstractField functionality. If extended directly
by a component, it will inherit Vaadin 7 AbstractField API and also all
Flow's AbstractField functionality. If used by a component indirectly
by implementing Field interface, it will have functionality of Vaadin
7 AbstractField API, but only public part can be overridden.
Abstract field component for implementing buffered property editors. The
field may hold an internal value, or it may be connected to any data source
that implements the Propertyinterface. AbstractField
implements that interface itself, too, so accessing the Property value
represented by it is straightforward.
AbstractField also provides the Buffered interface for buffering the
data source value. By default the Field is not buffered and
setBuffered(boolean) (boolean)} should be called to enable
buffering.
The class also supports validators to make sure the value
contained in the field is valid.
- Since:
- 3.0
- Author:
- Vaadin Ltd.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAnEventobject specifying the Property whose read-only status has changed.Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V> Nested classes/interfaces inherited from interface com.vaadin.featurepack.data.Buffered
Buffered.SourceExceptionNested classes/interfaces inherited from interface com.vaadin.featurepack.data.ui.Field
Field.ValueChangeEventNested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>>Nested classes/interfaces inherited from interface com.vaadin.featurepack.data.Property
Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidRegisters this as an event listener for events sent by the data source (if any).voidaddValidator(Validator validator) Adds a new validator for the field's value.voidRegisters a new value change listener for this Property.voidcommit()Updates all changes since the previous commit to the data source.voiddiscard()Discards all changes since last commit.protected voidfireValueChange(boolean repaintIsNotNeeded) Emits the value change event.Gets the error that is shown if the field value cannot be converted to the data source type.protected StringgetConversionError(Class<?> dataSourceType, ConversionException e) Returns the conversion error with {0} replaced by the data source type and {1} replaced by the exception (localized) message.Returns the current value (as returned bygetValue()) converted to the data source type.Gets the converter used to convert the property data source value to the field value.protected Buffered.SourceExceptionGets the current buffered source exception.protected ObjectGets the value from the data source.Error messages shown by the fields are composites of the error message thrown by the superclasses (that is the component error message), validation errors and buffered source errors.Public version ofgetInternalValue()for subcomponents overriding the default functionality.protected TReturns the internal field value, which might not match the data source value e.g. if the field has been modified and is not in write-through mode.protected Class<?> Retrieves the type of the currently used data model.Gets the current data source of the field, if any.Gets the error message that is to be displayed if a required field is empty.getType()Returns the type of the Property.Gets the validators of the field.getValue()Gets the current value of the field.booleanChecks the buffered mode of this Field.booleanisEmpty()Is the field empty?booleanFields allow invalid values by default.booleanTests if the invalid data is committed to datasource.booleanTests if the value stored in the object has been modified since it was last updated from the data source.booleanThe abstract field is read only also if the data source is in read only mode.booleanIs this field required.booleanisValid()Tests the current value against registered validators if the field is not empty.booleanIs automatic, visible validation enabled?voidonComponentEvent(com.vaadin.flow.component.ComponentEvent event) voidReact to read only status changes of the property by requesting a repaint.voidRemoves all validators from the field.protected voidStops listening to events sent by the data source (if any).voidremoveValidator(Validator validator) Removes the validator from the field.voidRemoves a previously registered value change listener.voidsetBuffered(boolean buffered) Sets the buffered mode of this Field.voidsetConversionError(String valueConversionError) Sets the error that is shown if the field value cannot be converted to the data source type.voidsetConvertedValue(Object value) Sets the value of the field using a value of the data source type.voidsetConverter(Converter<T, ?> converter) Sets the converter used to convert the field value to property data source type.voidsetConverter(Class<?> datamodelType) Retrieves a converter for the field from the converter factory defined for the application.voidsetCurrentBufferedSourceException(Buffered.SourceException currentBufferedSourceException) Sets the current buffered source exception.voidsetFInternalValue(T newValue) Public version ofsetInternalValue(T)for subcomponents overriding the default functionality.protected voidsetInternalValue(T newValue) Sets the internal field value.voidsetInvalidAllowed(boolean invalidAllowed) Fields allow invalid values by default.voidsetInvalidCommitted(boolean isCommitted) Sets if the invalid data should be committed to datasource.protected voidsetModified(boolean modified) protected voidsetPresentationValue(T newPresentationValue) voidsetPropertyDataSource(Property newDataSource) Sets the specified Property as the data source for the field.voidsetPropertyReadOnly(boolean newStatus) Sets the Property's read-only mode to the specified status.voidsetRequired(boolean required) Sets the field required.voidsetRequiredError(String requiredMessage) Set the error that is show if this field is required, but empty.voidsetupForComponent(com.vaadin.flow.component.Component component) voidsetValidationVisible(boolean validateAutomatically) Enable or disable automatic, visible validation.voidSets the value of the field.protected voidSets the value of the field.protected voidSets the value of the field.booleanReturns true if the error indicator be hidden when painting the component even when there are errors.voidvalidate()Checks the validity of the Field.protected voidValidates that the given value pass the validators for the field.voidThis method listens to data source value changes and passes the changes forwards.Methods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, bindValue, getEmptyValue, setModelValue, valueEqualsMethods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, getUIOrThrow, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisible, whenAttachedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.featurepack.data.ui.Field
addReadOnlyStatusChangeListener, getFAbstractField, removeReadOnlyStatusChangeListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
bindEnabled, isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasValue
clear, getOptionalValueMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
bindReadOnly, bindRequiredIndicatorVisible, isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible
-
Field Details
-
dataSource
Connected data-source. -
modified
public boolean modified -
VALUE_CHANGE_LISTENER_DISABLED
Component data key for disabling value change listener in FAbstractField for special cases. For internal use only.- See Also:
-
-
Constructor Details
-
FAbstractField
public FAbstractField() -
FAbstractField
public FAbstractField(com.vaadin.flow.component.Component component)
-
-
Method Details
-
shouldHideErrors
public boolean shouldHideErrors()Returns true if the error indicator be hidden when painting the component even when there are errors. This is a mostly internal method, but can be overridden in subclasses e.g. if the error indicator should also be shown for empty fields in some cases.- Returns:
- true to hide the error indicator, false to use the normal logic to show it when there are errors
-
setupForComponent
public void setupForComponent(com.vaadin.flow.component.Component component) -
isInvalidCommitted
public boolean isInvalidCommitted()Tests if the invalid data is committed to datasource.- Specified by:
isInvalidCommittedin interfaceBufferedValidatable- Specified by:
isInvalidCommittedin interfaceField<T>- See Also:
-
setInvalidCommitted
public void setInvalidCommitted(boolean isCommitted) Sets if the invalid data should be committed to datasource.- Specified by:
setInvalidCommittedin interfaceBufferedValidatable- Specified by:
setInvalidCommittedin interfaceField<T>- See Also:
-
commit
Description copied from interface:BufferedUpdates all changes since the previous commit to the data source. The value stored in the object will always be updated into the data source whencommitis called.- Specified by:
commitin interfaceBuffered- Specified by:
commitin interfaceField<T>- Throws:
Buffered.SourceException- if the operation fails because of an exception is thrown by the data source. The cause is included in the exception.Validator.InvalidValueException- if the operation fails because validation is enabled and the values do not validate
-
discard
Description copied from interface:BufferedDiscards all changes since last commit. The object updates its value from the data source. -
getDataSourceValue
Gets the value from the data source. This is only here because of clarity in the code that handles both the data model value and the field value.- Returns:
- The value of the property data source
-
isModified
public boolean isModified()Description copied from interface:BufferedTests if the value stored in the object has been modified since it was last updated from the data source.- Specified by:
isModifiedin interfaceBuffered- Specified by:
isModifiedin interfaceField<T>- Returns:
trueif the value in the object has been modified since the last data source update,falseif not.
-
setModified
protected void setModified(boolean modified) -
setBuffered
public void setBuffered(boolean buffered) Sets the buffered mode of this Field.When the field is in buffered mode, changes will not be committed to the property data source until
commit()is called.Setting buffered mode from true to false will commit any pending changes.
- Specified by:
setBufferedin interfaceBuffered- Specified by:
setBufferedin interfaceField<T>- Parameters:
buffered- true if buffered mode should be turned on, false otherwise- Since:
- 7.0.0
-
isBuffered
public boolean isBuffered()Checks the buffered mode of this Field.- Specified by:
isBufferedin interfaceBuffered- Specified by:
isBufferedin interfaceField<T>- Returns:
- true if buffered mode is on, false otherwise
-
getValue
Gets the current value of the field.This is the visible, modified and possible invalid value the user have entered to the field.
Note that the object returned is compatible with getType(). For example, if the type is String, this returns Strings even when the underlying datasource is of some other type. In order to access the converted value, use
getConvertedValue()and to access the value of the property data source, useProperty.getValue()for the property data source.Since Vaadin 7.0, no implicit conversions between other data types and String are performed, but a converter is used if set.
- Specified by:
getValuein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<AbstractField<T>,T>, T> - Specified by:
getValuein interfaceProperty<T>- Overrides:
getValuein classcom.vaadin.flow.component.AbstractField<AbstractField<T>,T> - Returns:
- the current value of the field.
-
setValue
Sets the value of the field.- Specified by:
setValuein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<AbstractField<T>,T>, T> - Specified by:
setValuein interfaceProperty<T>- Overrides:
setValuein classcom.vaadin.flow.component.AbstractField<AbstractField<T>,T> - Parameters:
newFieldValue- the New value of the field.- Throws:
Property.ReadOnlyExceptionConversionException
-
setValue
Sets the value of the field.- Parameters:
newFieldValue- the New value of the field.repaintIsNotNeeded- True iff caller is sure that repaint is not needed.- Throws:
Property.ReadOnlyExceptionConverter.ConversionExceptionValidator.InvalidValueException
-
setValue
protected void setValue(T newFieldValue, boolean repaintIsNotNeeded, boolean ignoreReadOnly) throws Property.ReadOnlyException, ConversionException, Validator.InvalidValueException Sets the value of the field.- Parameters:
newFieldValue- the New value of the field.repaintIsNotNeeded- True iff caller is sure that repaint is not needed.ignoreReadOnly- True iff if the read-only check should be ignored- Throws:
Property.ReadOnlyExceptionConverter.ConversionExceptionValidator.InvalidValueExceptionConversionException- Since:
- 7.5.7
-
getPropertyDataSource
Gets the current data source of the field, if any.- Specified by:
getPropertyDataSourcein interfaceField<T>- Specified by:
getPropertyDataSourcein interfaceProperty.Viewer- Returns:
- the current data source as a Property, or
nullif none defined.
-
setPropertyDataSource
Sets the specified Property as the data source for the field. All uncommitted changes are replaced with a value from the new data source.
If the datasource has any validators, the same validators are added to the field. Because the default behavior of the field is to allow invalid values, but not to allow committing them, this only adds visual error messages to fields and do not allow committing them as long as the value is invalid. After the value is valid, the error message is not shown and the commit can be done normally.
If the data source implements
Property.ValueChangeNotifierand/orProperty.ReadOnlyStatusChangeNotifier, the field registers itself as a listener and updates itself according to the events it receives. To avoid memory leaks caused by references to a field no longer in use, the listener registrations are removed onand re-added oninvalid reference
detach.invalid reference
attachNote: before 6.5 we actually called discard() method in the beginning of the method. This was removed to simplify implementation, avoid excess calls to backing property and to avoid odd value change events that were previously fired (developer expects 0-1 value change events if this method is called). Some complex field implementations might now need to override this method to do housekeeping similar to discard().
- Specified by:
setPropertyDataSourcein interfaceField<T>- Specified by:
setPropertyDataSourcein interfaceProperty.Viewer- Parameters:
newDataSource- the new data source Property.
-
setConverter
Retrieves a converter for the field from the converter factory defined for the application. Clears the converter if no application reference is available or if the factory returns null.- Parameters:
datamodelType- The type of the data model that we want to be able to convert from
-
getModelType
Retrieves the type of the currently used data model. If the field has no data source then the model type of the converter is used.- Returns:
- The type of the currently used data model or null if no data source or converter is set.
- Since:
- 7.1
-
getConversionError
Returns the conversion error with {0} replaced by the data source type and {1} replaced by the exception (localized) message.- Parameters:
dataSourceType- the type of the data sourcee- a conversion exception which can provide additional information- Returns:
- The value conversion error string with parameters replaced.
- Since:
- 7.1
-
getConvertedValue
Returns the current value (as returned bygetValue()) converted to the data source type.This returns the same as
AbstractField.getValue()if no converter has been set. The value is not necessarily the same as the data source value e.g. if the field is in buffered mode and has been modified.- Specified by:
getConvertedValuein interfaceField<T>- Returns:
- The converted value that is compatible with the data source type
-
setConvertedValue
Sets the value of the field using a value of the data source type. The value given is converted to the field type and then assigned to the field. This will update the property data source in the same way as whensetValue(Object)is called.- Parameters:
value- The value to set. Must be the same type as the data source.
-
addValidator
Adds a new validator for the field's value. All validators added to a field are checked each time the its value changes.- Specified by:
addValidatorin interfaceField<T>- Specified by:
addValidatorin interfaceValidatable- Parameters:
validator- the new validator to be added.
-
getValidators
Gets the validators of the field.- Specified by:
getValidatorsin interfaceField<T>- Specified by:
getValidatorsin interfaceValidatable- Returns:
- An unmodifiable collection that holds all validators for the field.
-
removeValidator
Removes the validator from the field.- Specified by:
removeValidatorin interfaceField<T>- Specified by:
removeValidatorin interfaceValidatable- Parameters:
validator- the validator to remove.
-
removeAllValidators
public void removeAllValidators()Removes all validators from the field.- Specified by:
removeAllValidatorsin interfaceField<T>- Specified by:
removeAllValidatorsin interfaceValidatable
-
isValid
public boolean isValid()Tests the current value against registered validators if the field is not empty. If the field is empty it is considered valid if it is not required and invalid otherwise. Validators are never checked for empty fields. In most cases,validate()should be used instead ofisValid()to also get the error message.- Specified by:
isValidin interfaceField<T>- Specified by:
isValidin interfaceValidatable- Returns:
trueif all registered validators claim that the current value is valid or if the field is empty and not required,falseotherwise.
-
validate
Checks the validity of the Field. A field is invalid if it is set as required (usingsetRequired(boolean)and is empty, if one or several of the validators added to the field indicate it is invalid or if the value cannot be converted provided a converter has been set. The "required" validation is a built-in validation feature. If the field is required and empty this method throws an EmptyValueException with the error message set usingsetRequiredError(String).- Specified by:
validatein interfaceValidatable- Throws:
Validator.InvalidValueException- if the value is not valid- See Also:
-
validate
Validates that the given value pass the validators for the field.This method does not check the requiredness of the field.
- Parameters:
fieldValue- The value to check- Throws:
Validator.InvalidValueException- if one or several validators fail
-
isInvalidAllowed
public boolean isInvalidAllowed()Fields allow invalid values by default. In most cases this is wanted, because the field otherwise visually forget the user input immediately.- Specified by:
isInvalidAllowedin interfaceField<T>- Specified by:
isInvalidAllowedin interfaceValidatable- Returns:
- true iff the invalid values are allowed.
- See Also:
-
setInvalidAllowed
Fields allow invalid values by default. In most cases this is wanted, because the field otherwise visually forget the user input immediately.In common setting where the user wants to assure the correctness of the datasource, but allow temporarily invalid contents in the field, the user should add the validators to datasource, that should not allow invalid values. The validators are automatically copied to the field when the datasource is set.
- Specified by:
setInvalidAllowedin interfaceField<T>- Specified by:
setInvalidAllowedin interfaceValidatable- Parameters:
invalidAllowed-- Throws:
UnsupportedOperationException- if the setInvalidAllowed is not supported.- See Also:
-
getErrorMessage
Error messages shown by the fields are composites of the error message thrown by the superclasses (that is the component error message), validation errors and buffered source errors.- See Also:
-
addValueChangeListener
Description copied from interface:Property.ValueChangeNotifierRegisters a new value change listener for this Property.- Specified by:
addValueChangeListenerin interfaceField<T>- Specified by:
addValueChangeListenerin interfaceProperty.ValueChangeNotifier- Parameters:
listener- the new Listener to be registered
-
removeValueChangeListener
Description copied from interface:Property.ValueChangeNotifierRemoves a previously registered value change listener.- Specified by:
removeValueChangeListenerin interfaceField<T>- Specified by:
removeValueChangeListenerin interfaceProperty.ValueChangeNotifier- Parameters:
listener- listener to be removed
-
fireValueChange
protected void fireValueChange(boolean repaintIsNotNeeded) Emits the value change event. The value contained in the field is validated before the event is created. -
readOnlyStatusChange
React to read only status changes of the property by requesting a repaint.- Specified by:
readOnlyStatusChangein interfaceField<T>- Specified by:
readOnlyStatusChangein interfaceProperty.ReadOnlyStatusChangeListener- Parameters:
event- Read-only status change event object- See Also:
-
valueChange
This method listens to data source value changes and passes the changes forwards. Changes are not forwarded to the listeners of the field during internal operations of the field to avoid duplicate notifications.- Specified by:
valueChangein interfaceField<T>- Specified by:
valueChangein interfaceProperty.ValueChangeListener- Parameters:
event- the value change event telling the data source contents have changed.
-
getInternalValue
Returns the internal field value, which might not match the data source value e.g. if the field has been modified and is not in write-through mode. This method can be overridden by subclasses together withsetInternalValue(Object)to compute internal field value at runtime. When doing so, typically alsoisModified()needs to be overridden and care should be taken in the management of the empty state and buffering support.- Returns:
- internal field value
-
getFInternalValue
Public version ofgetInternalValue()for subcomponents overriding the default functionality.- Returns:
- internal field value
-
setInternalValue
Sets the internal field value. This is purely used by AbstractField to change the internal Field value. It does not trigger valuechange events. It can be overridden by the inheriting classes to update all dependent variables. Subclasses can also overridegetInternalValue()if necessary.- Parameters:
newValue- the new value to be set.
-
setFInternalValue
Public version ofsetInternalValue(T)for subcomponents overriding the default functionality.- Parameters:
newValue- the new value to be set.
-
isRequired
public boolean isRequired()Is this field required. Required fields must filled by the user. If the field is required, it is visually indicated in the user interface. Furthermore, setting field to be required implicitly adds "non-empty" validator and thus isValid() == false or any isEmpty() fields. In those cases validation errors are not painted as it is obvious that the user must fill in the required fields. On the other hand, for the non-required fields isValid() == true if the field isEmpty() regardless of any attached validators.- Specified by:
isRequiredin interfaceField<T>- Returns:
trueif the field is required, otherwisefalse.
-
setRequired
public void setRequired(boolean required) Sets the field required. Required fields must filled by the user. If the field is required, it is visually indicated in the user interface. Furthermore, setting field to be required implicitly adds "non-empty" validator and thus isValid() == false or any isEmpty() fields. In those cases validation errors are not painted as it is obvious that the user must fill in the required fields. On the other hand, for the non-required fields isValid() == true if the field isEmpty() regardless of any attached validators.- Specified by:
setRequiredin interfaceField<T>- Parameters:
required- Is the field required.
-
setRequiredError
Set the error that is show if this field is required, but empty. When setting requiredMessage to be "" or null, no error pop-up or exclamation mark is shown for a empty required field. This faults to "". Even in those cases isValid() returns false for empty required fields.- Specified by:
setRequiredErrorin interfaceField<T>- Parameters:
requiredMessage- Message to be shown when this field is required, but empty.
-
getRequiredError
Description copied from interface:FieldGets the error message that is to be displayed if a required field is empty.- Specified by:
getRequiredErrorin interfaceField<T>- Returns:
- Error message.
-
getConversionError
Gets the error that is shown if the field value cannot be converted to the data source type.- Returns:
- The error that is shown if conversion of the field value fails
-
setConversionError
Sets the error that is shown if the field value cannot be converted to the data source type. If {0} is present in the message, it will be replaced by the simple name of the data source type. If {1} is present in the message, it will be replaced by the ConversionException message.- Parameters:
valueConversionError- Message to be shown when conversion of the value fails
-
isEmpty
public boolean isEmpty()Description copied from interface:FieldIs the field empty? In general, "empty" state is same as null. As an exception, TextField also treats empty string as "empty".- Specified by:
isEmptyin interfaceField<T>- Specified by:
isEmptyin interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<AbstractField<T>,T>, T> - Overrides:
isEmptyin classcom.vaadin.flow.component.AbstractField<AbstractField<T>,T> - Returns:
- true if the field is empty, false otherwise
-
isValidationVisible
public boolean isValidationVisible()Is automatic, visible validation enabled? If automatic validation is enabled, any validators connected to this component are evaluated while painting the component and potential error messages are sent to client. If the automatic validation is turned off, isValid() and validate() methods still work, but one must show the validation in their own code.- Returns:
- True, if automatic validation is enabled.
-
setValidationVisible
public void setValidationVisible(boolean validateAutomatically) Enable or disable automatic, visible validation. If automatic validation is enabled, any validators connected to this component are evaluated while painting the component and potential error messages are sent to client. If the automatic validation is turned off, isValid() and validate() methods still work, but one must show the validation in their own code.- Parameters:
validateAutomatically- True, if automatic validation is enabled.
-
setCurrentBufferedSourceException
public void setCurrentBufferedSourceException(Buffered.SourceException currentBufferedSourceException) Sets the current buffered source exception.- Parameters:
currentBufferedSourceException-
-
getCurrentBufferedSourceException
Gets the current buffered source exception.- Returns:
- The current source exception
-
getConverter
Gets the converter used to convert the property data source value to the field value.- Specified by:
getConverterin interfaceField<T>- Returns:
- The converter or null if none is set.
-
setConverter
Sets the converter used to convert the field value to property data source type. The converter must have a presentation type that matches the field type.- Specified by:
setConverterin interfaceField<T>- Parameters:
converter- The new converter to use.
-
addPropertyListeners
protected void addPropertyListeners()Registers this as an event listener for events sent by the data source (if any). Does nothing ifisListeningToPropertyEvents == true. -
removePropertyListeners
protected void removePropertyListeners()Stops listening to events sent by the data source (if any). Does nothing ifisListeningToPropertyEvents == false. -
isPropertyReadOnly
public boolean isPropertyReadOnly()The abstract field is read only also if the data source is in read only mode.- Specified by:
isPropertyReadOnlyin interfaceField<T>- Specified by:
isPropertyReadOnlyin interfaceProperty<T>- Returns:
trueif the Property is in read-only mode,falseif it's not
-
setPropertyReadOnly
public void setPropertyReadOnly(boolean newStatus) Description copied from interface:PropertySets the Property's read-only mode to the specified status. This functionality is optional, but all properties must implement theisReadOnlymode query correctly.- Specified by:
setPropertyReadOnlyin interfaceField<T>- Specified by:
setPropertyReadOnlyin interfaceProperty<T>- Parameters:
newStatus- new read-only status of the Property
-
getType
Description copied from interface:PropertyReturns the type of the Property. The methodsgetValueandsetValuemust be compatible with this type: one must be able to safely cast the value returned fromgetValueto the given type and pass any variable assignable to this type as an argument tosetValue. -
onComponentEvent
public void onComponentEvent(com.vaadin.flow.component.ComponentEvent event) - Specified by:
onComponentEventin interfacecom.vaadin.flow.component.ComponentEventListener<T>
-
setPresentationValue
- Specified by:
setPresentationValuein classcom.vaadin.flow.component.AbstractField<AbstractField<T>,T>
-