ilog.views.gantt.graphic
Class IlvConstraintGraphic

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.IlvLinkImage
          extended by ilog.views.gantt.graphic.IlvConstraintGraphic
All Implemented Interfaces:
IlvPolyPointsInterface, IlvPersistentObject, Transferable, Serializable

public class IlvConstraintGraphic
extends IlvLinkImage

The IlvConstraintGraphic class is used to represent constraints in an IlvGanttSheet.

See Also:
Serialized Form

Field Summary
static int BOUNDING_BOX_CONNECTION
          Indicates whether the link points should be computed from the bounding boxes of the associated activity graphics.
static float DEFAULT_HORIZONTAL_EXTREMITY_SEGMENT_LENGTH
          Defines the default length of fixed horizontal segments of the link in view pixels.
static float DEFAULT_VERTICAL_EXTREMITY_SEGMENT_LENGTH
          Defines the default length of fixed vertical segments of the link.
static int TIME_INTERVAL_CONNECTION
          Indicates whether the link points should be computed from the time intervals of the associated activities.
 
Constructor Summary
IlvConstraintGraphic()
          Creates an IlvConstraintGraphic.
IlvConstraintGraphic(IlvActivityGraphic from, IlvActivityGraphic to, IlvConstraint constraint)
          Creates an IlvConstraintGraphic.
 
Method Summary
 boolean allowsPointInsertion()
          Indicates whether insertion of intermediate points is allowed.
 boolean allowsPointRemoval()
          Indicates whether removal of intermediate points is allowed.
 IlvGraphic copy()
          Copies the object.
 void draw(Graphics dst, IlvTransformer t)
          Overrides the draw method so that if one of the associated nodes is not visible then this function will not draw the link.
 float getArrowSize()
          Returns the size of the arrow in view coordinates.
protected  float getArrowSize(float lineWidth, IlvTransformer t)
          Returns the size of the arrow for the corresponding IlvTransformer and lineWidth.
 void getConnectionPoints(IlvPoint src, IlvPoint dst, IlvTransformer t)
          Computes the origin and destination points to draw the link.
 int getConnectionType()
          Returns the link connection type.
 IlvConstraint getConstraint()
          Returns the associated constraint of the graphic.
 float getHorizontalExtremitySegmentLength()
          Returns the length of fixed horizontal segments of the link in view pixels.
 IlvPoint[] getLinkPoints(IlvTransformer t)
          Returns the points that define the shape of the link.
 IlvPoint getPointAt(int index, IlvTransformer t)
          Returns the point at a specified index.
 int getPointsCardinal()
          Returns the number of editable points.
 JPopupMenu getPopupMenu(IlvPoint p, IlvTransformer t, IlvManagerView view, IlvPopupMenuManager popupManager)
          Returns the Swing popup menu to display when the popup menu is triggered while the mouse pointer is at a specified location inside the constraint graphic object.
 String getToolTipText(IlvPoint p, IlvTransformer t)
          Returns the tool tip text to display when the mouse pointer is at a specified location inside the constraint graphic.
 boolean isVisible()
          Returns true if the link is visible.
 IlvSelection makeSelection()
          Creates a selection object for the constraint graphic.
 void setArrowSize(float arrowSize)
          Sets the size of the arrow in view coordinates.
 void setConnectionType(int type)
          Sets the link connection type.
 void setConstraint(IlvConstraint constraint)
          Sets the associated constraint of the graphic.
 void setHorizontalExtremitySegmentLength(float length)
          Sets the length of fixed horizontal segments of the link in view pixels.
 boolean zoomable()
          Returns true if the object is zoomable, and false otherwise.
 
Methods inherited from class ilog.views.IlvLinkImage
allowsPointMove, applyTransform, arrowBBox, boundingBox, contains, drawArrow, finalize, getConnectionReferencePoint, getEndCap, getForeground, getFrom, getFromBoundingBox, getFromTransformer, getLineJoin, getLineStyle, getLineWidth, getLineWidth, getLinkConnectorConnectionPoint, getLocalTransformerOf, getMaximumLineWidth, getOpposite, getTo, getToBoundingBox, getToTransformer, getVisibleFrom, getVisibleTo, insertPoint, isOriented, isPersistent, isSpline, movePoint, pointsInBBox, removePoint, setEndCap, setForeground, setFrom, setIntermediateLinkPoints, setLineJoin, setLineStyle, setLineWidth, setMaximumLineWidth, setOriented, setTo, write
 
Methods inherited from class ilog.views.IlvGraphic
addActionListener, addNamedPropertyListener, boundingBox, getAndAssociateObjectInteractor, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getIntersectionWithOutline, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenuName, getProperty, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, hasProperty, inside, intersects, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isSelectable, 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

DEFAULT_HORIZONTAL_EXTREMITY_SEGMENT_LENGTH

public static final float DEFAULT_HORIZONTAL_EXTREMITY_SEGMENT_LENGTH
Defines the default length of fixed horizontal segments of the link in view pixels. The segments of the horizontal extremity are used for leading to or departing from the linked activity graphics. The default value is 10.

Since:
JViews 3.5
See Also:
getHorizontalExtremitySegmentLength(), setHorizontalExtremitySegmentLength(float), Constant Field Values

DEFAULT_VERTICAL_EXTREMITY_SEGMENT_LENGTH

public static final float DEFAULT_VERTICAL_EXTREMITY_SEGMENT_LENGTH
Defines the default length of fixed vertical segments of the link. The default value is 10.

Since:
JViews 3.5
See Also:
Constant Field Values

TIME_INTERVAL_CONNECTION

public static final int TIME_INTERVAL_CONNECTION
Indicates whether the link points should be computed from the time intervals of the associated activities.

See Also:
getConnectionType(), setConnectionType(int), Constant Field Values

BOUNDING_BOX_CONNECTION

public static final int BOUNDING_BOX_CONNECTION
Indicates whether the link points should be computed from the bounding boxes of the associated activity graphics.

See Also:
getConnectionType(), setConnectionType(int), Constant Field Values
Constructor Detail

IlvConstraintGraphic

public IlvConstraintGraphic()
Creates an IlvConstraintGraphic. A constraint graphic that is created with this constructor can only be used to replace an existing constraint graphic in the Gantt sheet.

Since:
JViews 5.5

IlvConstraintGraphic

public IlvConstraintGraphic(IlvActivityGraphic from,
                            IlvActivityGraphic to,
                            IlvConstraint constraint)
Creates an IlvConstraintGraphic.

Parameters:
from - The activity graphic from which the link starts.
to - The activity graphic to which the link points.
constraint - Defines the type of the link.
Since:
JViews 3.5
Method Detail

getConstraint

public IlvConstraint getConstraint()
Returns the associated constraint of the graphic.


setConstraint

public void setConstraint(IlvConstraint constraint)
Sets the associated constraint of the graphic.

Parameters:
constraint - The constraint.
Since:
JViews 5.5

getHorizontalExtremitySegmentLength

public float getHorizontalExtremitySegmentLength()
Returns the length of fixed horizontal segments of the link in view pixels. The horizontal extremity segments are used for leading to or departing from the linked activity graphics. The default value is 10.

Since:
JViews 3.5
See Also:
setHorizontalExtremitySegmentLength(float)

setHorizontalExtremitySegmentLength

public void setHorizontalExtremitySegmentLength(float length)
Sets the length of fixed horizontal segments of the link in view pixels. The horizontal extremity segments are used for leading to or departing from the linked activity graphics.

Since:
JViews 3.5
See Also:
getHorizontalExtremitySegmentLength()

getConnectionPoints

public void getConnectionPoints(IlvPoint src,
                                IlvPoint dst,
                                IlvTransformer t)
Computes the origin and destination points 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)

getPointsCardinal

public int getPointsCardinal()
Returns the number of editable points. This method does not return the number of link points. The default implementation returns 2.

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 are 0 or 1 because the object defines a polypoint of 2 points even if the method getLinkPoints returns more than 2 points. This is because only the extremity points are to be edited.

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.

getLinkPoints

public IlvPoint[] getLinkPoints(IlvTransformer t)
Returns the points that define the shape of the link.

This method calls the getConnectionPoints member function to compute the points. It may return 2, 4, or 6 points depending on the position of the two connected activity graphics.

Overrides:
getLinkPoints in class IlvLinkImage

draw

public void draw(Graphics dst,
                 IlvTransformer t)
Overrides the draw method so that if one of the associated nodes is not visible then this function will not draw the link.

Overrides:
draw in class IlvLinkImage
Parameters:
dst - The destination Graphics.
t - The transformation used to draw the object.
See Also:
IlvGraphic.boundingBox(ilog.views.IlvTransformer), IlvGraphic.zoomable(), IlvGraphic

allowsPointInsertion

public boolean allowsPointInsertion()
Indicates whether insertion of intermediate points is allowed. This implementation always returns false.

Specified by:
allowsPointInsertion in interface IlvPolyPointsInterface
Overrides:
allowsPointInsertion in class IlvLinkImage
Returns:
true if the insertion of intermediate points is allowed and false otherwise.
See Also:
IlvLinkImage.insertPoint(int, float, float, ilog.views.IlvTransformer)

allowsPointRemoval

public boolean allowsPointRemoval()
Indicates whether removal of intermediate points is allowed. This implementation always returns false.

Specified by:
allowsPointRemoval in interface IlvPolyPointsInterface
Overrides:
allowsPointRemoval in class IlvLinkImage
Returns:
true if the removal of intermediate points is allowed and false otherwise.
See Also:
IlvLinkImage.removePoint(int, ilog.views.IlvTransformer)

isVisible

public boolean isVisible()
Returns true if the link is visible. The link is considered not visible if one of the associated nodes is not visible.

Overrides:
isVisible in class IlvGraphic
Returns:
true if this graphic object is visible.
See Also:
IlvGraphic.setVisible(boolean), IlvGraphic.setSelectable(boolean), IlvGraphic.setMovable(boolean), IlvGraphic.setEditable(boolean)

zoomable

public boolean zoomable()
Returns true if the object is zoomable, and false otherwise. Constraint links are non-zoomable and this method always returns false.

Overrides:
zoomable in class IlvLinkImage
See Also:
IlvGraphic.zoomable(), IlvLinkConnector.zoomable()

getArrowSize

protected float getArrowSize(float lineWidth,
                             IlvTransformer t)
Returns the size of the arrow for the corresponding IlvTransformer and lineWidth. This implementation calls getArrowSize(). If you have set a size by calling the setArrowSize(float) method, then that size is returned. Otherwise, a value proportional to the horizontalExtremitySegmentLength: horizontalExtremitySegmentLength/3 is returned. Since this method returns a size that is not proportional to the transformer zoom factor, the zoomable() method returns false.

Overrides:
getArrowSize in class IlvLinkImage
Parameters:
lineWidth - The line width in manager coordinates used to draw the object. This implementation ignores this parameter.
t - The transformer used to draw the object. This implementation ignores this parameter.
Returns:
The size of the arrow for the corresponding t and lineWidth.
Since:
JViews 6.0
See Also:
IlvLinkImage.getLineWidth()

getArrowSize

public float getArrowSize()
Returns the size of the arrow in view coordinates. If you have set a size by calling the setArrowSize(float) method, then that size is returned. Otherwise, this implementation returns a value proportional to the horizontalExtremitySegmentLength: horizontalExtremitySegmentLength/3.

Since:
JViews 3.5
See Also:
getArrowSize(float,IlvTransformer)

setArrowSize

public void setArrowSize(float arrowSize)
Sets the size of the arrow in view coordinates. The default arrow size is proportional to the horizontalExtremitySegmentLength: horizontalExtremitySegmentLength/3.

Parameters:
arrowSize - The arrow size in view coordinates.
Since:
JViews 6.0
See Also:
getArrowSize()

getConnectionType

public int getConnectionType()
Returns the link connection type. The default value is TIME_INTERVAL_CONNECTION.

Returns:
TIME_INTERVAL_CONNECTION if the link points are computed from the time intervals of the associated activities or BOUNDING_BOX_CONNECTION if the link points are computed from the bounding boxes of the associated activity graphics.
See Also:
setConnectionType(int)

setConnectionType

public void setConnectionType(int type)
Sets the link connection type.

Parameters:
type - The connection type. The value must be either TIME_INTERVAL_CONNECTION, to indicate that the link points are computed from the time intervals of the associated activities, or BOUNDING_BOX_CONNECTION, to indicate that the link points are computed from the bounding boxes of the associated activity graphics.
See Also:
getConnectionType()

makeSelection

public IlvSelection makeSelection()
Creates a selection object for the constraint graphic. This method creates an instance of IlvLinkImageSelection.

Overrides:
makeSelection in class IlvLinkImage
See Also:
IlvLinkImageSelection

getToolTipText

public String getToolTipText(IlvPoint p,
                             IlvTransformer t)
Returns the tool tip text to display when the mouse pointer is at a specified location inside the constraint graphic. If a tool tip string has been set by calling the IlvGraphic.setToolTipText(String) method, then that string is returned. Otherwise, this method returns a default HTML string that contains the type of the constraint, the name of the constraint's "from" activity, and the name of the constraint's "to" activity on separate lines.

Overrides:
getToolTipText in class IlvGraphic
Parameters:
p - The location of the mouse (in view coordinates).
t - The transformer of the manager view in which the tool tip is about to be displayed.
Returns:
The tool tip at point p for transformation t, or null if no tool tip should be displayed.
Since:
JViews 3.5
See Also:
IlvGraphic, IlvGraphic.getToolTipText(), IlvGraphic.setToolTipText(String)

getPopupMenu

public JPopupMenu getPopupMenu(IlvPoint p,
                               IlvTransformer t,
                               IlvManagerView view,
                               IlvPopupMenuManager popupManager)
Returns the Swing popup menu to display when the popup menu is triggered while the mouse pointer is at a specified location inside the constraint graphic object.

This method can return null to turn off the popup menu for the constraint graphic object.

Note that you must enable the popup menu mechanism for the manager view by calling the method IlvGanttSheet.setPopupMenusEnabled(boolean).

Overrides:
getPopupMenu in class IlvGraphic
Parameters:
p - The location of the mouse (in view coordinates).
t - The transformer that converts the coordinate system of this object (the manager coordinates) into the coordinate system of the manager view in which the tool tip is about to be displayed (the view coordinates).
view - The manager view that triggered the popup menu.
popupManager - The popup menu manager.
Returns:
The Swing popup menu, which can be null.
Since:
JViews 7.5
See Also:
IlvGraphic, IlvPopupMenuManager.registerView(ilog.views.IlvManagerView), IlvGraphic.getPopupMenu()

copy

public IlvGraphic copy()
Copies the object. An instance of IlvConstraintGraphic cannot be copied with the copy method. This method returns null.

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


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