ilog.views.graphic
Class IlvOneLinkImage

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

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:

Example

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:

About Graphic Objects

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.

See Also:
IlvPoint, IlvManager, IlvManagerView, Serialized Form

Field Summary
static int HorizontalLink
          Horizontal orientation of the link
static int VerticalLink
          Vertical orientation of the link
 
Constructor Summary
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.
 
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[] 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, getConnectionReferencePoint, 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

IlvOneLinkImage

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

Parameters:
from - The origin object.
to - The destination object.
oriented - If oriented is true, an arrow is drawn at the destination point.

IlvOneLinkImage

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

Parameters:
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.

IlvOneLinkImage

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


IlvOneLinkImage

public IlvOneLinkImage(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 IlvOneLinkImage.VerticalLink or IlvOneLinkImage.HorizontalLink. It specifies the direction the link takes upon leaving the origin node.

See Also:
getOrientation()

getOrientation

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

See Also:
setOrientation(int)

getPointsCardinal

public int getPointsCardinal()
Returns the number of points. The default implementation returns 2. The object defines a polypoints of 2 points even if the method getLinkPoints returns 3 points. The reason is that we only want to edit 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 3 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.

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 three points, the points returned by the getConnectionPoints member function and the intermediate point for the angle.

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.