|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.jai.CollectionImage | +--javax.media.jai.CollectionOp
A node in a CollectionImage
chain. A CollectionOp
stores an operation name, a ParameterBlock
containing sources
and parameters, and a RenderingHints
containing hints which
may be used in rendering the node. A set of nodes may be joined together
via the source Vector
s within their respective
ParameterBlock
s to form a directed acyclic
graph (DAG). The topology, i.e., connectivity, of the graph may be
altered by changing the node's sources. The operation name, parameters,
and rendering hints may also be changed. A CollectionOp
may
be used in either the rendered or the renderable mode for
Collection
s, i.e., "collection" or "renderableCollection"
mode, respectively.
A CollectionOp
may be constructed directly as, for example,
Collection srcCol;
double[] constants;
ParameterBlock pb =
(new ParameterBlock()).addSource(srcCol).add(constants);
CollectionOp node =
new CollectionOp("addConstToCollection", pb, null);
or by the createCollection
or createCollectionNS()
"collection" mode methods or the createRenderableCollection()
or createRenderableCollectionNS()
"renderableCollection" mode
methods defined in the JAI
class. The difference between
direct construction of a node and creation via a convenience method is that
in the latter case:
CollectionImage
, a RenderedImage
("collection" mode only), or a RenderableImage
("renderableCollection" mode only).RenderingHints
maintained by the JAI
instance are merged with the local RenderingHints
with the
local hints taking precedence.validateArguments()
method of the associated
OperationDescriptor
, the arguments (sources and parameters)
are validated as being compatible with the specified operation in
the appropriate mode.CollectionOp
is
created; otherwise any source Collection
s are
"unwrapped" until a valid argument list is obtained or it is
determined that such is impossible.
isImmediate()
method of the corresponding
OperationDescriptor
returns true
)
then the node is rendered. When a chain of nodes is rendered by any means a "parallel" chain of
CollectionImage
s is created. Each node in the chain of
CollectionOp
s corresponds to a node in the chain of
CollectionImage
s. Collection
methods invoked
on the CollectionOp
are in general forwarded to the associated
CollectionImage
which is referred to as the rendering
of the node. The rendering of the node may be a rendered or renderable
CollectionImage
, i.e., eventually contain
RenderedImage
s or RenderableImage
s, respectively,
depending on the mode in which the node is used.
The translation between CollectionOp
chains and
CollectionImage
chains makes use of two levels of
indirection provided by the OperationRegistry
and either the
CollectionImageFactory
(CIF) or the
RenderableCollectionImageFactory
(RCIF) facilities.
First, the local OperationRegistry
is used to map the
operation name into a CIF or RCIF. This factory then constructs
a CollectionImage
. The local
OperationRegistry
is used in order to take advantage
of the best possible implementation of the operation.
A node may be rendered explicitly by invoking the method
getCollection()
which also returns the rendering of the
node. A node may be rendered implicitly by invoking any method
defined in the Collection
interface. A rendering of a
node may also be obtained by means of the createInstance()
method. This method returns a Collection
rendering without
marking the node as having been rendered. If the node is not
marked as rendered then it will not fire
CollectionChangeEvent
s as described below.
CollectionOp
nodes may participate in Java Bean-style
events. The PropertyChangeEmitter
methods may be used
to register and unregister PropertyChangeListener
s.
CollectionOp
s are also PropertyChangeListener
s
so that they may be registered as listeners of other
PropertyChangeEmitter
s or the equivalent. Each
CollectionOp
also automatically receives any
CollectionChangeEvent
s emitted by any of its sources which
are also CollectionOp
s and RenderingChangeEvent
s
from any RenderedOp
sources.
Certain PropertyChangeEvent
s may be emitted by the
CollectionOp
. These include the
PropertyChangeEventJAI
s and
PropertySourceChangeEvent
s required by virtue of implementing
the OperationNode
interface. Additionally a
CollectionChangeEvent
may be emitted if the node is
operating in the "collection" mode, has already been rendered, and one of
the following conditions is satisfied:
CollectionChangeEvent
from one of
its CollectionOp
sources or a RenderingChangeEvent
from one if its RenderedOp
.CollectionImage
will be generated by the
OperationRegistry
for the new operation.
CollectionImage
by invoking update()
on the
CollectionImageFactory
which generated it. If this attempt
fails, a new CollectionImage
for this operation will be
requested from the OperationRegistry
.CollectionChangeEvent
will be fired to all registered
listeners of the "Collection" PropertyChangeEvent
and to all
sinks which are PropertyChangeListener
s. The new and old
values set on the event object correspond to the previous and current
CollectionImage
s, respectively, associated with this node. CollectionOp
nodes are WritablePropertySource
s
and so manage a name-value database of image meta-data also known as image
properties. Properties may be set on and requested from a node. The
value of a property not explicitly set on the node (via
setProperty()
) is obtained from the property environment of
the node. When a property is derived from the property environment it is
cached locally to ensure synchronization, i.e., that properties do not
change spontaneously if for example the same property is modified upstream.
The property environment of a CollectionOp
is initially
derived from that of the corresponding OperationDescriptor
as maintained by the OperationRegistry
. It may be modified
locally by adding PropertyGenerator
s, directives to copy
certain properties from specific sources, or requests to suppress certain
properties. These modifications per se cannot be undone directly but
may be eliminated as a side effect of other changes to the node as
described below.
When a property value is requested an attempt will be made to derive it from the several entities in the following order of precedence:
PropertyGenerator
s, or
setProperty()
or due to caching of a
property derived from the property environment.
All dynamically computed properties of a CollectionOp
which
have been cached locally, i.e., those cached properties which were not set
by an explicit call to setProperty()
, will be cleared when any
of the critical attributes of the node is edited. By implication these
properties will also be cleared when a CollectionChangeEvent
is received from any node source. The property environment or the cached
properties may also be cleared by invoking resetProperties()
.
CollectionImage
,
OperationRegistry
,
RenderableOp
,
RenderedOp
Field Summary | |
protected boolean |
isRenderable
Flag indicating whether the operation is being instantiated in renderable mode. |
protected OperationNodeSupport |
nodeSupport
An object to assist in implementing OperationNode . |
protected PropertySource |
thePropertySource
The PropertySource containing the combined properties
of all of the node's sources. |
Fields inherited from class javax.media.jai.CollectionImage |
eventManager,
imageCollection,
imageFactory,
properties,
sinks |
Constructor Summary | |
CollectionOp(OperationRegistry registry,
String opName,
ParameterBlock pb)
Deprecated. as of JAI 1.1. |
|
CollectionOp(OperationRegistry registry,
String opName,
ParameterBlock pb,
RenderingHints hints)
Constructs a CollectionOp that will be used to
instantiate a particular Collection operation from a given
operation registry, an operation name, a ParameterBlock ,
and a set of rendering hints. |
|
CollectionOp(OperationRegistry registry,
String opName,
ParameterBlock pb,
RenderingHints hints,
boolean isRenderable)
Constructs a CollectionOp that will be used to
instantiate a particular Collection operation from a given
operation registry, an operation name, a ParameterBlock ,
and a set of rendering hints. |
|
CollectionOp(String opName,
ParameterBlock pb,
RenderingHints hints)
Constructs a CollectionOp that will be used to
instantiate a particular Collection operation from a given
operation name, a ParameterBlock , and a set of
rendering hints. |
Method Summary | |
boolean |
add(Object o)
Creates the Collection rendering if none yet exists, and
adds the specified object to this Collection . |
boolean |
addAll(Collection c)
Creates the Collection rendering if none yet exists, and
adds all of the elements in the specified Collection
to this Collection . |
void |
addPropertyGenerator(PropertyGenerator pg)
Adds a PropertyGenerator to the node. |
void |
clear()
Creates the Collection rendering if none yet exists, and
removes all of the elements from this Collection . |
boolean |
contains(Object o)
Creates the Collection rendering if none yet exists, and
returns true if this Collection contains
the specified object. |
boolean |
containsAll(Collection c)
Creates the Collection rendering if none yet exists, and
returns true if this Collection contains
all of the elements in the specified Collection . |
void |
copyPropertyFromSource(String propertyName,
int sourceIndex)
Forces a property to be copied from the specified source node. |
Collection |
createInstance()
Instantiates a Collection operator that computes
the result of this CollectionOp . |
Collection |
createRendering(RenderContext renderContext)
Returns the Collection rendering associated with this
operation with any contained RenderableImage s rendered
using the supplied RenderContext parameter. |
Collection |
getCollection()
Returns the Collection rendering associated with
this operation. |
Object |
getDynamicProperty(String name)
Returns the property associated with the specified property name, or java.awt.Image.UndefinedProperty if the specified
property is not set on the image. |
String |
getOperationName()
Returns the name of the operation this node represents as a String . |
ParameterBlock |
getParameterBlock()
Returns a clone of the ParameterBlock of this node. |
Object |
getProperty(String name)
Gets a property from the property set of this Collection . |
Class |
getPropertyClass(String name)
Returns the class expected to be returned by a request for the property with the specified name. |
String[] |
getPropertyNames()
Returns the names of properties available from this node. |
OperationRegistry |
getRegistry()
Returns the OperationRegistry that is used
by this node. |
String |
getRegistryModeName()
Returns the name of the RegistryMode corresponding to
this CollectionOp . |
RenderingHints |
getRenderingHints()
Returns a clone of the RenderingHints of this node or
null . |
boolean |
isEmpty()
Creates the Collection rendering if none yet exists, and
returns true if this Collection contains
no element. |
boolean |
isRenderable()
Returns whether the operation is being instantiated in renderable mode. |
Iterator |
iterator()
Creates the Collection rendering if none yet exists, and
returns an Iterator over the elements in this
Collection . |
void |
propertyChange(PropertyChangeEvent evt)
Implementation of PropertyChangeListener . |
boolean |
remove(Object o)
Creates the Collection rendering if none yet exists, and
removes the specified object from this Collection . |
boolean |
removeAll(Collection c)
Creates the Collection rendering if none yet exists, and
removes all this Collection 's elements that are also
contained in the specified Collection . |
void |
removeProperty(String name)
Removes the named property from the local property set of the CollectionOp as well as from its property
environment. |
protected void |
resetProperties(boolean resetPropertySource)
Resets the PropertySource . |
boolean |
retainAll(Collection c)
Creates the Collection rendering if none yet exists, and
retains only the elements in this Collection that are
contained in the specified Collection . |
void |
setOperationName(String opName)
Sets the name of the operation this node represents. |
void |
setParameterBlock(ParameterBlock pb)
Sets the ParameterBlock of this node. |
void |
setProperty(String name,
Object value)
Sets a local property on a node. |
void |
setRegistry(OperationRegistry registry)
Sets the OperationRegistry that is used by
this node. |
void |
setRenderingHints(RenderingHints hints)
Sets the RenderingHints of this node. |
int |
size()
Creates the Collection rendering if none yet exists, and
returns the number of elements in this Collection . |
void |
suppressProperty(String name)
Removes a named property from the property environment of this node. |
Object[] |
toArray()
Creates the Collection rendering if none yet exists, and
returns an array containing all of the elements in this
Collection . |
Object[] |
toArray(Object[] a)
Creates the Collection rendering if none yet exists, and
returns an array containing all of the elements in this
Collection whose runtime type is that of the specified
array. |
Methods inherited from class javax.media.jai.CollectionImage |
addPropertyChangeListener,
addPropertyChangeListener,
addSink,
get,
getImageFactory,
getProperty,
getPropertyNames,
getSinks,
removePropertyChangeListener,
removePropertyChangeListener,
removeSink,
removeSinks,
setImageFactory |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected OperationNodeSupport nodeSupport
OperationNode
.protected PropertySource thePropertySource
PropertySource
containing the combined properties
of all of the node's sources.protected boolean isRenderable
Constructor Detail |
public CollectionOp(OperationRegistry registry, String opName, ParameterBlock pb, RenderingHints hints, boolean isRenderable)
CollectionOp
that will be used to
instantiate a particular Collection
operation from a given
operation registry, an operation name, a ParameterBlock
,
and a set of rendering hints.
This method does not validate the contents of the supplied
ParameterBlock
. The caller should ensure that
the sources and parameters in the ParameterBlock
are suitable for the operation this node represents; otherwise
some form of error or exception may occur at the time of rendering.
The ParameterBlock
may include
DeferredData
parameters. These will not be evaluated
until their values are actually required, i.e., when a collection
rendering is requested.
The node is added automatically as a sink of any
PlanarImage
or CollectionImage
sources.
registry
- The OperationRegistry
to be used for
instantiation. if null
, the default registry
is used. Saved by reference.opName
- The operation name. Saved by reference.pb
- The sources and other parameters. If null
,
it is assumed that this node has no sources and parameters.
This parameter is cloned.hints
- The rendering hints. If null
, it is assumed
that no hints are associated with the rendering.
This parameter is cloned.isRenderable
- Whether the operation is being executed in
renderable mode.IllegalArgumentException
- if opName
is null
.public CollectionOp(OperationRegistry registry, String opName, ParameterBlock pb, RenderingHints hints)
CollectionOp
that will be used to
instantiate a particular Collection
operation from a given
operation registry, an operation name, a ParameterBlock
,
and a set of rendering hints. The operation will use the rendered mode.
This method does not validate the contents of the supplied
ParameterBlock
. The caller should ensure that
the sources and parameters in the ParameterBlock
are suitable for the operation this node represents; otherwise
some form of error or exception may occur at the time of rendering.
The ParameterBlock
may include
DeferredData
parameters. These will not be evaluated
until their values are actually required, i.e., when a collection
rendering is requested.
registry
- The OperationRegistry
to be used for
instantiation. if null
, the default registry
is used. Saved by reference.opName
- The operation name. Saved by reference.pb
- The sources and other parameters. If null
,
it is assumed that this node has no sources and parameters.
This parameter is cloned.hints
- The rendering hints. If null
, it is assumed
that no hints are associated with the rendering.
This parameter is cloned.opName
is
null
.public CollectionOp(String opName, ParameterBlock pb, RenderingHints hints)
CollectionOp
that will be used to
instantiate a particular Collection
operation from a given
operation name, a ParameterBlock
, and a set of
rendering hints. The default operation registry is used.
This method does not validate the contents of the supplied
ParameterBlock
. The caller should ensure that
the sources and parameters in the ParameterBlock
are suitable for the operation this node represents; otherwise
some form of error or exception may occur at the time of rendering.
The ParameterBlock
may include
DeferredData
parameters. These will not be evaluated
until their values are actually required, i.e., when a collection
rendering is requested.
opName
- The operation name. Saved by reference.pb
- The sources and other parameters. If null
,
it is assumed that this node has no sources and parameters.
This parameter is cloned.hints
- The rendering hints. If null
, it is assumed
that no hints are associated with the rendering.
This parameter is cloned.IllegalArgumentException
- if opName
is
null
.public CollectionOp(OperationRegistry registry, String opName, ParameterBlock pb)
CollectionOp
that will be used to
instantiate a particular Collection
operation from a given
operation registry, an operation name, and a
ParameterBlock
There are no rendering hints
associated with this operation.
The operation will use the rendered mode.
This method does not validate the contents of the supplied
ParameterBlock
. The caller should ensure that
the sources and parameters in the ParameterBlock
are suitable for the operation this node represents; otherwise
some form of error or exception may occur at the time of rendering.
The ParameterBlock
may include
DeferredData
parameters. These will not be evaluated
until their values are actually required, i.e., when a collection
rendering is requested.
registry
- The OperationRegistry
to be used for
instantiation. if null
, the default registry
is used. Saved by reference.opName
- The operation name. Saved by reference.pb
- The sources and other parameters. If null
,
it is assumed that this node has no sources and parameters.
This parameter is cloned.IllegalArgumentException
- if opName
is
null
.CollectionOp(OperationRegistry,String,ParameterBlock,RenderingHints)
Method Detail |
public boolean isRenderable()
public String getRegistryModeName()
RegistryMode
corresponding to
this CollectionOp
.public OperationRegistry getRegistry()
OperationRegistry
that is used
by this node. If the registry had not been set, the default
registry is returned.public void setRegistry(OperationRegistry registry)
OperationRegistry
that is used by
this node. If the specified registry is null
, the
default registry is used. The parameter is saved by reference.
If the supplied registry does not equal the current registry, a
PropertyChangeEventJAI
named "OperationRegistry"
will be fired and a CollectionChangeEvent
may be
fired if the node has already been rendered.
registry
- The new OperationRegistry
to be set;
it may be null
.public String getOperationName()
String
.public void setOperationName(String opName)
If the supplied name does not equal the current operation name, a
PropertyChangeEventJAI
named "OperationName"
will be fired and a CollectionChangeEvent
may be
fired if the node has already been rendered.
opName
- The new operation name to be set.IllegalArgumentException
- if opName
is
null
.public ParameterBlock getParameterBlock()
ParameterBlock
of this node.public void setParameterBlock(ParameterBlock pb)
ParameterBlock
of this node.
If the specified new ParameterBlock
is null
,
it is assumed that this node has no input sources and parameters.
The supplied parameter is cloned.
This method does not validate the contents of the supplied
ParameterBlock
. The caller should ensure that
the sources and parameters in the ParameterBlock
are suitable for the operation this node represents; otherwise
some form of error or exception may occur at the time of rendering.
If the supplied ParameterBlock
does not equal the
current ParameterBlock
, a
PropertyChangeEventJAI
named "ParameterBlock", "Sources",
or "Parameters" will be fired. A CollectionChangeEvent
may also be fired if the node has already been rendered.
The ParameterBlock
may include
DeferredData
parameters. These will not be evaluated
until their values are actually required, i.e., when a collection
rendering is requested.
The node is registered as a sink of any PlanarImage
or CollectionImage
sources contained in the supplied
ParameterBlock
. The node is also removed as a sink of
any previous PlanarImage
or CollectionImage
sources if these are not in the new ParameterBlock
.
pb
- The new ParameterBlock
to be set;
it may be null
.public RenderingHints getRenderingHints()
RenderingHints
of this node or
null
.public void setRenderingHints(RenderingHints hints)
RenderingHints
of this node.
The supplied parameter is cloned if non-null
.
If the supplied RenderingHints
does not equal the
current RenderingHints
, a
PropertyChangeEventJAI
named "RenderingHints"
will be fired and a CollectionChangeEvent
may be
fired if the node has already been rendered.
hints
- The new RenderingHints
to be set;
it may be null
.public Collection getCollection()
Collection
rendering associated with
this operation.
This method does not validate the sources and parameters
stored in the ParameterBlock
against the specification
of the operation this node represents. It is the responsibility
of the caller to ensure that the data in the
ParameterBlock
are suitable for this operation.
Otherwise, some kind of exception or error will occur. Invoking
this method will cause any DeferredData
parameters
in the ParameterBlock
to be evaluated.
Invoking this method will cause any source RenderedOp
nodes to be rendered using getRendering()
and any
source CollectionOp
nodes to be rendered using
getCollection()
. Any DeferredData
parameters
in the ParameterBlock
will also be evaluated.
public Collection createInstance()
Collection
operator that computes
the result of this CollectionOp
.
This method does not validate the sources and parameters
stored in the ParameterBlock
against the specification
of the operation this node represents. It is the responsibility
of the caller to ensure that the data in the
ParameterBlock
are suitable for this operation.
Otherwise, some kind of exception or error will occur.
Invoking this method will cause any source RenderedOp
or CollectionOp
nodes to be rendered using their
respective createInstance()
methods. Any
DeferredData
parameters in the ParameterBlock
will also be evaluated.
public Collection createRendering(RenderContext renderContext)
Collection
rendering associated with this
operation with any contained RenderableImage
s rendered
using the supplied RenderContext
parameter. If the
operation is being executed in rendered mode
(isRenderable()
returns false
), invoking
this method is equivalent to invoking getCollection()
,
i.e., the parameter is ignored. If the operation is being
executed in renderable mode, the Collection
will differ
from that returned by getCollection()
due to any contained
RenderableImage
s having been rendered. If the
Collection
contains any nested Collection
s,
these will be unwrapped recursively such that a rendering is created
for all RenderableImage
s encountered. Any
RenderingHints
in the RenderContext
are
merged with those set on the node with the argument hints taking
precedence.public void propertyChange(PropertyChangeEvent evt)
PropertyChangeListener
.
When invoked with an event which is an instance of either
CollectionChangeEvent
or
RenderingChangeEvent
emitted by a
CollectionOp
or RenderedOp
source,
respectively, the node will respond by
re-rendering itself while retaining any data possible.
protected void resetProperties(boolean resetPropertySource)
PropertySource
. If the parameter is
true
then the property environment is completely
reset; if false
then only cached properties are
cleared, i.e., those which were derived from the property
environment and are now stored in the local cache.public String[] getPropertyNames()
String
s containing valid
property names or null
if there are none.public Class getPropertyClass(String name)
null
will be returned.Class
expected to be return by a
request for the value of this property or null
.name
is null
.public Object getProperty(String name)
Collection
.
If the property name is not recognized,
java.awt.Image.UndefinedProperty
will be returned.name
- the name of the property to get, as a String.name
is null
.public void setProperty(String name, Object value)
name
- a String representing the property name.value
- the property's value, as an Object.name
or value
is null
.public void removeProperty(String name)
CollectionOp
as well as from its property
environment.name
is null
.public Object getDynamicProperty(String name)
java.awt.Image.UndefinedProperty
if the specified
property is not set on the image. This method is dynamic in the
sense that subsequent invocations of this method on the same object
may return different values as a function of changes in the property
environment of the node, e.g., a change in which
PropertyGenerator
s are registered or in the values
associated with properties of node sources. The case of the property
name passed to this method is ignored.name
- A String
naming the property.name
is null
.public void addPropertyGenerator(PropertyGenerator pg)
pg
- a PropertyGenerator to be added to this node's
property environment.public void copyPropertyFromSource(String propertyName, int sourceIndex)
propertyName
- the name of the property to be copied.sourceIndex
- the index of the from which to copy the property.propertyName
is
null
.public void suppressProperty(String name)
setProperty()
or to having been cached for property
synchronization purposes, subsequent calls to
getProperty(name)
will return
java.awt.Image.UndefinedProperty
, and name
will not appear on the list of properties emitted by
getPropertyNames()
. To delete the property from the
local property set of the node, removeProperty()
should
be used.name
- a String naming the property to be suppressed.IllegalArgumentException
- if
name
is null
.public int size()
Collection
rendering if none yet exists, and
returns the number of elements in this Collection
.public boolean isEmpty()
Collection
rendering if none yet exists, and
returns true
if this Collection
contains
no element.public boolean contains(Object o)
Collection
rendering if none yet exists, and
returns true
if this Collection
contains
the specified object.public Iterator iterator()
Collection
rendering if none yet exists, and
returns an Iterator
over the elements in this
Collection
.public Object[] toArray()
Collection
rendering if none yet exists, and
returns an array containing all of the elements in this
Collection
.public Object[] toArray(Object[] a)
Collection
rendering if none yet exists, and
returns an array containing all of the elements in this
Collection
whose runtime type is that of the specified
array.ArrayStoreException
- if the runtime type of the
specified array is not a supertype of the runtime type of
every element in this Collection
.public boolean add(Object o)
Collection
rendering if none yet exists, and
adds the specified object to this Collection
.true
if and only if the parameter is added to the
Collection
.public boolean remove(Object o)
Collection
rendering if none yet exists, and
removes the specified object from this Collection
.true
if and only if the parameter is removed
from the Collection
.public boolean containsAll(Collection c)
Collection
rendering if none yet exists, and
returns true
if this Collection
contains
all of the elements in the specified Collection
.public boolean addAll(Collection c)
Collection
rendering if none yet exists, and
adds all of the elements in the specified Collection
to this Collection
.true
if this Collection
changed
as a result of the call.public boolean removeAll(Collection c)
Collection
rendering if none yet exists, and
removes all this Collection
's elements that are also
contained in the specified Collection
.true
if this Collection
changed
as a result of the call.public boolean retainAll(Collection c)
Collection
rendering if none yet exists, and
retains only the elements in this Collection
that are
contained in the specified Collection
.true
if this Collection
changed
as a result of the call.public void clear()
Collection
rendering if none yet exists, and
removes all of the elements from this Collection
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |