com.vaadin.data.util
Class AbstractProperty

java.lang.Object
  extended by com.vaadin.data.util.AbstractProperty
All Implemented Interfaces:
Property, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeNotifier, Serializable
Direct Known Subclasses:
MethodProperty, NestedMethodProperty, ObjectProperty, PropertyFormatter, TextFileProperty

public abstract class AbstractProperty
extends Object
implements Property, Property.ValueChangeNotifier, Property.ReadOnlyStatusChangeNotifier

Abstract base class for Property implementations. Handles listener management for ValueChangeListeners and ReadOnlyStatusChangeListeners.

Since:
6.6
See Also:
Serialized Form

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()
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.

Specified by:
isReadOnly in interface Property
Returns:
true if the Property is in read-only mode, false if it's not

setReadOnly

public void setReadOnly(boolean newStatus)
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.

Specified by:
setReadOnly in interface Property
Parameters:
newStatus - new read-only status of the Property

toString

public String toString()
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.

Specified by:
toString in interface Property
Overrides:
toString in class Object
Returns:
String representation of the value stored in the Property

addListener

public void addListener(Property.ReadOnlyStatusChangeListener listener)
Registers a new read-only status change listener for this Property.

Specified by:
addListener in interface Property.ReadOnlyStatusChangeNotifier
Parameters:
listener - the new Listener to be registered.

removeListener

public void removeListener(Property.ReadOnlyStatusChangeListener listener)
Removes a previously registered read-only status change listener.

Specified by:
removeListener in interface Property.ReadOnlyStatusChangeNotifier
Parameters:
listener - the listener to be removed.

fireReadOnlyStatusChange

protected void fireReadOnlyStatusChange()
Sends a read only status change event to all registered listeners.


addListener

public void addListener(Property.ValueChangeListener listener)
Description copied from interface: Property.ValueChangeNotifier
Registers a new value change listener for this Property.

Specified by:
addListener in interface Property.ValueChangeNotifier
Parameters:
listener - the new Listener to be registered

removeListener

public void removeListener(Property.ValueChangeListener listener)
Description copied from interface: Property.ValueChangeNotifier
Removes a previously registered value change listener.

Specified by:
removeListener in interface Property.ValueChangeNotifier
Parameters:
listener - listener to be removed

fireValueChange

protected void fireValueChange()
Sends a value change event to all registered listeners.


getListeners

public Collection<?> getListeners(Class<?> eventType)


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.