public class IlvGraphicElement extends IlvGroupElement
IlvGraphicElement
lets you add
IlvGraphic
objects
to IlvGroup
(or IlvPrototype
) objects.
The IlvGraphicElement
class implements the
set
and get
methods so that any properties (as defined by
the JavaBeans API) of a graphic object can be accessed through the
graphic element.
When values are set for a graphic element, the function
IlvManager.applyToObject()
is automatically
invoked whenever required.
The manager containing the graphic object is also automatically redrawn.
When several values are
set for a group containing graphic elements, redrawing is performed only
when all the modifications have been made.
IlvGroupElement
,
IlvGroup
,
IlvGraphic
,
Serialized FormConstructor and Description |
---|
IlvGraphicElement(IlvGraphic graphic)
Creates a new
IlvGraphicElement . |
IlvGraphicElement(IlvGraphicElement source)
Creates a new
IlvGraphicElement by copying
an existing graphic element. |
IlvGraphicElement(IlvGraphic graphic,
String name)
Creates a new
IlvGraphicElement with the specified
name . |
IlvGraphicElement(IlvInputStream in)
Reads a graphic element.
|
Modifier and Type | Method and Description |
---|---|
void |
apply(IlvApplyObject applyObj,
Object arg,
boolean redraw)
This method can be used to directly modify the graphic object that this
graphic element contains.
|
IlvGroupElement |
copy()
Returns a copy of this graphic element.
|
void |
dispose()
Dissociates this graphic element from the graphic object that it contains.
|
protected void |
get(String[] names,
Object[] values,
boolean[] done)
Retrieves a set of properties from this graphic element.
|
int |
getBaseLayer()
Returns the layer of the object.
|
double |
getCenterX()
Returns the horizontal center of this graphic element.
|
double |
getCenterY()
Returns the vertical center of this graphic element.
|
static IlvGraphicElement |
getElement(IlvGraphic graphic)
Returns the graphic element that contains the graphic object
specified.
|
IlvGraphic |
getGraphic()
Returns the
IlvGraphic object that the graphic element contains. |
IlvGraphicBag |
getGraphicBag()
Returns the graphic bag that contains the graphic object associated with this graphic element.
|
double |
getHeight()
Returns the height of this graphic element.
|
String |
getInteractor()
Returns the name of the interactor attached to the object or
null if the object has no interactor. |
int |
getLayer()
Returns the layer of the object.
|
IlvManager |
getManager()
Returns the manager that contains the graphic object associated with
this graphic element.
|
String[] |
getValueNames(boolean publicOnly)
Returns the names of all the public values handled by this graphic element,
that is, the names of all the values that can be read and/or
changed by calling the
get and set
methods. |
double |
getWidth()
Returns the width of this graphic element.
|
double |
getX()
Returns the x coordinate of this graphic element.
|
double |
getY()
Returns the y coordinate of this graphic element.
|
boolean |
isGrapherNode()
Returns
true if the graphic object is
a node of a grapher. |
boolean |
isVisible()
Returns the visibility of the object.
|
protected void |
set(String[] names,
Object[] values,
boolean[] done)
Changes a set of properties handled by this graphic element.
|
void |
setBaseLayer(int layer)
Sets the base layer of the graphic object.
|
void |
setGrapherNode(boolean grapherNode)
Marks this object as being a grapher node.
|
void |
setGraphicBag(IlvGraphicBag graphicBag)
Adds the graphic object to the graphic bag specified, which is generally an
IlvManager object. |
void |
setHeight(double height)
Sets the height of this graphic element.
|
void |
setInteractor(String interactor)
Sets the name of the object interactor attached to this object.
|
void |
setIsNode(boolean grapherNode)
This method is equivalent to
setGrapherNode . |
void |
setLayer(int layer)
Sets the layer of the graphic object in the manager.
|
void |
setManager(IlvManager manager)
Adds the graphic object to the specified manager.
|
void |
setTransformation(IlvTransformer t)
Applies a transformer to this graphic element.
|
void |
setTransformation(IlvTransformer t,
boolean redraw)
Applies a transformer to this graphic element.
|
void |
setVisible(boolean visible)
Sets the visibility of the graphic object.
|
void |
setWidth(double width)
Sets the width of this graphic element.
|
void |
setX(double x)
Sets the x coordinate of this graphic element.
|
void |
setY(double y)
Sets the y coordinate of this graphic element.
|
void |
write(IlvOutputStream out)
Writes a graphic element.
|
applyTransform, applyTransform, boundingBox, boundingBox, get, get, get, getBoolean, getDouble, getFloat, getInt, getLong, getName, getParent, getRelativePath, getString, getSubscribers, getSubscriptionValues, isOutput, move, pushValue, pushValues, set, set, set, set, set, set, set, setName, subscribe, traverse, unsubscribe
public IlvGraphicElement(IlvGraphic graphic)
IlvGraphicElement
. The graphic element is given
the name of the graphic object, if any. Otherwise, it is given the
name of the class defining the graphic object.graphic
- the graphic object that this graphic element contains.public IlvGraphicElement(IlvGraphic graphic, String name)
IlvGraphicElement
with the specified
name
.graphic
- the graphic object that this graphic element contains.name
- the name of the graphic element.public IlvGraphicElement(IlvGraphicElement source)
IlvGraphicElement
by copying
an existing graphic element.source
- the graphic element to be copied.public IlvGraphicElement(IlvInputStream in) throws IlvReadFileException
in
- the input stream.IlvReadFileException
- if the stream format is wrong
or if an error occurred while reading.public void write(IlvOutputStream out) throws IOException
write
in interface IlvPersistentObject
write
in class IlvGroupElement
out
- the output stream.IOException
- if an error occurred while writing.IlvGroup.write(ilog.views.io.IlvOutputStream)
public IlvGroupElement copy() throws IlvValueException
IlvGraphic
object
that the copied graphic element contains. The copy is obtained by
calling the IlvGraphic.copy()
method.copy
in class IlvGroupElement
IlvValueException
- if an error occurred while setting or reading a value.IlvGroup.copy(ilog.views.prototypes.IlvGroup)
public static IlvGraphicElement getElement(IlvGraphic graphic)
null
.
This method is used to determine whether a graphic object belongs to an
IlvGroup
. For example:
IlvGraphic graphicObj = ...; IlvGraphicElement graphicElement = IlvGraphicElement.getElement(graphicObj); if(graphicElement){ IlvGroup group = graphicElement.getGroup().getTopGroup(); }
graphic
- the graphic object.null
if the graphic object does not belong to a group.IlvGroupElement.getParent()
,
IlvGroup.getTopGroup()
public void dispose()
This method can be used to ungroup graphic objects from an editor. The graphic objects still exist in their manager, but they are no longer associated with a group element.
public IlvGraphic getGraphic()
IlvGraphic
object that the graphic element contains.IlvGraphic
object that the graphic element contains.public String[] getValueNames(boolean publicOnly) throws IlvValueException
get
and set
methods.
This method returns the names of the properties (as defined by the
JavaBeans API) of the graphic object that this graphic element contains, as well as
the values defined by the graphic element itself:
layer
, interactor
, grapherNode
,
and so on.
getValueNames
in class IlvGroupElement
publicOnly
- this parameter is ignored by the class
IlvGraphicElement
.IlvValueException
- if an value error occurred while reading a property.protected void set(String[] names, Object[] values, boolean[] done) throws IlvValueException
IlvGroupElement.set
to determine whether the properties
can be handled by the setXxx
methods of this class.
Then, if all properties have not been handled, it tries to set the properties
on the graphic object contained in this element.names
- the names of the properties to be set.values
- the new values.done
- an array of boolean values indicating which properties have been
handled.IlvValueException
- if an error occurred while setting a property.IlvGroupElement.set(java.lang.String[], java.lang.Object[])
protected void get(String[] names, Object[] values, boolean[] done) throws IlvValueException
IlvGroupElement.get
to determine whether the properties
can be handled by the getXxx
methods of this class.
Then, if all values have not been handled, it tries to get the values
from the graphic object contained in this element.names
- the names of the properties to be retrieved.values
- the array where the property values will be stored.done
- an array of boolean values indicating which properties have been
handled.IlvValueException
- if an error occurred while reading a property.IlvGroupElement.get(java.lang.String[], java.lang.Object[])
public void apply(IlvApplyObject applyObj, Object arg, boolean redraw)
applyToObject
method of this manager. Otherwise,
the apply
method of applyObj
is directly called.
This method also handles the automatic redrawing of the manager.
In general, there is no need to call this method directly.
The set
methods should be used instead.applyObj
- the object whose apply
method is called.arg
- the additional argument passed to the apply
method.redraw
- if true, the object's region is invalidated.IlvGroupElement.set(java.lang.String[], java.lang.Object[])
public void setGraphicBag(IlvGraphicBag graphicBag)
IlvManager
object. If the graphic object already belongs to
a graphic bag, it is first removed from it. If the visibility or the layer
of the graphic object has been set (by calling the setVisible
or setLayer
methods or by setting the values visible
or layer
), the corresponding manager property is set
accordingly.graphicBag
- the graphic bag to which the object is to be added or
null
if the object is to be removed from its current bag.setLayer(int)
,
setVisible(boolean)
,
IlvGraphicBag.addObject(ilog.views.IlvGraphic, boolean)
,
IlvGraphicBag.removeObject(ilog.views.IlvGraphic, boolean)
public IlvGraphicBag getGraphicBag()
public void setManager(IlvManager manager)
setGraphicBag
.manager
- the manager to which the object is to be added or null
if the object is to be removed from its manager.setGraphicBag(ilog.views.IlvGraphicBag)
public IlvManager getManager()
public void setLayer(int layer)
IlvManager.setLayer
. Otherwise, the
layer is stored until the object is added to a manager.layer
- the layer index.public int getLayer()
public void setBaseLayer(int layer)
layer
- the layer index offset.public int getBaseLayer()
public void setInteractor(String interactor)
interactor
- the name of the interactor.public String getInteractor()
null
if the object has no interactor.public boolean isVisible()
public void setVisible(boolean visible)
IlvManager.setVisible
. Otherwise, the
visibility is stored until the object is added to a manager.visible
- the visibility state.public boolean isGrapherNode()
true
if the graphic object is
a node of a grapher.public void setGrapherNode(boolean grapherNode)
grapherNode
parameter is true
and if the object belongs to
an IlvGrapher
object, this method calls the function
IlvGrapher.makeNode
to make the object a grapher node.
Otherwise, the graphic element is marked so that, when it is
added to a grapher (by calling setManager
or by
setting the value manager
), it is added as a grapher node.grapherNode
- if true
, makes the object a grapher node.IlvGrapher.makeNode(ilog.views.IlvGraphic)
,
setManager(ilog.views.IlvManager)
public void setIsNode(boolean grapherNode)
setGrapherNode
.
It exists only to provide
the same behavior name (isNode
) as in the C++ version for
making an object a grapher node.grapherNode
- if true
, makes the object a grapher node.setGrapherNode(boolean)
public void setTransformation(IlvTransformer t)
t
- the transformer to be applied.public void setTransformation(IlvTransformer t, boolean redraw)
t
- the transformer to be applied.redraw
- If true
, the group is redrawn, otherwise no redraw occurs.public void setX(double x)
x
- the new x coordinate.public double getX()
public void setY(double y)
y
- the new y coordinate.public double getY()
public void setWidth(double width)
width
- the new width.public double getWidth()
public void setHeight(double height)
height
- the new height.public double getHeight()
public double getCenterX()
public double getCenterY()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.