Package 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
Modifier and TypeMethodDescriptionvoid
Adds a PropertyChangeListener.void
Adds a VetoableChangeListener.void
This clears the current and previous value without notifying listenersgetName()
Gets the name of the property.Gets the source bean of the property.getValue()
Gets the property value.boolean
Indicates if the property is reporting changes.boolean
Indicates if changes to this property can be vetoed.void
Reports changes to the Property.void
Removes a PropertyChangeListener.void
Removes a VetoableChangeListener.void
setReporting
(boolean reportChanges) Enables or disables the reporting of property changes.void
Sets the property value.void
setValueAndNotifyListeners
(Object newValue) Sets the property value.
-
Method Details
-
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
Adds a PropertyChangeListener.- Parameters:
listener
- The PropertyChangeListener to add.
-
removePropertyChangeListener
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
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
Sets the property value. Will notify any listeners if and only ifisReporting()
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
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 ifisReporting()
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
-