|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.views.prototypes.IlvGroupElement
ilog.views.prototypes.IlvGroup
public class IlvGroup
An IlvGroup is a logical, hierarchical collection of objects.
The elements of a group are instances of subclasses of
IlvGroupElement. Existing subclasses of
IlvGroupElement are IlvGraphicElement that
contain IlvGraphic objects and
IlvGroup.
Since IlvGroup objects can contain any kind of object, they
provide a generic programming interface based on named properties. This interface
is defined in the superclass IlvGroupElement.
The actual effect of changing a
property of a group depends on the objects contained in the group and on the
IlvBehavior objects attached to this group.
Most groups contain graphic elements. The following properties of a group let you set or get the corresponding properties of all its graphic elements:
The following code:
group.set("visible", false);
will make all the graphic elements of the group invisible.
The following code:
group.set("baseLayer", 10);
will move each graphic element to the layer 10+n, where
n is the value of the layer property of the graphic element.
The following code:
group.set("layer", 5);
will set the relative layer of all the graphic elements to 5.
The following code:
group.set("grapherNode", true);
will make each graphic element of the group a grapher node.
IlvGroupElement,
IlvGraphicElement,
IlvBehavior,
IlvPrototype,
IlvPrototypeInstance,
Serialized Form| Field Summary | |
|---|---|
static String |
indeterminate
This value is returned by the get methods
when a graphic property has different values for different
graphic elements of the group. |
| Constructor Summary | |
|---|---|
IlvGroup(IlvGroup source)
Creates a copy of an existing group. |
|
IlvGroup(IlvInputStream in)
Reads an IlvGroup from an IlvInputStream. |
|
IlvGroup(String name)
Creates a new, empty IlvGroup with the given name. |
|
| Method Summary | |
|---|---|
void |
addBehavior(IlvBehavior acc)
Adds a behavior object to this group. |
void |
addElement(IlvGroupElement element)
Adds an element to this group. |
void |
clear()
Removes all the elements and behavior objects attached to this group. |
IlvGroupElement |
copy()
Returns a copy of the group. |
void |
copy(IlvGroup source)
Makes this group a copy of another group. |
IlvGroupElement |
findElement(String name)
Finds an element in the group from its name. |
Enumeration |
getBehaviors()
Returns all the behavior objects that are attached to the group. |
Enumeration |
getElements()
Returns the elements in the group. |
IlvGroupBag |
getGroupBag()
Returns the IlvGroupBag object that contains the group
or null if the group does not belong to
a group bag. |
IlvGroupFrame |
getGroupFrame()
Returns the IlvGroupFrame used to select this group in
a manager. |
IlvGroup |
getTopGroup()
Returns the top level ancestor of this group by going up the parent chain until a null parent is found. |
String[] |
getValueNames(boolean publicOnly)
Returns the names of the properties handled by the behavior objects attached to the group. |
boolean |
isABehaviorValue(String valueName,
boolean publicOnly)
Tests if a property exists and is handled by a behavior object. |
boolean |
isOutput(String name)
Returns true if the specified property
is an output property. |
boolean |
isPrivate(String name)
Returns true if the specified property
is private. |
void |
removeBehavior(IlvBehavior acc)
Removes a behavior object from the group. |
void |
removeElement(IlvGroupElement element)
Removes an element from this group. |
void |
renameValue(String oldName,
String newName)
Renames the oldName property handled by
all the behavior objects associated with this group
as newName. |
static void |
setMessageWriter(PrintWriter writer)
Changes the writer object used by the library to print messages. |
void |
setPrivate(String name,
boolean priv)
Marks a property of this group as private. |
void |
swapBehaviors(IlvBehavior b1,
IlvBehavior b2)
Swaps the positions of the behavior objects b1
and b2. |
boolean |
traverse(IlvGroupTraverser traverser)
Recursively traverses all the elements in a group. |
void |
unsubscribe(IlvGroupElement subscriber,
String sourceValue,
String subscriberValue)
This method is overridden from the IlvGroupElement class
to handle subscriptions to group elements (using the same dot notation
as for set/get). |
void |
write(IlvOutputStream out)
Writes an IlvGroup to an IlvOutputStream. |
| Methods inherited from class ilog.views.prototypes.IlvGroupElement |
|---|
applyTransform, applyTransform, boundingBox, boundingBox, get, get, get, getBoolean, getDouble, getFloat, getInt, getLong, getName, getParent, getRelativePath, getString, getSubscribers, getSubscriptionValues, move, pushValue, pushValues, set, set, set, set, set, set, set, setName, subscribe |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String indeterminate
get methods
when a graphic property has different values for different
graphic elements of the group.
| Constructor Detail |
|---|
public IlvGroup(String name)
IlvGroup with the given name.
name - the name of the new group.
public IlvGroup(IlvGroup source)
throws IlvValueException
source - the group to be copied.
IlvValueException - if an error occurred while copying
the group.
public IlvGroup(IlvInputStream in)
throws IlvReadFileException
IlvGroup from an IlvInputStream.
in - the stream from which the group is read.
IlvReadFileException - if the file format is not correct.| Method Detail |
|---|
public void write(IlvOutputStream out)
throws IOException
IlvGroup to an IlvOutputStream.
write in interface IlvPersistentObjectwrite in class IlvGroupElementout - the stream to which the group is written.
IOException - if an I/O error or a value error occurred.write(ilog.views.io.IlvOutputStream)
public void copy(IlvGroup source)
throws IlvValueException
The elements and behavior objects of the source
group are copied into the receiving group. The result
is equivalent to calling the copy method
of the source group, except that the
elements and behaviors are copied "in place" into the receiving
group, not into a newly allocated group.
source - the group from which elements and behaviors are copied.
IlvValueException - if an error occurred while copying
the group.public void clear()
public IlvGroupElement copy()
throws IlvValueException
copy in class IlvGroupElementIlvValueException - if a value error occurred.copy(ilog.views.prototypes.IlvGroup)public IlvGroup getTopGroup()
null parent is found.
public void addElement(IlvGroupElement element)
element - the element to be added.public void removeElement(IlvGroupElement element)
element - the element to be removed.public Enumeration getElements()
IlvGroupElement objects.
public IlvGroupElement findElement(String name)
throws IlvGroupException
'.') characters. These characters denote subgroup elements
(for example, car.wheel.tire). The special names "this"
or "[all]" can be used to designate the receiving group itself.
name - the full name of the group element.
IlvGroupException - if the element could not be found.public boolean traverse(IlvGroupTraverser traverser)
For each element of the group:
preOrder method of the IlvGroupTraverser object
is called.
traverse method of the element is called
and, for sub-group elements, the sub-group is recursively traversed.
postOrder method of the IlvGroupTraverser object
is called.
false, the
operation is immediately stopped and the method returns
false.
traverse in class IlvGroupElementtraverser - the IlvGroupTraverser object whose preOrder and
postOrder methods will be called for each element in the group.
true if the whole group was traversed (that is, if
all the traverse methods returned true) and
false if the operation was aborted.IlvGroupTraverser,
IlvGroupElement.traverse(ilog.views.prototypes.IlvGroupTraverser)public void addBehavior(IlvBehavior acc)
attach method
of the behavior object is called.
acc - the behavior object to be added.IlvBehavior.attach(ilog.views.prototypes.IlvGroup)public void removeBehavior(IlvBehavior acc)
detach method
of the behavior object is called.
acc - the behavior object to be removed.IlvBehavior.detach(ilog.views.prototypes.IlvGroup)
public void swapBehaviors(IlvBehavior b1,
IlvBehavior b2)
b1
and b2. This method can be used by graphical editors to
reorder the behavior objects attached to a group. The order of
behavior objects can be important if one of the behavior objects
uses a value stored in a preceding behavior object. Behavior objects
are always called in the order in which they are stored in the group.
b1 - the first behavior object to be swapped.b2 - the second behavior object to be swapped.public Enumeration getBehaviors()
IlvBehavior objects.
public String[] getValueNames(boolean publicOnly)
throws IlvValueException
getValueNames in class IlvGroupElementpublicOnly - if true, only the values handled by the
behavior objects that are not marked as private will be returned.
If false, all the values are returned.
IlvValueException - if an error occurred while reading a property.
public boolean isABehaviorValue(String valueName,
boolean publicOnly)
valueName - the name of the property to check.publicOnly - if true only the values handled by the
behavior objects that are not marked as private will be checked.
If false, all the values are checked.
public void setPrivate(String name,
boolean priv)
private.
Private properties are not listed by the function getValueNames
and are not saved to files.
name - the name of the property.priv - the new private status.isPrivate(java.lang.String)public boolean isPrivate(String name)
true if the specified property
is private. Otherwise, returns false.
setPrivate(java.lang.String, boolean)public boolean isOutput(String name)
true if the specified property
is an output property.
isOutput in class IlvGroupElementIlvBehavior.isOutput()
public void renameValue(String oldName,
String newName)
oldName property handled by
all the behavior objects associated with this group
as newName.
This method is intended to be used by GUI editors.
oldName - the old property name.newName - the new property name.public IlvGroupFrame getGroupFrame()
IlvGroupFrame used to select this group in
a manager.
IlvGroupFrame used to select this group in
a manager or null if this group has no graphic group.IlvGroupFrame,
IlvGroupBag.selectGroup(ilog.views.prototypes.IlvGroup, boolean)public IlvGroupBag getGroupBag()
IlvGroupBag object that contains the group
or null if the group does not belong to
a group bag.
public void unsubscribe(IlvGroupElement subscriber,
String sourceValue,
String subscriberValue)
IlvGroupElement class
to handle subscriptions to group elements (using the same dot notation
as for set/get).
unsubscribe in class IlvGroupElementsubscriber - 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 static void setMessageWriter(PrintWriter writer)
System.out stream. This method can be used
to redirect messages.
writer - the new writer used to print messages. Messages
will be printed by calling the println method of
writer.
|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||