com.vaadin.data.util
Class AbstractProperty<T>

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

public abstract class AbstractProperty<T>
extends Object
implements Property<T>, 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 static 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.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, 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.
 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()
          Deprecated. use Property.getValue() instead and possibly toString on that
 
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<T>
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<T>
Parameters:
newStatus - new read-only status of the Property

toString

@Deprecated
public String toString()
Deprecated. use Property.getValue() instead and possibly toString on that

Returns the value of the Property in human readable textual format.

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.