com.vaadin.data.util.
Class AbstractProperty
java.lang.Object
com.vaadin.data.util.AbstractProperty
All Implemented Interfaces:
Property, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeNotifier, Serializable
Direct Known Subclasses:
MethodProperty, NestedMethodProperty, ObjectProperty, PropertyFormatter, TextFileProperty
- extends Object
- implements Property, Property.ValueChangeNotifier, Property.ReadOnlyStatusChangeNotifier
public abstract class AbstractProperty
Abstract base class for Property
implementations.
Handles listener management for ValueChangeListener
s and
ReadOnlyStatusChangeListener
s.
Since:
6.6
See Also:
Nested Class Summary | |
---|---|
protected class |
AbstractProperty.ReadOnlyStatusChangeEvent
An Event object specifying the Property whose read-only
status has been changed. |
Nested classes/interfaces inherited from interface com.vaadin.data.Property |
---|
Property.ConversionException, Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer |
Constructor Summary | |
---|---|
AbstractProperty()
|
Method Summary | |
---|---|
void |
addListener(Property.ReadOnlyStatusChangeListener listener)
Registers a new read-only status change listener for this Property. |
void |
addListener(Property.ValueChangeListener listener)
Registers a new value change listener for this Property. |
protected void |
fireReadOnlyStatusChange()
Sends a read only status change event to all registered listeners. |
protected void |
fireValueChange()
Sends a value change event to all registered listeners. |
Collection<?> |
getListeners(Class<?> eventType)
|
boolean |
isReadOnly()
Tests if the Property is in read-only mode. Override for additional restrictions on what is considered a read-only property. |
void |
removeListener(Property.ReadOnlyStatusChangeListener listener)
Removes a previously registered read-only status change listener. |
void |
removeListener(Property.ValueChangeListener listener)
Removes a previously registered value change listener. |
void |
setReadOnly(boolean newStatus)
Sets the Property's read-only mode to the specified status. |
String |
toString()
Returns the value of the Property in human readable textual
format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.vaadin.data.Property |
---|
getType, getValue, setValue |
Constructor Detail |
---|
AbstractProperty
public AbstractProperty()
Method Detail |
---|
isReadOnly
public boolean isReadOnly()
- Specified by:
isReadOnly
in interfaceProperty
- Returns:
true
if the Property is in read-only mode,false
if it's not
Tests if the Property is in read-only mode. In read-only mode calls to
the method setValue
will throw
ReadOnlyException
and will not modify the value of the
Property.
Override for additional restrictions on what is considered a read-only
property.
setReadOnly
public void setReadOnly(boolean newStatus)
- Specified by:
setReadOnly
in interfaceProperty
- Parameters:
newStatus
- new read-only status of the Property
Description copied from interface: Property
Sets the Property's read-only mode to the specified status.
This functionality is optional, but all properties must implement the
isReadOnly
mode query correctly.
toString
public String toString()
- Returns:
- String representation of the value stored in the Property
Returns the value of the Property
in human readable textual
format. The return value should be assignable to the
setValue
method if the Property is not in read-only mode.
addListener
public void addListener(Property.ReadOnlyStatusChangeListener listener)
- Specified by:
addListener
in interfaceProperty.ReadOnlyStatusChangeNotifier
- Parameters:
listener
- the new Listener to be registered.
Registers a new read-only status change listener for this Property.
removeListener
public void removeListener(Property.ReadOnlyStatusChangeListener listener)
- Specified by:
removeListener
in interfaceProperty.ReadOnlyStatusChangeNotifier
- Parameters:
listener
- the listener to be removed.
Removes a previously registered read-only status change listener.
fireReadOnlyStatusChange
protected void fireReadOnlyStatusChange()
Sends a read only status change event to all registered listeners.
addListener
public void addListener(Property.ValueChangeListener listener)
- Specified by:
addListener
in interfaceProperty.ValueChangeNotifier
- Parameters:
listener
- the new Listener to be registered
Description copied from interface: Property.ValueChangeNotifier
Registers a new value change listener for this Property.
removeListener
public void removeListener(Property.ValueChangeListener listener)
- Specified by:
removeListener
in interfaceProperty.ValueChangeNotifier
- Parameters:
listener
- listener to be removed
Description copied from interface: Property.ValueChangeNotifier
Removes a previously registered value change listener.
fireValueChange
protected void fireValueChange()
Sends a value change event to all registered listeners.
getListeners
public Collection<?> getListeners(Class<?> eventType)