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 TypeMethodDescriptionvoidAdds a VetoableChangeListener.booleanIndicates if changes to this property can be vetoed.voidRemoves a VetoableChangeListener.voidSets the property value.voidsetValueAndNotifyListeners(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:
isVetoablein interfaceProperty- Specified by:
isVetoablein classAbstractProperty- Returns:
- True; always.
-
addVetoableChangeListener
Adds a VetoableChangeListener.- Specified by:
addVetoableChangeListenerin interfaceProperty- Specified by:
addVetoableChangeListenerin classAbstractProperty- Parameters:
listener- The VetoableChangeListener to add.
-
removeVetoableChangeListener
Removes a VetoableChangeListener.- Specified by:
removeVetoableChangeListenerin interfaceProperty- Specified by:
removeVetoableChangeListenerin 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:
setValueAndNotifyListenersin interfaceProperty- Specified by:
setValueAndNotifyListenersin 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:
setValuein interfaceProperty- Specified by:
setValuein classAbstractProperty- Parameters:
newValue- The new property value.- Throws:
PropertyVetoException- A registered VetoableChangeListener objected to the change. The change was not committed.
-