public class IlvPolylineLinkImage extends IlvLinkImage
IlvPolylineLinkImage
represents the connection between two
nodes in a grapher
; the link is displayed as
a line that traces several points.
For more information about specialized link graphic objects, see
IlvLinkImage.
The default values for an IlvPolylineLinkImage
instance are
as follows:
Color.black
0
IlvStroke.CAP_SQUARE
The following code example shows how to use an
IlvPolylineLinkImage
in a simple Java application:
IlvGraphic node1, node2; IlvGrapher grapher = new IlvGrapher(); IlvPolylineLinkImage link; //Create new ellipse node and add it to the grapher. node1 = new IlvEllipse(new IlvRect(30,10,50,50), true, false); grapher.addNode(node1,false); //Add a new rectangular node to the grapher. node2 = new IlvRectangle(new IlvRect(220,90,50,50), false, true); grapher.addNode(node2, 2, true); //Add points IlvPoint[] points = new IlvPoint[5]; points[0] = new IlvPoint(40, 40); points[1] = new IlvPoint(50, 20); points[2] = new IlvPoint(90, 40); points[3] = new IlvPoint(70, 70); points[4] = new IlvPoint(90, 90); //Link the two nodes and add the link to a grapher. link = new IlvPolylineLinkImage( node1, node2, true, points); link.setForeground(Color.green); grapher.addLink(link,true);
The following image shows the graphic object created in the code example:
>
IlvPolylineLinkImage
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.
IlvPoint
,
IlvManager
,
IlvManagerView
,
Serialized FormConstructor and Description |
---|
IlvPolylineLinkImage(IlvGraphic from,
IlvGraphic to,
boolean oriented,
IlvPoint[] points)
Creates and initializes a new
IlvPolylineLinkImage . |
IlvPolylineLinkImage(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
IlvPolylineLinkImage(IlvPolylineLinkImage source)
Creates and initializes a new
IlvPolylineLinkImage by copying
an existing one. |
Modifier and Type | Method and Description |
---|---|
boolean |
allowsPointInsertion()
Indicates that this link class allows the insertion of intermediate points.
|
boolean |
allowsPointRemoval()
Indicates if the removal of intermediate points is allowed.
|
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.
|
IlvPoint |
getPointAt(int index,
IlvTransformer t)
Returns the point at the specified index.
|
int |
getPointsCardinal()
Returns the number of points of the link, including the connection points.
|
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 |
setIntermediateLinkPoints(IlvPoint[] points,
int index,
int length)
Changes the intermediate points that define the link.
|
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream . |
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, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipBaseTextDirection, setToolTipText, setVisible, setZOrderIndex, toString, translate, updateNeedsViewNotification, usesBidiMarkers, viewAddedOrRemoved
public IlvPolylineLinkImage(IlvGraphic from, IlvGraphic to, boolean oriented, IlvPoint[] points)
IlvPolylineLinkImage
.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. If the array is
null
or its length is 0, the link is created
without intermediate points.public IlvPolylineLinkImage(IlvPolylineLinkImage source)
IlvPolylineLinkImage
by copying
an existing one.source
- The copied object.public IlvPolylineLinkImage(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.stream
- The input stream.IlvReadFileException
- if the format is not correct.public IlvGraphic copy()
copy
in class IlvLinkImage
IlvGraphic
instance.IlvGraphic
public int getPointsCardinal()
getPointsCardinal
in interface IlvPolyPointsInterface
getPointsCardinal
in class IlvLinkImage
public IlvPoint[] getLinkPoints(IlvTransformer t)
getLinkPoints
in class IlvLinkImage
t
- The transformer through which the object is drawn.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 IlvLinkImage
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 IlvPoint getPointAt(int index, IlvTransformer t)
getPointAt
in interface IlvPolyPointsInterface
getPointAt
in class IlvLinkImage
index
- The index of the point.t
- The transformer through which the object is drawn.public boolean allowsPointInsertion()
allowsPointInsertion
in interface IlvPolyPointsInterface
allowsPointInsertion
in class IlvLinkImage
true
.insertPoint(int, double, double, ilog.views.IlvTransformer)
public boolean allowsPointRemoval()
allowsPointRemoval
in interface IlvPolyPointsInterface
allowsPointRemoval
in class IlvLinkImage
true
if at least one intermediate point exists
and false
otherwise.removePoint(int, ilog.views.IlvTransformer)
public void insertPoint(int index, double x, double y, IlvTransformer t)
insertPoint
in interface IlvPolyPointsInterface
insertPoint
in class IlvLinkImage
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 link.public void removePoint(int index, IlvTransformer t)
removePoint
in interface IlvPolyPointsInterface
removePoint
in class IlvLinkImage
index
- The index of the point to be removed.t
- The transformer used to draw the link.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 IlvLinkImage
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 IlvLinkImage
t
- The transformer to be applied.IlvGraphic
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 IlvLinkImage
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.