public abstract class IlvGroupElement extends Object implements IlvPersistentObject, Serializable
IlvGroupElement is the abstract base class for all the objects
contained in instances of IlvGroup. Its predefined subclasses
are IlvGraphicElement, which is used to include IlvGraphic
objects
in groups, and IlvGroup, which is used to include subgroups (and thus
build hierarchical structures).
An IlvGroupElement has a set of static or dynamic properties.
These named properties can be read and set to a new value using the
get and set methods.
An IlvGroupElement can also have output properties. An output
property is similar to an event in that it is generated by the
IlvGroupElement (through a call to the pushValues method),
and can be connected to an input property handled by another object (using the
subscribe method).
You do not need to know the exact type of the properties you set or
read on an IlvGroupElement since all values are
automatically converted to the correct type as needed.
For example, to set the horizontal position
of an object, you could set the "x" property to the string
"100" as follows:
obj.set("x", "100");
The string "100" will be automatically converted to a
double when required.
You could also call one of the various overloaded set
methods that accept value parameters with different
primitive types:
obj.set("x", 100);
obj.set("y", 99.9);
Conversely, values returned by the get methods must
often be converted to the appropriate type for them to be used by the application.
The shortest way do this is to call the get<Type> method
that retrieves the property and convert its result to a specific type:
int x = obj.getInt("x");
double y = obj.getDouble("y");
You can also call the generic get method and convert
the result to the desired type with the static methods of the class
IlvValueConverter:
Object xval = obj.get("x");
double x = IlvValueConverter.convertToDouble(xval);
IlvGroup,
IlvGraphicElement,
Serialized Form| Constructor and Description |
|---|
IlvGroupElement()
Creates a group element.
|
| Modifier and Type | Method and Description |
|---|---|
void |
applyTransform(IlvTransformer t)
Applies a transformer to all the graphic subelements of the group element.
|
void |
applyTransform(IlvTransformer t,
boolean redraw)
Applies a transformer to all the graphic subelements of the group element.
|
IlvRect |
boundingBox(IlvTransformer t)
Returns the bounding box of this group element, which
is the union of the bounding boxes of all the graphic elements that
it contains.
|
IlvRect |
boundingBox(IlvTransformer t,
boolean includeInvisible)
Returns the bounding box of this group element, which
is the union of the bounding boxes of all the graphic elements that
it contains.
|
abstract IlvGroupElement |
copy()
Makes a copy of this group element.
|
Object |
get(String name)
Retrieves one of the properties handled by this object.
|
Object[] |
get(String[] names)
Retrieves a set of properties handled by the object.
|
void |
get(String[] names,
Object[] values)
Retrieves a set of properties handled by this object.
|
boolean |
getBoolean(String name)
Retrieves a boolean property.
|
double |
getDouble(String name)
Retrieves a double property.
|
float |
getFloat(String name)
Retrieves a float property.
|
int |
getInt(String name)
Retrieves an integer property.
|
long |
getLong(String name)
Retrieves a long property.
|
String |
getName()
Returns the name of this group element.
|
IlvGroup |
getParent()
Returns the parent of this group element or
null
if the element does not belong to a group. |
String |
getRelativePath(IlvGroup group)
Returns the access path to this group element relative to the specified group.
|
String |
getString(String name)
Retrieves a string.
|
IlvGroupElement[] |
getSubscribers()
Returns all the objects that are connected to this group element,
that is, all the subscribers passed to
the
subscribe method applied to
this object. |
String[] |
getSubscriptionValues(IlvGroupElement subscriber)
Returns the names of the source and destination properties of
the connections established between this group element and
subscriber. |
String[] |
getValueNames(boolean publicOnly)
Returns the names of the properties handled by this group element.
|
boolean |
isOutput(String name)
Returns
true if the specified property
is an output property. |
void |
move(double x,
double y)
Moves the group element.
|
void |
pushValue(String name,
Object value)
Propagates a single value through the connections established between this
group element and its subscribers.
|
void |
pushValues(String[] names,
Object[] values)
Propagates a set of values through the connections established between this
group element and its subscribers.
|
void |
set(String[] names,
Object[] values)
Sets a set of properties handled by this object to a new value.
|
void |
set(String name,
boolean value)
Sets a boolean property to a new value.
|
void |
set(String name,
double value)
Sets a double property to a new value.
|
void |
set(String name,
float value)
Sets a double property to a new value.
|
void |
set(String name,
int value)
Sets an integer property to a new value.
|
void |
set(String name,
long value)
Sets a long property to a new value.
|
void |
set(String name,
Object value)
Sets one of the properties handled by this object to a new value.
|
void |
setName(String name)
Changes the name of this group element to the name specified.
|
void |
subscribe(IlvGroupElement subscriber,
String sourceValue,
String subscriberValue)
Connects this group element to the
subscriber object. |
boolean |
traverse(IlvGroupTraverser traverser)
Called when the group to which this group element belongs
is traversed using the
IlvGroup.traverse method. |
void |
unsubscribe(IlvGroupElement subscriber,
String sourceValue,
String subscriberValue)
Breaks the connection between the group element and the
subscriber
object. |
abstract void |
write(IlvOutputStream out)
Writes this group element to a Rogue Wave JViews output stream.
|
public abstract IlvGroupElement copy() throws IlvValueException
copy method of the class IlvGroup to copy
all the elements belonging to the group.IlvValueException - if an error occurred while setting or reading a value.IlvGroup.copy(ilog.views.prototypes.IlvGroup)public abstract void write(IlvOutputStream out) throws IOException
write method of the class IlvGroup to write
all the elements belonging the group.write in interface IlvPersistentObjectout - the output stream.IOException - thrown when an exception occurs during
the write operation for this object.IlvGroup.write(ilog.views.io.IlvOutputStream)public IlvGroup getParent()
null
if the element does not belong to a group.public String getName()
public void setName(String name)
name - the new name of the group element.public String getRelativePath(IlvGroup group) throws IlvGroupException
group. These names are separated by dot ('.')
characters. Calling group.findNode(path) with the resulting
path returns this group element (provided that all elements have unique names
at a given level).IlvGroupException - if the group element does not belong to
the specified group.public boolean traverse(IlvGroupTraverser traverser)
IlvGroup.traverse method.
It must return true to allow the operation to continue.
If it returns false, the operation
is stopped and the top level traverse method returns
false
traverser - the IlvGroupTraverser object whose preOrder and
postOrder methods will be called for each element in the group.true in the base class implementation.IlvGroup.traverse(ilog.views.prototypes.IlvGroupTraverser)public IlvRect boundingBox(IlvTransformer t)
t - the transformer used to compute the bounding boxes of the
graphic elements.null if the group element has no graphic element.public IlvRect boundingBox(IlvTransformer t, boolean includeInvisible)
This method is similar to boundingBox except for the
additional includeInvisible argument.
t - the transformer used to compute the bounding boxes of the
graphic elements.includeInvisible - if this parameter is true, the bounding box includes
all the elements of the group. If it is false, the bounding box includes only
the visible elements.null if the group element has no graphic element.public void applyTransform(IlvTransformer t)
t - the transformer to be applied.public void applyTransform(IlvTransformer t, boolean redraw)
t - the transformer to be applied.redraw - If true, the element is redrawn, otherwise no redraw occurs.public void move(double x,
double y)
applyTransform method.public String[] getValueNames(boolean publicOnly) throws IlvValueException
publicOnly - if true, only the public properties of
the group element are returned.IlvValueException - if an error occurred while
reading a value.public boolean isOutput(String name)
true if the specified property
is an output property.public final void set(String[] names, Object[] values) throws IlvValueException
names - the names of the properties to be set.values - the new values. Primitive values
must be wrapped in reference objects. For example, to set an
integer value, you must create an object of the class Integer and store
a reference to this object in the values argument.IlvValueException - if one or more properties are not
handled by this object, the exception is an instance of the class
IlvValuesNotHandledException. Otherwise, the exception means that
an error occurred while changing the properties.public final void get(String[] names, Object[] values) throws IlvValueException
names - the names of the properties to be retrieved.values - the array where the values read will be stored.
Primitive values
are wrapped in reference objects. Integer values, for example, are returned
in an object of the class Integer. Once you get this object, you have to
retrieve the primitive integer value from it.IlvValueException - if one or more properties are not
handled by this object, the exception is an instance of the class
IlvValuesNotHandledException. Otherwise, the exception means that
an error occurred while reading the properties.public final Object[] get(String[] names) throws IlvValueException
get(String[] names, Object[] values),
except that it allocates the array of returned values itself.names - the names of the properties to be retrieved.IlvValueException - if one or more properties are not
handled by this object, the exception is an instance of the class
IlvValuesNotHandledException. Otherwise, the exception means that
an error occurred while retrieving the properties.get(java.lang.String[], java.lang.Object[])public final void set(String name, Object value) throws IlvValueException
name - the name of the property to be set.value - the new value.IlvValueException - if the value is not
handled by this object, the exception is an instance of the class
IlvValuesNotHandledException. Otherwise, the exception means that
an error occurred while changing the properties.set(java.lang.String[], java.lang.Object[])public final Object get(String name) throws IlvValueException
name - the name of the property to be retrieved.IlvValueException - if the value is not
handled by this object, the exception is an instance of the class
IlvValuesNotHandledException. Otherwise, the exception
means that
an error occurred while retrieving the value.get(java.lang.String[], java.lang.Object[])public final void set(String name, boolean value) throws IlvValueException
This method wraps the boolean value in a Boolean object
and calls the method set(String, Object).
name - the name of the property to be set.value - the new value.IlvValueException - if the value is not
handled by this object, the exception is an instance of the class
IlvValuesNotHandledException.
Otherwise, the exception means that an error occurred
while changing the properties.set(java.lang.String, java.lang.Object)public final void set(String name, int value) throws IlvValueException
This method wraps the integer value in an Integer object
and calls the method set(String, Object).
name - the name of the property to be set.value - the new value.IlvValueException - if the value is not
handled by this object, the exception is an instance of the class
IlvValuesNotHandledException.
Otherwise, the exception means that an error occurred
while changing the properties.set(java.lang.String, java.lang.Object)public final void set(String name, long value) throws IlvValueException
This method wraps the long value in a Long object
and calls the method set(String, Object).
name - the name of the property to be set.value - the new value.IlvValueException - if the value is not
handled by this object, this exception is an instance of the class
IlvValuesNotHandledException.
Otherwise, the exception means that an error occurred
while changing the properties.set(java.lang.String, java.lang.Object)public final void set(String name, float value) throws IlvValueException
This method wraps the float value in a Float object
and calls the method set(String, Object).
name - the name of the property to be set.value - the new value.IlvValueException - if the value is not
handled by this object, this exception is an instance of the class
IlvValuesNotHandledException.
Otherwise, the exception means that an error occurred
while changing the properties.set(java.lang.String, java.lang.Object)public final void set(String name, double value) throws IlvValueException
This method wraps the double value in a Double object
and calls the method set(String, Object).
name - the name of the property to be set.value - the new value.IlvValueException - if the value is not
handled by this object, this exception is an instance of the class
IlvValuesNotHandledException.
Otherwise, the exception means that an error occurred
while changing the properties.set(java.lang.String, java.lang.Object)public final boolean getBoolean(String name) throws IlvValueException
This method calls the method get(String)
and converts the result to a boolean value.
name - the name of the property to be retrieved.IlvValueException - if the value is not
handled by this object, this exception is an instance of the class
IlvValuesNotHandledException.
Otherwise, the exception means that an error occurred
while changing the properties.get(java.lang.String)public final int getInt(String name) throws IlvValueException
This method calls the method get(String)
and converts the result to an integer.
name - the name of the property to be retrieved.IlvValueException - if the value is not
handled by this object, this exception is an instance of the class
IlvValuesNotHandledException.
Otherwise, the exception means that another error occurred
while changing the properties.get(java.lang.String)public final long getLong(String name) throws IlvValueException
This method calls the method get(String)
and converts the result to a long.
name - the name of the property to be retrieved.IlvValueException - if the value is not
handled by this object, this exception is an instance of the class
IlvValuesNotHandledException.
Otherwise, the exception means that an error occurred
while changing the properties.get(java.lang.String)public final float getFloat(String name) throws IlvValueException
This method calls the method get(String)
and converts the result to a float.
name - the name of the property to be retrieved.IlvValueException - if the value is not
handled by this object, this exception is an instance of the class
IlvValuesNotHandledException.
Otherwise, the exception means that an error occurred
while changing the properties.get(java.lang.String)public final double getDouble(String name) throws IlvValueException
This method calls the method get(String)
and converts the result to a double.
name - the name of the property to be retrieved.IlvValueException - if the value is not
handled by this object, this exception is an instance of the class
IlvValuesNotHandledException.
Otherwise, the exception means that an error occurred
while changing the properties.get(java.lang.String)public final String getString(String name) throws IlvValueException
This method calls the method get(String)
and converts the result to a string.
name - the name of the property to be retrieved.IlvValueException - if the value is not
handled by this object, this exception is an instance of the class
IlvValuesNotHandledException.
Otherwise, the exception means that an error occurred
while changing the properties.get(java.lang.String)public void subscribe(IlvGroupElement subscriber, String sourceValue, String subscriberValue)
subscriber object.
When two IlvGroupElement objects are connected,
calling the pushValues method for the source object
will cause the set method for the destination
object to be invoked. When the source property is generated, the subscriber
property is set for the subscriber.subscriber - the destination object of the connection.sourceValue - the name of the source property of the new connection.subscriberValue - the name of the destination property of the
new connection.public void unsubscribe(IlvGroupElement subscriber, String sourceValue, String subscriberValue)
subscriber
object.subscriber - the destination object of the connection.sourceValue - the name of the source property of the new connection.
If this parameter is null, all the connections between the group element and the
subscriber object are broken regardless of their source property.subscriberValue - the name of the source property of the new
connection.
If this parameter is null, all the connections between the group element and the
subscriber object are
broken regardless of their destination property.public final void pushValues(String[] names, Object[] values) throws IlvValueException
Example:
If the source and subscriber objects
are connected as follows:
source.subscribe(susbcriber, "sourceProp1", "destProp2"); source.subscribe(subscriber, "sourceProp2", "destProp2");Then this call to
pushValues:
String[] sourceNames = { "sourceProp1", "sourceProp2" };
Object[] values = { v1, v2 };
source.pushValues(sourceNames, values);
will set the following values of subscriber:
String[] destNames = { "destProp1", "destProp2" };
Object[] values = { v1, v2 };
subscriber.set(destNames, values);
IlvValueException - if one or more propagated values
are not
handled by the destination object, this exception is an instance of the
class IlvValuesNotHandledException. Otherwise, the exception means that
an error occurred while changing the properties.public final void pushValue(String name, Object value) throws IlvValueException
pushValues except that
it propagates only one value.IlvValueException - if the propagated value is not
handled by the destination object, the exception is an instance of the
class IlvValuesNotHandledException. Otherwise, the exception means that
an error occurred while changing the properties.public final IlvGroupElement[] getSubscribers()
subscribe method applied to
this object. A given subscriber is stored only once in
the returned array.
For each subscriber returned, the details of the connection
(that is, the names of the source and destination properties)
can be obtained using the getSubscriptionValues
method.
public final String[] getSubscriptionValues(IlvGroupElement subscriber)
subscriber.
Both the source and destination property names are returned: the
first element of the array is the source property of the
first connection, the second element is the destination property
of the first connection, the third element is the source property
of the second connection, the fourth element is the destination
property of the second connection, and so on.subscriber - the subscriber of the connection.subscribe(IlvGroupElement, String, String),
getSubscribers()© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.