|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.jai.PropertySourceImpl | +--javax.media.jai.WritablePropertySourceImpl
A utility implementation of the WritablePropertySource
interface. The same internal superclass data structures are used and
are supplemented by a PropertyChangeSupportJAI
to handle
property event firing. All events fired by an instance of this class
will be PropertySourceChangeEvent
s with an event source
equal to the object used to create the PropertyChangeSupportJAI
helper object. This object is user-specifiable at construction time or
automatically created when a PropertyChangeListener
is
added or removed and the PropertyChangeSupportJAI
specified
at construction was null
.
CaselessStringKey
,
PropertySource
,
PropertySourceChangeEvent
,
PropertySourceImpl
,
WritablePropertySource
,
PropertyChangeEmitter
,
PropertyChangeSupportJAI
, Serialized FormField Summary | |
protected PropertyChangeSupportJAI |
manager
Helper object for bean-style property events. |
Fields inherited from class javax.media.jai.PropertySourceImpl |
cachedPropertyNames,
properties,
propertySources |
Constructor Summary | |
WritablePropertySourceImpl()
Constructs a WritablePropertySourceImpl instance with
no properties set. |
|
WritablePropertySourceImpl(Map propertyMap,
PropertySource source,
PropertyChangeSupportJAI manager)
Constructs a WritablePropertySourceImpl instance which
will derive properties from one or both of the supplied parameters. |
Method Summary | |
void |
addProperties(Map propertyMap)
Copies from the supplied Map to the property set all
entries wherein the key is an instance of String
or CaselessStringKey . |
void |
addProperties(PropertySource propertySource)
Adds a PropertySource to the
name-PropertySource mapping. |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Add a PropertyChangeListener for a specific property. |
void |
clearCachedProperties()
Clears from the name-value mapping all properties which were derived from a source in the name- PropertySource mapping. |
void |
clearProperties()
Clears all properties from the PropertySource by
invoking removeProperty() with all known names. |
void |
clearPropertyMap()
Clears the name-value mapping of all properties. |
void |
clearPropertySourceMap()
Clears the name- PropertySource mapping. |
Object |
getProperty(String propertyName)
Returns the value of a property. |
void |
removeProperty(String propertyName)
Removes the named property from the PropertySource . |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Remove a PropertyChangeListener for a specific property. |
void |
removePropertySource(PropertySource propertySource)
Removes from the name- PropertySource mapping all entries
which refer to the supplied PropertySource . |
void |
setProperty(String propertyName,
Object propertyValue)
Adds the property value associated with the supplied name to the PropertySource . |
Methods inherited from class javax.media.jai.PropertySourceImpl |
getProperties,
getPropertyClass,
getPropertyNames,
getPropertyNames |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected PropertyChangeSupportJAI manager
null
which indicates that no events
are to be fired.Constructor Detail |
public WritablePropertySourceImpl()
WritablePropertySourceImpl
instance with
no properties set.public WritablePropertySourceImpl(Map propertyMap, PropertySource source, PropertyChangeSupportJAI manager)
WritablePropertySourceImpl
instance which
will derive properties from one or both of the supplied parameters.
The propertyMap
and propertySource
parameters
will be used to initialize the name-value and
name-PropertySource
mappings, respectively.
Entries in the propertyMap
object will be assumed
to be properties if the key is a String
or a
CaselessStringKey
. The propertySource
object will be queried for the names of properties that it emits
but requests for associated values will not be made at this time
so as to to defer any calculation that such requests might provoke.
The case of property names will be retained but will be ignored
insofar as the name is used as a key to the property value.propertyMap
- A Map
from which to copy properties
which have keys which are either String
s or
CaselessStringKey
s.propertySource
- A PropertySource
from which to
derive properties.manager
- The object which will actually fire the events.
May be null
in which case a default
event manager will be created as needed with this
object as its event source.Method Detail |
public Object getProperty(String propertyName)
java.awt.Image.UndefinedProperty
will
be returned.
If the requested name is found in the name-value mapping,
the corresponding value will be returned. Otherwise the
name-PropertySource
mapping will be queried and the
value will be derived from the found PropertySource
,
if any. If the value is derived from a PropertySource
,
a record will be kept of this and this property will be referred to
as a "cached property". Derivation of the value from a
PropertySource
rather than from the name-value
mapping may cause a PropertySourceChangeEvent
to be fired.
propertyName
- the name of the property, as a String
.Object
, or the value
java.awt.Image.UndefinedProperty
.propertyName
is null
.
public void setProperty(String propertyName, Object propertyValue)
PropertySource
. Values set by this means will
supersede any previously defined value of the property.
PropertySourceChangeEvent
s may be fired
with a name set to that of the property (retaining case) and old and
new values set to the previous and current values of the property,
respectively. The value returned by the
getSource()
method of the event is determined by the value passed to the
constructor of the PropertyChangeSupportJAI
parameter.
Neither the old nor the new value may be null
: undefined
properties must as usual be indicated by the constant value
java.awt.Image.UndefinedProperty
. It is however
legal for either but not both of the old and new property values
to equal java.awt.Image.UndefinedProperty
.
propertyName
- the name of the property, as a String
.propertyValue
- the property, as a general Object
.propertyName
or propertyValue
is null
.
public void removeProperty(String propertyName)
PropertySource
.
PropertySourceChangeEvents may be fired if the property
values is actually removed from the name-value mapping. In this case
the new value of the property event will be
java.awt.Image.UndefinedProperty
.
- Specified by:
- removeProperty in interface WritablePropertySource
- Parameters:
propertyName
- the name of the property, as a String
.propertyValue
- the property, as a general Object
.- Throws:
- IllegalArgumentException - if
propertyName
is null
.
public void addProperties(Map propertyMap)
Map
to the property set all
entries wherein the key is an instance of String
or CaselessStringKey
. Values set by this means will
supersede any previously defined values of the respective properties.
All property values are copied by reference.
PropertySourceChangeEvents may be fired for each
property added. If the property was not previously defined the
old value of the property event will be
java.awt.Image.UndefinedProperty
.
- Parameters:
propertyMap
- A Map
from which to copy properties
which have keys which are either String
s or
CaselessStringKey
s. If null
no
properties will be added.
public void addProperties(PropertySource propertySource)
PropertySource
to the
name-PropertySource
mapping. The
actual property values are not requested at this time but instead
an entry for the name of each property emitted by the
PropertySource
is added to the
name-PropertySource
mapping. Properties defined by
this PropertySource
supersede those of all other
previously added PropertySource
s including that
specified at construction, if any. Note that this method will not
provoke any events as no properties will actually have changed.propertySource
- A PropertySource
from which to
derive properties. If null
nothing is done.public void clearProperties()
PropertySource
by
invoking removeProperty()
with all known names.
PropertySourceChangeEvents may be fired
for each stored property removed. In this case the new value
of the property event will be
java.awt.Image.UndefinedProperty
.
public void clearPropertyMap()
PropertySourceChangeEvents may be fired
for each stored property removed. In this case the new value
of the property event will be
java.awt.Image.UndefinedProperty
.
public void clearPropertySourceMap()
PropertySource
mapping.
No events will be fired.public void clearCachedProperties()
PropertySource
mapping.
PropertySourceChangeEvents may be fired
for each stored property removed. In this case the new value
of the property event will be
java.awt.Image.UndefinedProperty
.
public void removePropertySource(PropertySource propertySource)
PropertySource
mapping all entries
which refer to the supplied PropertySource
.public void addPropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
to the listener list. The
listener is registered for all properties.
If the property event utility object was not set at construction,
then it will be initialized to a PropertyChangeSupportJAI
whose property event source is this object.
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
PropertyChangeListener
for a specific property. The
listener will be invoked only when a call on
firePropertyChange names that specific property.
If the property event utility object was not set at construction,
then it will be initialized to a PropertyChangeSupportJAI
whose property event source is this object.
propertyName
.public void removePropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
from the listener list.
This removes a PropertyChangeListener
that was registered
for all properties.
If the property event utility object was not set at construction,
then it will be initialized to a PropertyChangeSupportJAI
whose property event source is this object.
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
PropertyChangeListener
for a specific property.
If the property event utility object was not set at construction,
then it will be initialized to a PropertyChangeSupportJAI
whose property event source is this object.
propertyName
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |