ucar.unidata.beans
Interface Property

All Known Implementing Classes:
AbstractProperty, NonVetoableProperty, RealReadout.FormatProperty, RealReadout.NameProperty, RealReadout.NumericValueProperty, RealReadout.UnitProperty, VetoableProperty

public interface Property

Provides support for JavaBean properties -- both vetoable and non-vetoable.

Version:
$Id: Property.java,v 1.13 2005/05/13 18:28:22 jeffmc Exp $
Author:
Steven R. Emmerson

Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener.
 void addVetoableChangeListener(VetoableChangeListener listener)
          Adds a VetoableChangeListener.
 void clearValue()
          This clears the current and previous value without notifying listeners
 String getName()
          Gets the name of the property.
 Object getSourceBean()
          Gets the source bean of the property.
 Object getValue()
          Gets the property value.
 boolean isReporting()
          Indicates if the property is reporting changes.
 boolean isVetoable()
          Indicates if changes to this property can be vetoed.
 void notifyListeners()
          Reports changes to the Property.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a PropertyChangeListener.
 void removeVetoableChangeListener(VetoableChangeListener listener)
          Removes a VetoableChangeListener.
 void setReporting(boolean reportChanges)
          Enables or disables the reporting of property changes.
 void setValue(Object newValue)
          Sets the property value.
 void setValueAndNotifyListeners(Object newValue)
          Sets the property value.
 

Method Detail

getSourceBean

Object getSourceBean()
Gets the source bean of the property.

Returns:
The source bean of the property.

getName

String getName()
Gets the name of the property.

Returns:
The name of the property.

getValue

Object getValue()
Gets the property value.

Returns:
The property value, which is not a copy.

addPropertyChangeListener

void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener.

Parameters:
listener - The PropertyChangeListener to add.

removePropertyChangeListener

void removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener.

Parameters:
listener - The PropertyChangeListener to remove.

addVetoableChangeListener

void addVetoableChangeListener(VetoableChangeListener listener)
                               throws UnsupportedOperationException
Adds a VetoableChangeListener.

Parameters:
listener - The VetoableChangeListener to add.
Throws:
UnsupportedOperationException - This operation is unsupported for this type of Property.

removeVetoableChangeListener

void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a VetoableChangeListener.

Parameters:
listener - The VetoableChangeListener to remove.

isVetoable

boolean isVetoable()
Indicates if changes to this property can be vetoed.

Returns:
True if and only if changes to this property can be vetoed. NB: a VetoableProperty with no registered VetoableChangeListener-s will still return true.

setValueAndNotifyListeners

void setValueAndNotifyListeners(Object newValue)
                                throws PropertyVetoException
Sets the property value. Will notify any listeners if and only if isReporting() is true. Will always notify any, registered, VetoableChangeListener-s.

Parameters:
newValue - The new property value.
Throws:
PropertyVetoException - A registered VetoableChangeListener objected to the change. The change was not committed.

setValue

void setValue(Object newValue)
              throws PropertyVetoException
Sets the property value. Will not notify any PropertyChangeListener-s but will notify all VetoableChangeListener-s.

Parameters:
newValue - The new property value.
Throws:
PropertyVetoException - A registered VetoableChangeListener objected to the change. The change was not committed.

setReporting

void setReporting(boolean reportChanges)
Enables or disables the reporting of property changes.

Parameters:
reportChanges - Whether to enable or disable property change reporting.

isReporting

boolean isReporting()
Indicates if the property is reporting changes.

Returns:
_more_

notifyListeners

void notifyListeners()
Reports changes to the Property. Changes are only actually reported if isReporting() is true and the current value of the property is not equal to the previously-reported value.


clearValue

void clearValue()
This clears the current and previous value without notifying listeners