public class IlvOneLinkImage extends IlvLinkImage
IlvOneLinkImage
represents the connection between two
nodes in a grapher
; the link is displayed as
two lines following a right angle.
For more information about specialized link graphic objects, see
IlvLinkImage.
The default values for an IlvOneLinkImage
instance are as
follows:
Color.black
0
IlvStroke.CAP_SQUARE
The following code example shows how to use an
IlvOneLinkImage
in a simple Java application:
IlvGraphic node1, node2; IlvGrapher grapher = new IlvGrapher(); IlvOneLinkImage 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); //Link the two nodes and add the link to a grapher. link = new IlvOneLinkImage( node1, node2, IlvOneLinkImage.VerticalLink, true); grapher.addLink(link,true);
The following image shows the graphic object created in the code example:
>
IlvOneLinkImage
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 FormModifier and Type | Field and Description |
---|---|
static int |
HorizontalLink
Horizontal orientation of the link
|
static int |
VerticalLink
Vertical orientation of the link
|
Constructor and Description |
---|
IlvOneLinkImage(IlvGraphic from,
IlvGraphic to,
boolean oriented)
Creates a new link image.
|
IlvOneLinkImage(IlvGraphic from,
IlvGraphic to,
int orientation,
boolean oriented)
Creates a new link image.
|
IlvOneLinkImage(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
IlvOneLinkImage(IlvOneLinkImage source)
Create a new
IlvOneLinkImage by copying the specified one. |
Modifier and Type | Method and Description |
---|---|
IlvGraphic |
copy()
Copies the object.
|
void |
getConnectionPoints(IlvPoint src,
IlvPoint dst,
IlvTransformer t)
Computes the origin and destination point to draw the link.
|
IlvPoint[] |
getLinkPoints(IlvTransformer t)
Returns the points that define the link.
|
int |
getOrientation()
Returns the orientation of the link.
|
IlvPoint |
getPointAt(int index,
IlvTransformer t)
Returns the point at a specified index.
|
int |
getPointsCardinal()
Returns the number of points.
|
void |
setOrientation(int orientation)
Changes the orientation of the link.
|
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream . |
allowsPointInsertion, allowsPointMove, allowsPointRemoval, applyTransform, arrowBBox, arrowContains, boundingBox, contains, draw, drawArrow, finalize, getArrowSize, getConnectionReferencePoint, getEndCap, getForeground, getFrom, getFromBoundingBox, getFromTransformer, getLineJoin, getLineStyle, getLineWidth, getLineWidth, getLinkConnectorConnectionPoint, getLinkPoints, getLocalTransformerOf, getMaximumLineWidth, getOpposite, getTo, getToBoundingBox, getToTransformer, getVisibleFrom, getVisibleTo, insertPoint, isOriented, isPersistent, isSpline, makeSelection, movePoint, pointsInBBox, removePoint, setEndCap, setForeground, setFrom, setIntermediateLinkPoints, 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 static final int VerticalLink
public static final int HorizontalLink
public IlvOneLinkImage(IlvGraphic from, IlvGraphic to, boolean oriented)
from
- The origin object.to
- The destination object.oriented
- If oriented
is true, an arrow is drawn at the
destination point.public IlvOneLinkImage(IlvGraphic from, IlvGraphic to, int orientation, boolean oriented)
from
- The origin object.to
- The destination object.orientation
- The valid values for this may be
IlvOneLinkImage.VerticalLink
or
IlvOneLinkImage.HorizontalLink
.
It specifies the direction the link takes upon leaving the
from
node.oriented
- If oriented
is true, an arrow is drawn at the
destination point.public IlvOneLinkImage(IlvOneLinkImage source)
IlvOneLinkImage
by copying the specified one.public IlvOneLinkImage(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 void setOrientation(int orientation)
IlvOneLinkImage.VerticalLink
or
IlvOneLinkImage.HorizontalLink
.
It specifies the direction the link takes upon leaving the
origin
node.getOrientation()
public int getOrientation()
setOrientation(int)
public int getPointsCardinal()
getLinkPoints
returns 3 points. The reason
is that we only want to edit the extremity points.getPointsCardinal
in interface IlvPolyPointsInterface
getPointsCardinal
in class IlvLinkImage
public IlvPoint getPointAt(int index, IlvTransformer t)
index
is 0 or 1 because
the object defines a polypoints of 2 points event is the
method getLinkPoints
returns 3 points. The reason
is that we only want to edit the extremity points.getPointAt
in interface IlvPolyPointsInterface
getPointAt
in class IlvLinkImage
index
- The index of the point.t
- The transformer through which the object is drawn.public void getConnectionPoints(IlvPoint src, IlvPoint dst, IlvTransformer t)
getConnectionPoints
in class IlvLinkImage
src
- A point to store the origin.dst
- A point to store the destination.t
- The transformer used to draw the link.IlvLinkConnector.getConnectionPoint(ilog.views.IlvLinkImage, boolean, ilog.views.IlvTransformer)
public IlvPoint[] getLinkPoints(IlvTransformer t)
getConnectionPoints
member function
and the intermediate point for the angle.getLinkPoints
in class IlvLinkImage
public void write(IlvOutputStream stream) throws IOException
IlvOutputStream
.
Note that even if this is a public method, you should not
call it directly, 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.