ilog.views.graphic
Class IlvDoubleLinkImage

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.IlvLinkImage
          extended by ilog.views.graphic.IlvDoubleLinkImage
All Implemented Interfaces:
IlvPolyPointsInterface, IlvPersistentObject, Transferable, Serializable
Direct Known Subclasses:
IlvDoubleSplineLinkImage

public class IlvDoubleLinkImage
extends IlvLinkImage

IlvDoubleLinkImage represents the connection between two nodes in a grapher; the link is displayed as three lines containing two right angles. For more information about specialized link graphic objects, see IlvLinkImage.

The default values for an IlvDoubleLinkImage instance are as follows:

Example

The following code example shows how to use an IlvDoubleLinkImage in a simple Java application:

   IlvGraphic node1, node2;
   IlvGrapher grapher = new IlvGrapher();
   IlvDoubleLinkImage 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 them to a grapher.
   link = new IlvDoubleLinkImage(
              node1, 
              node2,
              IlvDoubleLinkImage.VerticalLink, 
              true);
   grapher.addLink(link,true);
 

The following image shows the graphic object created in the code example:

About Graphic Objects

IlvDoubleLinkImage 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.

See Also:
IlvPoint, IlvManager, IlvManagerView, IlvStroke, Serialized Form

Field Summary
static int HorizontalLink
          HORIZONTAL orientation of the link.
static int VerticalLink
          Vertical orientation of the link.
 
Constructor Summary
IlvDoubleLinkImage(IlvDoubleLinkImage source)
          Create a new IlvDoubleLinkImage by copying the specified one.
IlvDoubleLinkImage(IlvGraphic from, IlvGraphic to, boolean oriented)
          Creates a new double link image.
IlvDoubleLinkImage(IlvGraphic from, IlvGraphic to, int orientation, boolean oriented)
          Creates a new double link image.
IlvDoubleLinkImage(IlvInputStream stream)
          Reads the object from an IlvInputStream.
 
Method Summary
 IlvGraphic copy()
          Copies the object.
 void getConnectionPoints(IlvPoint src, IlvPoint dst, IlvTransformer t)
          Computes the origin and destination point to draw the link.
 IlvPoint getConnectionReferencePoint(boolean origin, IlvTransformer t)
          Returns the reference connection point.
 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.
 
Methods inherited from class ilog.views.IlvLinkImage
allowsPointInsertion, allowsPointMove, allowsPointRemoval, applyTransform, arrowBBox, boundingBox, contains, draw, drawArrow, finalize, getArrowSize, getEndCap, getForeground, getFrom, getFromBoundingBox, getFromTransformer, getLineJoin, getLineStyle, getLineWidth, getLineWidth, getLinkConnectorConnectionPoint, getLocalTransformerOf, getMaximumLineWidth, getOpposite, getTo, getToBoundingBox, getToTransformer, getVisibleFrom, getVisibleTo, insertPoint, isOriented, isPersistent, isSpline, makeSelection, movePoint, pointsInBBox, removePoint, setEndCap, setForeground, setFrom, setIntermediateLinkPoints, setLineJoin, setLineStyle, setLineWidth, setMaximumLineWidth, setOriented, setTo, zoomable
 
Methods inherited from class ilog.views.IlvGraphic
addActionListener, addNamedPropertyListener, boundingBox, getAndAssociateObjectInteractor, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getIntersectionWithOutline, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, hasProperty, inside, intersects, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isSelectable, isVisible, move, move, moveResize, notifyObjectInteractorToManager, processActionEvent, reDraw, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setBackground, setEditable, setFillOn, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipText, setVisible, toString, translate
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VerticalLink

public static final int VerticalLink
Vertical orientation of the link.

See Also:
Constant Field Values

HorizontalLink

public static final int HorizontalLink
HORIZONTAL orientation of the link.

See Also:
Constant Field Values
Constructor Detail

IlvDoubleLinkImage

public IlvDoubleLinkImage(IlvGraphic from,
                          IlvGraphic to,
                          boolean oriented)
Creates a new double link image.

Parameters:
from - the origin object.
to - the destination object.
oriented - if oriented is true then an arrow is drawn at the destination point.

IlvDoubleLinkImage

public IlvDoubleLinkImage(IlvGraphic from,
                          IlvGraphic to,
                          int orientation,
                          boolean oriented)
Creates a new double link image.

Parameters:
from - the origin object.
to - the destination object.
orientation - the valid values for this may be IlvDoubleLinkImage.VerticalLink or IlvDoubleLinkImage.HorizontalLink. It specifies the direction the link takes upon leaving the from node.
oriented - if oriented is true then an arrow is drawn at the destination point.

IlvDoubleLinkImage

public IlvDoubleLinkImage(IlvDoubleLinkImage source)
Create a new IlvDoubleLinkImage by copying the specified one.


IlvDoubleLinkImage

public IlvDoubleLinkImage(IlvInputStream stream)
                   throws IlvReadFileException
Reads the object from an IlvInputStream.

Parameters:
stream - the input stream.
Throws:
IlvReadFileException - if the format is not correct.
Method Detail

copy

public IlvGraphic copy()
Copies the object.

Overrides:
copy in class IlvLinkImage
Returns:
A copy of this IlvGraphic instance.
See Also:
IlvGraphic

setOrientation

public void setOrientation(int orientation)
Changes the orientation of the link. The valid values for this may be IlvDoubleLinkImage.VerticalLink or IlvDoubleLinkImage.HorizontalLink. It specifies the direction the link takes upon leaving the origin node.


getOrientation

public int getOrientation()
Returns the orientation of the link.


getPointsCardinal

public int getPointsCardinal()
Returns the number of points. The default implementation returns 2. Even if the link is defined by 4 points, the number of points for the polypoint is 2, the reason is that we want to edit only the extremity points.

Specified by:
getPointsCardinal in interface IlvPolyPointsInterface
Overrides:
getPointsCardinal in class IlvLinkImage

getPointAt

public IlvPoint getPointAt(int index,
                           IlvTransformer t)
Returns the point at a specified index. Valid values for index is 0 or 1 because the object defines a polypoints of 2 points event is the method getLinkPoints returns 4 points. The reason is that we only want to edit the extremity points.

Specified by:
getPointAt in interface IlvPolyPointsInterface
Overrides:
getPointAt in class IlvLinkImage
Parameters:
index - the index of the point.
t - the transformer through which the object is drawn.

getConnectionReferencePoint

public IlvPoint getConnectionReferencePoint(boolean origin,
                                            IlvTransformer t)
Returns the reference connection point.

Overrides:
getConnectionReferencePoint in class IlvLinkImage
Parameters:
origin - If origin is true, then the connection point of the origin is searched for. If origin is false then the connection point of the destination is searched for.
t - The transformer that is used to draw the node.
See Also:
IlvLinkConnector

getConnectionPoints

public void getConnectionPoints(IlvPoint src,
                                IlvPoint dst,
                                IlvTransformer t)
Computes the origin and destination point to draw the link.

Overrides:
getConnectionPoints in class IlvLinkImage
Parameters:
src - a point to store the origin.
dst - a point to store the destination.
t - the transformer used to draw the link.
See Also:
IlvLinkConnector.getConnectionPoint(ilog.views.IlvLinkImage, boolean, ilog.views.IlvTransformer)

getLinkPoints

public IlvPoint[] getLinkPoints(IlvTransformer t)
Returns the points that define the link. This class has four points, the points returned by the getConnectionPoints member function and the intermediate points for the angles.

Overrides:
getLinkPoints in class IlvLinkImage

write

public void write(IlvOutputStream stream)
           throws IOException
Writes the object to an 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.

Specified by:
write in interface IlvPersistentObject
Overrides:
write in class IlvLinkImage
Parameters:
stream - The output stream.
Throws:
IOException - thrown when an exception occurs during the write operation for this object.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.