javax.media.jai
Class DeferredProperty
java.lang.Object
|
+--java.util.Observable
|
+--javax.media.jai.DeferredData
|
+--javax.media.jai.DeferredProperty
- All Implemented Interfaces:
- EventListener, PropertyChangeListener, Serializable
- public class DeferredProperty
- extends DeferredData
- implements PropertyChangeListener
A subclass of DeferredData
to be used to wrap JAI property
values which will be computed at a later time. For example, an instance
of this class could be used to wrap a property emitted by an operation
node so that the actual computation of the property value was deferred
until it was actually needed.
- Since:
- JAI 1.1
- See Also:
DeferredData
,
RenderedOp
, Serialized Form
propertySource
protected transient PropertySource propertySource
- The
PropertySource
from which the value of the named
property is to be drawn.
propertyName
protected String propertyName
- The name of the property the value of which is to be obtained.
DeferredProperty
public DeferredProperty(PropertySource propertySource,
String propertyName,
Class propertyClass)
- Creates a
DeferredProperty
. If the specified
PropertySource
is a PropertyChangeEmitter
,
then this DeferredProperty
object is registered as a
PropertyChangeListener
of the PropertySource
.
- Throws:
- IllegalArgumentException - if a parameter is
null
or if the propertyName
is not among those
emitted by the PropertySource
.
getPropertySource
public PropertySource getPropertySource()
- Returns the
PropertySource
of the property value.
getPropertyName
public String getPropertyName()
- Returns the name of the property the value of which is to be obtained.
computeData
protected Object computeData()
- Returns the value of the image property associated with the
image and property name specified at construction.
- Overrides:
- computeData in class DeferredData
equals
public boolean equals(Object obj)
- Tests whether the parameter equals this object. Equality obtains
if the parameter object is a
DeferredProperty
and
the respective propertySource
and
dataClass
variables are equal according to their
respective equals()
methods and the
propertyName
s are equal ignoring case. The wrapped
data object is not tested unless the isValid()
of
both objects returns true
because requesting it via
getData()
may provoke computation of a deferred quantity.
- Overrides:
- equals in class Object
hashCode
public int hashCode()
- Returns a hash code value for the object.
- Overrides:
- hashCode in class Object
propertyChange
public void propertyChange(PropertyChangeEvent evt)
- The implementation of
PropertyChangeListener
. This
method responds to certain PropertyChangeEvent
s generated
by the PropertySource
used to construct this object.
If the PropertyChangeEvent
is named "Rendering" and is
an instance of javax.media.jai.RenderingChangeEvent
, then
the source of the event is checked to determine whether it equals the
PropertySource
used to construct this object. If this test
is passed then the PropertySource
is a
RenderedOp
the rendering of which has changed. Therefore
setData() will be invoked with a null argument. This will indicate to
any registered observers that the property data should be re-requested
by invoking getData() on this object.
If the PropertyChangeEvent
was generated by the
PropertySource
used to construct this object, has name
equal to the name of the deferred property, and is an instance of
PropertySourceChangeEvent
, then the value returned by
the getNewValue()
method of the event object will be
passed to setData()
. Registered observers will be
notified according to the specification of setData()
.
- Specified by:
- propertyChange in interface PropertyChangeListener