public class IlvPolicyAwareLinkImage extends IlvPolylineLinkImage
IlvPolicyAwareLinkImage
is a subclass of
IlvPolylineLinkImage
used to set the format of the line linking
two nodes. For example, you can set the line shape to remain orthogonal as
it traces the points in the link. The available link shape policies are as follows:
The default values for an IlvPolicyAwareLinkImage
instance
are as follows:
Color.black
0
IlvStroke.CAP_SQUARE
For more information about specialized link graphic objects, see IlvLinkImage.
The following code example shows how to use an
IlvPolicyAwareLinkImage
in a simple Java application:
IlvGrapher grapher = new IlvGrapher(); IlvRectangle origin1 = new IlvReliefRectangle(new IlvRect(200, 110, 40, 40)); IlvRectangle dest1 = new IlvReliefRectangle(new IlvRect(140, 20, 40, 40)); grapher.addNode(origin1, false); grapher.addNode(dest1, false); IlvPoint[] points = new IlvPoint[5]; points[0] = new IlvPoint(40, 40); points[1] = new IlvPoint(60, 20); points[2] = new IlvPoint(50, 40); points[3] = new IlvPoint(50, 70); points[4] = new IlvPoint(90, 90); IlvOrthogonalLinkShapePolicy policy = new IlvOrthogonalLinkShapePolicy(); // the policy can be shared among links IlvPolicyAwareLinkImage link1 = new IlvPolicyAwareLinkImage(origin1, dest1, true, points); link1.setLinkShapePolicy(policy); // insert the links into the grapher only AFTER installing the policy grapher.addLink(link1, true);
The following image shows the graphic objects created in the code example:
IlvPolicyAwareLinkImage
is a custom graphic object, that is, a
subclass of IlvGraphic
. Graphic objects are controlled using
an IlvManager
instance and displayed using one or more
IlvManagerView
instances in a Java Swing application.
For information about generic features for graphic objects, see
IlvGraphic.IlvManager
,
IlvManagerView
,
setLinkShapePolicy(IlvLinkShapePolicy)
,
Serialized FormConstructor and Description |
---|
IlvPolicyAwareLinkImage(IlvGraphic from,
IlvGraphic to,
boolean oriented,
IlvPoint[] points)
Creates and initializes a new
IlvPolicyAwareLinkImage . |
IlvPolicyAwareLinkImage(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
IlvPolicyAwareLinkImage(IlvPolicyAwareLinkImage source)
Creates and initializes a new
IlvPolicyAwareLinkImage by
copying an existing one. |
Modifier and Type | Method and Description |
---|---|
void |
applyTransform(IlvTransformer t)
Applies a transformation to the shape of the object.
|
IlvGraphic |
copy()
Copies the object.
|
IlvPoint[] |
getLinkPoints(IlvTransformer t)
Returns the points that define the link.
|
IlvLinkShapePolicy |
getLinkShapePolicy()
Returns the link shape policy.
|
IlvPoint |
getPointAt(int index,
IlvTransformer t)
Returns the point at a given index.
|
void |
insertPoint(int index,
double x,
double y,
IlvTransformer t)
Inserts a point at a specified index.
|
void |
movePoint(int index,
double x,
double y,
IlvTransformer t)
Changes the position of a point.
|
void |
removePoint(int index,
IlvTransformer t)
Removes the point at a specified index.
|
void |
setGraphicBag(IlvGraphicBag bag)
Changes the bag that contains the object.
|
void |
setIntermediateLinkPoints(IlvPoint[] points,
int index,
int length)
Changes the intermediate points that define the link.
|
void |
setLinkShapePolicy(IlvLinkShapePolicy policy)
Sets the link shape policy.
|
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream . |
allowsPointInsertion, allowsPointRemoval, getPointsCardinal
allowsPointMove, arrowBBox, arrowContains, boundingBox, contains, draw, drawArrow, finalize, getArrowSize, getConnectionPoints, getConnectionReferencePoint, getEndCap, getForeground, getFrom, getFromBoundingBox, getFromTransformer, getLineJoin, getLineStyle, getLineWidth, getLineWidth, getLinkConnectorConnectionPoint, getLinkPoints, getLocalTransformerOf, getMaximumLineWidth, getOpposite, getTo, getToBoundingBox, getToTransformer, getVisibleFrom, getVisibleTo, isOriented, isPersistent, isSpline, makeSelection, pointsInBBox, setEndCap, setForeground, setFrom, setLineJoin, setLineStyle, setLineWidth, setLinkPoints, setMaximumLineWidth, setOriented, setTo, zoomable
addActionListener, addNamedPropertyListener, allViewsRemoved, baseTextDirectionChanged, blinkingStateOn, boundingBox, callDraw, componentOrientationChanged, getAndAssociateObjectInteractor, getBaseTextDirection, getBlinkingAction, getBlinkingObjectOwner, getBlinkingOffPeriod, getBlinkingOnPeriod, getCenter, getComponentOrientation, getDefaultInteractor, getGraphicBag, GetGraphicObject, getIntersectionWithOutline, getLocale, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getResolvedBaseTextDirection, getToolTipBaseTextDirection, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, getULocale, getZOrderIndex, hasProperty, inside, intersects, invalidateBBoxCache, invalidateBidiCache, isBaseTextDirectionSensitive, isComponentOrientationSensitive, isDataFlavorSupported, isEditable, isInApplyToObject, isLocaleSensitive, isMovable, isSelectable, isVisible, localeChanged, move, move, moveResize, needsViewNotification, notifyObjectInteractorToManager, processActionEvent, reDraw, registerBlinkingResource, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setBackground, setBaseTextDirection, setBaseTextDirectionDuringConstruction, setBlinkingAction, setBlinkingOffPeriod, setBlinkingOnPeriod, setEditable, setFillOn, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipBaseTextDirection, setToolTipText, setVisible, setZOrderIndex, toString, translate, updateNeedsViewNotification, usesBidiMarkers, viewAddedOrRemoved
public IlvPolicyAwareLinkImage(IlvGraphic from, IlvGraphic to, boolean oriented, IlvPoint[] points)
IlvPolicyAwareLinkImage
.
from
- The origin object.to
- The destination object.oriented
- Specifies whether an arrow is drawn at the end of the
link or not.points
- The intermediate points of the polylink.public IlvPolicyAwareLinkImage(IlvPolicyAwareLinkImage source)
IlvPolicyAwareLinkImage
by
copying an existing one.
source
- The copied object.public IlvPolicyAwareLinkImage(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.
stream
- The input stream.IlvReadFileException
- if the format is not correct.public IlvGraphic copy()
IlvLinkImage
cannot be copied.
This method returns null
.copy
in class IlvPolylineLinkImage
IlvGraphic
instance.IlvGraphic
public void setLinkShapePolicy(IlvLinkShapePolicy policy)
IlvManager.applyToObject
since
it may change the shape of the link.
You should not manipulate link connectors directly while having a link
shape policy installed. In order to change the link connector, first
deinstall all link shape policies and reinstall them later.public final IlvLinkShapePolicy getLinkShapePolicy()
public void setGraphicBag(IlvGraphicBag bag)
setGraphicBag
in class IlvGraphic
bag
- The graphic bag.IlvGraphic
public void setIntermediateLinkPoints(IlvPoint[] points, int index, int length)
length
points in the points
array beginning at the index
point and will use them for a new
intermediate points array.
If the array is null
or the length parameter is 0,
intermediate points are removed.
setIntermediateLinkPoints
in class IlvPolylineLinkImage
points
- An array of points.index
- The index of the point that will be the first
intermediate point.
length
- The number of intermediate points taken in the
points
array.IlvApplyObject
,
IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)
public void insertPoint(int index, double x, double y, IlvTransformer t)
insertPoint
in interface IlvPolyPointsInterface
insertPoint
in class IlvPolylineLinkImage
index
- The index at which the new point will be inserted.x
- The x coordinate of the new point (in manager coordinates).y
- The y coordinate of the new point (in manager coordinates).t
- The transformer used to draw the polypoint.public void removePoint(int index, IlvTransformer t)
removePoint
in interface IlvPolyPointsInterface
removePoint
in class IlvPolylineLinkImage
index
- The index of the point to be removed.t
- The transformer used to draw the polypoint.public void movePoint(int index, double x, double y, IlvTransformer t)
index
is the index of the first or last point,
this method calls the movePoint
method of the superclass.
Otherwise, the method simply moves the point to the new coordinates.
movePoint
in interface IlvPolyPointsInterface
movePoint
in class IlvPolylineLinkImage
index
- The index of the point to be moved.x
- The new x coordinate (in manager coordinates).y
- The new y coordinate (in manager coordinates).t
- The transformer through which the object is drawn.IlvApplyObject
,
IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)
public void applyTransform(IlvTransformer t)
t
to the
intermediate points of the link, if any.
applyTransform
in class IlvPolylineLinkImage
t
- The transformer to be applied.IlvGraphic
public IlvPoint[] getLinkPoints(IlvTransformer t)
getLinkPoints
in class IlvPolylineLinkImage
t
- The transformer to be applied.public IlvPoint getPointAt(int index, IlvTransformer t)
getPointAt
in interface IlvPolyPointsInterface
getPointAt
in class IlvPolylineLinkImage
index
- The index of the point.t
- The transformer to be applied.public void write(IlvOutputStream stream) throws IOException
IlvOutputStream
.
You should not call this
method directly; instead, you should use the write
methods of the manager.
write
in interface IlvPersistentObject
write
in class IlvPolylineLinkImage
stream
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.