public class IlvAssociation extends IlvGraphicSet implements IlvPersistentObject
IlvAssociation
contains an IlvLine
that
connects to the center point of two graphic objects.
The connection point for the anchor and callout nodes can be either of
the following:
IlvGraphic
instance.IlvLinkImage
instance that is closest to
the center of the segment lengths.The default values for an IlvAssociation
instance are as
follows:
IlvLine
.IlvLine
instance in the IlvAssociation
object.IlvAssociation
in a simple Java application:
IlvGrapher grapher = new IlvGrapher(); // Creates the origin and the destination nodes IlvRectangle origin = new IlvReliefRectangle(new IlvRect(50,80,40,40)); origin.setBackground(Color.lightGray); grapher.addNode(origin,false); IlvRectangle dest = new IlvReliefRectangle(new IlvRect(250,80,40,40)); dest.setBackground(Color.lightGray); grapher.addNode(dest,false); // Creates the link between the nodes IlvLinkImage link = new IlvPolylineLinkImage(origin,dest,false,null); link.setLineWidth(5); link.setForeground(Color.decode("#40BFBD")); grapher.addLink(link,false); // Creates a composite which groups a label and a left bracket IlvCompositeGraphic callout = new IlvCompositeGraphic(); IlvCenteredLayout cl = new IlvCenteredLayout(); cl.setInsets(new Insets(5,5,5,5)); callout.setLayout(cl); // Creates the bracket IlvBracket bracket = new IlvBracket(); bracket.move(10,10); bracket.setFillOn(true); bracket.setBackground(Color.white); bracket.setWidthRatio(0.5); callout.setChildren(0,bracket); // Creates the text IlvText text = new IlvText(new IlvPoint(),"This is a link annotation"); text.setFont(Font.decode("sansserif-BOLD-10")); callout.setChildren(1,text); grapher.addNode(callout,false); // Creates the association which links the bracket to the link IlvAssociation association = new IlvAssociation(); association.setAnchor(link); association.setCallout(callout); association.setLineWidth(1); association.setForeground(Color.black); association.setLineStyle(new float[]{2.0f,4.0f}); grapher.addNode(association,false);
The following image shows the graphic objects created in the code example:
IlvAssociation
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.
IlvCompositeGraphic
,
IlvCenteredLayout
,
IlvManager
,
IlvManagerView
,
Serialized FormIlvGraphicSet.DelegateObjectInteractor
list
Constructor and Description |
---|
IlvAssociation()
Creates an
IlvAssociation with the default values. |
IlvAssociation(IlvAssociation source)
Creates a new
IlvAssociation by copying an existing one. |
IlvAssociation(IlvGraphic anchor)
Creates an
IlvAssociation with the supplied anchor. |
IlvAssociation(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
Modifier and Type | Method and Description |
---|---|
IlvGraphic |
copy()
Copies this object.
|
IlvGraphic |
getAnchor()
Returns the
IlvGraphic which defines the anchor point of the association. |
IlvGraphic |
getCallout()
Returns the callout of this association.
|
Color |
getForeground()
Returns the color of the line.
|
IlvLine |
getLine()
Returns the line that represents the association.
|
float[] |
getLineStyle()
Returns the array representing the lengths of the dash segments.
|
double |
getLineWidth()
Returns the line width of the object.
|
double |
getMaximumLineWidth()
Returns the maximum line width of the line.
|
IlvSelection |
makeSelection()
Creates a selection object for this object.
|
void |
setAnchor(IlvGraphic anchor)
Sets the
IlvGraphic which defines the anchor point of the association. |
void |
setCallout(IlvGraphic graphic)
Defines the callout of this association.
|
void |
setForeground(Color color)
Changes the color of the line.
|
void |
setGraphicBag(IlvGraphicBag bag)
Changes the bag that contains the object.
|
void |
setLine(IlvLine line)
Sets the line that associates the anchor callout and the callout callout
|
void |
setLineStyle(float[] lineStyle)
Changes the array representing the lengths of the dash segments.
|
void |
setLineWidth(double lineWidth)
Changes the line width of the object.
|
void |
setMaximumLineWidth(double maximumLineWidth)
Changes the maximum line width of the line.
|
void |
write(IlvOutputStream stream)
Writes the attributes of a persistent object.
|
boolean |
zoomable()
Returns always
false , because this object is not zoomable. |
addGraphicBagHierarchyListener, addManagerViewsHierarchyListener, addObject, addObjectAt, applyToObject, applyToObjectImpl, applyTransform, baseTextDirectionChanged, boundingBox, componentOrientationChanged, contains, contains, draw, drawCore, enableGraphicBagHierarchyEventForwarding, enableManagerViewsHierarchyEventForwarding, fireGraphicBagHierarchyEvent, fireManagerViewsHierarchyEvent, firstContains, getAlpha, getCardinal, getClip, getIndex, getIntersectionWithOutline, getObject, getObject, getObjectName, getObjects, getOriginalPopupMenu, getPopupMenu, getToolTipText, invalidateAndApplyToObject, invalidateBBoxCache, isBaseTextDirectionSensitive, isComponentOrientationSensitive, isLocaleSensitive, isPersistent, moveObject, needsGraphicBagHierarchyEvent, needsManagerViewsHierarchyEvent, reDrawObj, reDrawRegion, removeAll, removeGraphicBagHierarchyListener, removeManagerViewsHierarchyListener, removeObject, removeObjectAt, reshapeObject, setAlpha, setBaseTextDirection, setClip, setInsideApply, setObjectName, shouldElementBePartOfClip, shouldRestrictListOfElementsForClip
calcResolvedBaseTextDirection, getBaseTextDirection, getComponentOrientation, getResolvedBaseTextDirection, getULocale, invalidateBidiCache, setBaseTextDirection, setBaseTextDirectionDuringConstruction
addActionListener, addNamedPropertyListener, allViewsRemoved, blinkingStateOn, boundingBox, callDraw, getAndAssociateObjectInteractor, getBlinkingAction, getBlinkingObjectOwner, getBlinkingOffPeriod, getBlinkingOnPeriod, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getLocale, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenuName, getProperty, getToolTipBaseTextDirection, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, getZOrderIndex, hasProperty, inside, intersects, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isSelectable, isVisible, localeChanged, move, move, moveResize, needsViewNotification, notifyObjectInteractorToManager, processActionEvent, reDraw, registerBlinkingResource, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setBackground, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getGraphicBag
public IlvAssociation()
IlvAssociation
with the default values.public IlvAssociation(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.stream
- The input stream.IlvReadFileException
- if the format is not correct.public IlvAssociation(IlvGraphic anchor)
IlvAssociation
with the supplied anchor.public IlvAssociation(IlvAssociation source)
IlvAssociation
by copying an existing one.public IlvGraphic copy()
copy
in class IlvGraphicSet
IlvGraphic
public IlvLine getLine()
public void setLine(IlvLine line)
public IlvGraphic getAnchor()
IlvGraphic
which defines the anchor point of the association.public void setAnchor(IlvGraphic anchor)
IlvGraphic
which defines the anchor point of the association.
The anchor can be either:
IlvGraphic
The anchor point is the center of the bounding box of the
supplied callout.
IlvLinkImage
The anchor point is the middle of the segment which is the closest to the
middle of the segment lengths.
public IlvGraphic getCallout()
public void setCallout(IlvGraphic graphic)
public void setGraphicBag(IlvGraphicBag bag)
setGraphicBag
in class IlvGraphicSet
bag
- The graphic bag to contain this graphic object.IlvGraphic
public IlvSelection makeSelection()
IlvDrawSelection
.
Override this method in your custom graphic object to use a different selection object.
You should normally not call this method directly.makeSelection
in class IlvGraphic
IlvDrawSelection
public boolean zoomable()
false
, because this object is not zoomable.zoomable
in class IlvGraphicSet
IlvGraphic
,
IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer)
,
IlvGraphic.boundingBox(IlvTransformer)
,
IlvManager
public void write(IlvOutputStream stream) throws IOException
write
in interface IlvPersistentObject
write
in class IlvGraphicSet
stream
- the output streamIOException
- thrown when an exception occurs during
the write operation for this object.public float[] getLineStyle()
public void setLineStyle(float[] lineStyle)
lineStyle
- The new line style.public double getLineWidth()
0
.public void setLineWidth(double lineWidth)
lineWidth
- The new line width.public void setForeground(Color color)
IlvBlinkingColor
.setForeground
in class IlvGraphic
color
- The new color.IlvGraphic.draw(Graphics, IlvTransformer)
,
IlvGraphic.setBackground(Color)
,
IlvGraphic.setFillOn(boolean)
,
IlvGraphic.setStrokeOn(boolean)
,
IlvGraphic
public Color getForeground()
public double getMaximumLineWidth()
public void setMaximumLineWidth(double maximumLineWidth)
maximumLineWidth
- The new maximum line width.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.