Package ucar.unidata.beans
Class VetoableProperty
java.lang.Object
ucar.unidata.beans.AbstractProperty
ucar.unidata.beans.VetoableProperty
- All Implemented Interfaces:
Property
Provides support for vetoable JavaBean properties. A VetoableProperty is
a Property that has the capablity of having changes to its value vetoed by
registered VetoableChangeListener-s. This implementation conserves memory
by allocating storage for VetoableChangeListeners only when the first one
is added to this property.
- Version:
- $Id: VetoableProperty.java,v 1.7 2005/05/13 18:28:22 jeffmc Exp $
- Author:
- Steven R. Emmerson
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a VetoableChangeListener.boolean
Indicates if changes to this property can be vetoed.void
Removes a VetoableChangeListener.void
Sets the property value.void
setValueAndNotifyListeners
(Object newValue) Sets the property value.Methods inherited from class ucar.unidata.beans.AbstractProperty
addPropertyChangeListener, clearValue, getName, getSourceBean, getValue, isReporting, notifyListeners, removePropertyChangeListener, setCurrentValue, setReporting
-
Constructor Details
-
VetoableProperty
Constructs an instance.- Parameters:
sourceBean
- The source Bean of the property.name
- The name of the property.
-
-
Method Details
-
isVetoable
public boolean isVetoable()Indicates if changes to this property can be vetoed.- Specified by:
isVetoable
in interfaceProperty
- Specified by:
isVetoable
in classAbstractProperty
- Returns:
- True; always.
-
addVetoableChangeListener
Adds a VetoableChangeListener.- Specified by:
addVetoableChangeListener
in interfaceProperty
- Specified by:
addVetoableChangeListener
in classAbstractProperty
- Parameters:
listener
- The VetoableChangeListener to add.
-
removeVetoableChangeListener
Removes a VetoableChangeListener.- Specified by:
removeVetoableChangeListener
in interfaceProperty
- Specified by:
removeVetoableChangeListener
in classAbstractProperty
- Parameters:
listener
- The VetoableChangeListener to remove.
-
setValueAndNotifyListeners
Sets the property value. Will notify any listeners if and only ifisReporting()
is true. Will always notify all VetoableChangeListener-s.- Specified by:
setValueAndNotifyListeners
in interfaceProperty
- Specified by:
setValueAndNotifyListeners
in classAbstractProperty
- Parameters:
newValue
- The new property value.- Throws:
PropertyVetoException
- A registered VetoableChangeListener objected to the change. The change was not committed.
-
setValue
Sets the property value. Will not notify any PropertyChangeListener-s but will notify all VetoableChangeListener-s.- Specified by:
setValue
in interfaceProperty
- Specified by:
setValue
in classAbstractProperty
- Parameters:
newValue
- The new property value.- Throws:
PropertyVetoException
- A registered VetoableChangeListener objected to the change. The change was not committed.
-