public class IlvDefaultPropertyManager extends Object implements IlvPropertyManager
IlvPropertyManager
interface.Modifier and Type | Field and Description |
---|---|
protected Map |
properties
The map that stores the object properties.
|
Constructor and Description |
---|
IlvDefaultPropertyManager(Object sourceBean)
Constructs an
IlvDefaultPropertyManager that manages the
properties of the specified sourceBean . |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a
PropertyChangeListener to listen to the
PropertyChangeEvent originated by this object. |
void |
firePropertyChange(String key,
Object oldValue,
Object newValue)
Support method for notifying bound property changes.
|
Object |
getProperty(String key)
Returns the value of the property with the specified key.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes the specified
PropertyChangeListener from the listener
list, so that it no longer receives PropertyChangeEvent . |
Object |
setProperty(String key,
Object value)
Changes one of the properties of this object.
|
protected Map properties
public IlvDefaultPropertyManager(Object sourceBean)
IlvDefaultPropertyManager
that manages the
properties of the specified sourceBean
.sourceBean
- The source object that this instance manages
properties for.public Object setProperty(String key, Object value)
PropertyChangeEvent
is sent to
property change listeners.setProperty
in interface IlvPropertyManager
key
- The non-null
property key.value
- An Object
value. If it is equal to
null
, the property with the specified key will be removed.getProperty(java.lang.String)
public Object getProperty(String key)
getProperty
in interface IlvPropertyManager
key
- The non-null
property key to return the property of.IlvPropertyManager.setProperty(java.lang.String, java.lang.Object)
public void addPropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
to listen to the
PropertyChangeEvent
originated by this object.addPropertyChangeListener
in interface IlvPropertyManager
listener
- The new listener.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
from the listener
list, so that it no longer receives PropertyChangeEvent
.removePropertyChangeListener
in interface IlvPropertyManager
listener
- The listener to remove.addPropertyChangeListener(java.beans.PropertyChangeListener)
public void firePropertyChange(String key, Object oldValue, Object newValue)
oldValue
and newValue
are equal, this method
does nothing. Otherwise, a PropertyChange
event is fired
to each listener.
In an implementing class, it is recommended to provide methods for
accessing main properties, taking care to trigger the corresponding
PropertyChange
event. For example, here's how to write a
bound property method changing the value of a Name
string property.
public void setName(String newName) { Stirng oldName = name; name = newName; firePropertyChange(NAME_PROPERTY, oldName, newName); } static final String NAME_PROPERTY = "Name"; private string name;
key
- The key of the property that was changed.oldValue
- The old value of the property.newValue
- The new value of the property.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.