Interface Property<T>
- Record Components:
T- type of values of the property
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
EntityItemProperty,FAbstractTextField,Field<T>,HasFInternalValue<T>,Property.Transactional<T>,Select
- All Known Implementing Classes:
AbstractField,AbstractProperty,CustomField,FAbstractField,FAbstractSelect,FCheckBox,FComboBox,FDateField,FListSelect,FPasswordField,FTextArea,FTextField,FTokenField,FTwinColSelect,Label,MethodProperty,NestedMethodProperty,ObjectProperty,Table,TransactionalPropertyWrapper
The Property is a simple data object that contains one typed
value. This interface contains methods to inspect and modify the stored value
and its type, and the object's read-only state.
The Property also defines the events
ReadOnlyStatusChangeEvent and ValueChangeEvent, and
the associated listener and notifier interfaces.
The Property.Viewer interface should be used to attach the
Property to an external data source. This way the value in the data source
can be inspected using the Property interface.
The Property.editor interface should be implemented if the value
needs to be changed through the implementing class.
- Since:
- 3.0
- Author:
- Vaadin Ltd
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceInterface implemented by the editor classes capable of editing the Property.static classExceptionobject that signals that a requested Property modification failed because it's in read-only mode.static interfaceAnEventobject specifying the Property whose read-only status has been changed.static interfaceThe listener interface for receivingReadOnlyStatusChangeEventobjects.static interfaceThe interface for adding and removingReadOnlyStatusChangeEventlisteners.static interfaceA Property that is capable of handle a transaction that can end in commit or rollback.static interfaceAnEventobject specifying the Property whose value has been changed.static interfaceThelistenerinterface for receivingValueChangeEventobjects.static interfaceThe interface for adding and removingValueChangeEventlisteners.static interfaceInterface implemented by the viewer classes capable of using a Property as a data source. -
Method Summary
Modifier and TypeMethodDescriptiongetType()Returns the type of the Property.getValue()Gets the value stored in the Property.booleanTests if the Property is in read-only mode.voidsetPropertyReadOnly(boolean newStatus) Sets the Property's read-only mode to the specified status.voidSets the value of the Property.
-
Method Details
-
getValue
T getValue()Gets the value stored in the Property. The returned object is compatible with the class returned by getType().- Returns:
- the value stored in the Property
-
setValue
Sets the value of the Property.Implementing this functionality is optional. If the functionality is missing, one should declare the Property to be in read-only mode and throw
Note : Since Vaadin 7.0, setting the value of a non-String property as a String is no longer supported.Property.ReadOnlyExceptionin this function.- Parameters:
newValue- New value of the Property. This should be assignable to the type returned by getType- Throws:
Property.ReadOnlyException- if the object is in read-only mode
-
isPropertyReadOnly
boolean isPropertyReadOnly()Tests if the Property is in read-only mode. In read-only mode calls to the methodsetValuewill throwReadOnlyExceptionand will not modify the value of the Property.- Returns:
trueif the Property is in read-only mode,falseif it's not
-
setPropertyReadOnly
void setPropertyReadOnly(boolean newStatus) Sets the Property's read-only mode to the specified status. This functionality is optional, but all properties must implement theisReadOnlymode query correctly.- Parameters:
newStatus- new read-only status of the Property
-
getType
Returns 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.- Returns:
- type of the Property
-