|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.draw2d.Figure
org.eclipse.draw2d.Shape
org.eclipse.draw2d.Polyline
org.eclipse.draw2d.PolylineConnection
org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx
public class PolylineConnectionEx
This is an extension of the PolylineConnection
class to support avoid obstructions, smoothness
and jump-links behavior.
Nested Class Summary | |
---|---|
protected class |
PolylineConnectionEx.JumpLink
Inner class for storing the specific JumpLink information. |
protected class |
PolylineConnectionEx.JumpLinkSet
Inner class for storing the set of JumpLink's associated with the polyline connection. |
Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure |
---|
Figure.FigureIterator, Figure.IdentitySearch |
Nested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure |
---|
IFigure.NoInsets |
Field Summary | |
---|---|
static int |
JUMPLINK_FLAG_ABOVE
Flag indicates whether the connection will attempt to "jump" other connection above it in the z-order. |
static int |
JUMPLINK_FLAG_ALL
Flag indicates whether the connection will attempt to "jump" all other connections regardless of z-order. |
static int |
JUMPLINK_FLAG_BELOW
Flag indicates whether the connection will attempt to "jump" other connection below it in the z-order. |
static int |
SMOOTH_LESS
Some smoothness |
static int |
SMOOTH_MORE
More exagerated smoothness |
static int |
SMOOTH_NONE
No smoothness |
static int |
SMOOTH_NORMAL
Normal smoothness |
Fields inherited from class org.eclipse.draw2d.Shape |
---|
lineStyle, lineWidth |
Fields inherited from class org.eclipse.draw2d.Figure |
---|
bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTip |
Fields inherited from interface org.eclipse.draw2d.Connection |
---|
PROPERTY_CONNECTION_ROUTER, PROPERTY_POINTS |
Fields inherited from interface org.eclipse.draw2d.IFigure |
---|
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS |
Constructor Summary | |
---|---|
PolylineConnectionEx()
|
Method Summary | |
---|---|
void |
addPoint(Point pt)
Add a point to the polyline connection. |
boolean |
containsPoint(int x,
int y)
Determine if the polyline connection contains a given point. |
protected ConnectionAnchor |
createAnchor(PrecisionPoint p)
Creates a slidable anchor at the specified point (from the ratio of the reference's coordinates and bounds of the figure |
protected ConnectionAnchor |
createConnectionAnchor(Point p)
Returns a new anchor for this node figure. |
protected ConnectionAnchor |
createDefaultAnchor()
Creates the default Slidable anchor with a reference point at the center of the figure's bounds |
void |
dirtyAllJumpLinks()
Dirty all connection jump links in the diagram |
int |
findLineSegIndexOfPoint(int x,
int y)
Calculate the line segment index for a given point. |
Rectangle |
getBounds()
Returns the bounds which holds all the points in this polyline connection. |
ConnectionAnchor |
getConnectionAnchor(java.lang.String terminal)
Given a string identifier, return the associated anchor for that identifier |
protected java.util.Hashtable |
getConnectionAnchors()
Returns the connectionAnchors. |
java.lang.String |
getConnectionAnchorTerminal(ConnectionAnchor c)
Dynamically allocates a new anchor if needed. |
Cursor |
getCursor()
Overriden to display special cursor when needed. |
PointList |
getPolygonPoints()
This method allows the implementing class to return a list of points that represent the polygon to be connected to. |
Rectangle |
getSimpleBounds()
Method getShallowBounds. |
protected double |
getSlidableAnchorArea()
Specifies how large the area of the figure's bounds where SlidableAnchor
will be created. |
int |
getSmoothness()
Gets the smoothness factor. |
PointList |
getSmoothPoints()
If the smooth factor is turned on, then calculate the approximated smooth polyline for display or other purposes. |
ConnectionAnchor |
getSourceConnectionAnchorAt(Point p)
Gets the source connection anchor at a given point on the figure. |
protected RotatableDecoration |
getSourceDecoration()
|
ConnectionAnchor |
getTargetConnectionAnchorAt(Point p)
Gets the target connection anchor at a given point on the figure. |
protected RotatableDecoration |
getTargetDecoration()
|
void |
insertPoint(Point pt,
int index)
Insert a point at the given index into the polyline connection. |
boolean |
isAvoidObstacleRouting()
Determines if this polyline connection is using avoid obstruction routing or not. |
boolean |
isClosestDistanceRouting()
Determines if this polyline connection is using closest distance routing or not. |
protected boolean |
isDefaultAnchorArea(PrecisionPoint p)
Checks whether the SlidableAnchor belongs to the area where the default anchor
must be created |
boolean |
isJumpLinksAngledIn()
Determines if the jump links are angled in or not. |
boolean |
isJumpLinksOnBottom()
Determines if the jump links are on the bottom of the polyline connection or not. |
boolean |
isJumpLinksSmooth()
Determines if the jump links are smooth or not. |
protected void |
outlineShape(Graphics g)
Override the figure method "outlineShape" to draw the actual polyline connection shape. |
void |
paintFigure(Graphics graphics)
Overriden to workaround bugzilla 105358 |
void |
refreshLine()
Provides a utility function for dirtying the jump links and repainting the line. |
void |
setForegroundColor(Color fg)
|
void |
setJumpLinks(boolean on)
Turns on or off the jump links functionality. |
void |
setJumpLinksStyles(int jumpType,
boolean curved,
boolean angleIn,
boolean onBottom)
Set the jump links styles associated with the jump links functionality. |
void |
setLineDash(int[] dashes)
Workaround for bugzilla 105358 |
void |
setLineWidth(int w)
Set the line width of the polyline connection. |
void |
setPoints(PointList points)
Sets the list of points to be used by this polyline connection. |
void |
setRoutingStyles(boolean closestDistance,
boolean avoidObstacles)
Set the overall routing styles for this polyline connection. |
void |
setSmoothness(int smooth)
Sets the smoothness factor of this Connection that is reflected when the polyline is rendered. |
void |
setSourceDecoration(RotatableDecoration dec)
|
void |
setSourceDecoration(RotatableDecoration dec,
ConnectionLocator locator)
Sets the decoration to be used at the start of the Connection . |
void |
setTargetDecoration(RotatableDecoration dec)
|
void |
setTargetDecoration(RotatableDecoration dec,
ConnectionLocator locator)
Sets the decoration to be used at the end of the Connection . |
boolean |
shouldJumpLinks()
Determines if this polyline connection should use the jump links methodology or not. |
Methods inherited from class org.eclipse.draw2d.PolylineConnection |
---|
addNotify, addRoutingListener, anchorMoved, getConnectionRouter, getRoutingConstraint, getSourceAnchor, getTargetAnchor, layout, removeNotify, removeRoutingListener, revalidate, setConnectionRouter, setRoutingConstraint, setSourceAnchor, setTargetAnchor |
Methods inherited from class org.eclipse.draw2d.Polyline |
---|
fillShape, getEnd, getPoints, getStart, isOpaque, primTranslate, removeAllPoints, removePoint, setEnd, setEndpoints, setPoint, setStart, setTolerance |
Methods inherited from class org.eclipse.draw2d.Shape |
---|
getLineStyle, getLineWidth, setFill, setFillXOR, setLineStyle, setOutline, setOutlineXOR, setXOR |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eclipse.draw2d.Connection |
---|
getPoints |
Field Detail |
---|
public static final int SMOOTH_NONE
public static final int SMOOTH_LESS
public static final int SMOOTH_NORMAL
public static final int SMOOTH_MORE
public static final int JUMPLINK_FLAG_BELOW
public static final int JUMPLINK_FLAG_ABOVE
public static final int JUMPLINK_FLAG_ALL
Constructor Detail |
---|
public PolylineConnectionEx()
Method Detail |
---|
public void refreshLine()
public void addPoint(Point pt)
addPoint
in class Polyline
public Rectangle getBounds()
getBounds
in interface IFigure
getBounds
in class PolylineConnection
public Rectangle getSimpleBounds()
public boolean containsPoint(int x, int y)
containsPoint
in interface IFigure
containsPoint
in class Polyline
x
- int value of the point to check containment ofy
- int value of the point to check containment of.
public int findLineSegIndexOfPoint(int x, int y)
x
- the x value in relative coordinatesy
- the y value in relative coordinates
public PointList getSmoothPoints()
PointList
that is a polyline approximation of a bezier curve calculated based
on the smoothness factor.public void insertPoint(Point pt, int index)
insertPoint
in class Polyline
protected void outlineShape(Graphics g)
outlineShape
in class Polyline
public void setLineWidth(int w)
setLineWidth
in class Polyline
public void setPoints(PointList points)
setPoints
in interface Connection
setPoints
in class Polyline
points
- New set of points.public void dirtyAllJumpLinks()
public final void setSmoothness(int smooth)
smooth
- the value is one of SMOOTH_NONE - no smoothing, SMOOTH_LESS - rounded edges,
SMOOTH_NORMAL - more curved look, SMOOTH_MORE - exagerated curving.public final int getSmoothness()
public final boolean isClosestDistanceRouting()
boolean
true
if it should be using closest distance routing,
false
public final boolean isAvoidObstacleRouting()
boolean
true
if it should be using avoid obstruction routing,
false
public void setRoutingStyles(boolean closestDistance, boolean avoidObstacles)
closestDistance
- boolean
true
if it should be using closest distance routing,
false
avoidObstacles
- boolean
true
if it should be using avoid obstruction routing,
false
public final boolean shouldJumpLinks()
boolean
true
if this connection should support jump links,
false
otherwise.public void setJumpLinks(boolean on)
on
- the boolean
true
if this connection should support jump links,
false
otherwise.public void setJumpLinksStyles(int jumpType, boolean curved, boolean angleIn, boolean onBottom)
jumpType
- value can be one of PolylineConnectionEx.JUMPLINK_FLAG_BELOW
,
PolylineConnectionEx.JUMPLINK_FLAG_ABOVE
or PolylineConnectionEx.JUMPLINK_FLAG_ALL
curved
- the boolean
indicating if true
the jump link should be curved (semi-circle)
or if false
it should be straight (rectangular).angleIn
- the boolean
if true
indicating the sides of the jump link are angled or
if false
then the sides of the jump link are straight.onBottom
- the boolean
true
it will be oriented on the bottom of the connection,
false
it will oriented on top.public final boolean isJumpLinksSmooth()
boolean
indicating if true
the jump link should be curved (semi-circle) or
if false
it should be straight (rectangular).public final boolean isJumpLinksAngledIn()
boolean
if true
indicating the sides of the jump link are angled or
if false
then the sides of the jump link are straight.public final boolean isJumpLinksOnBottom()
boolean
true
it will be oriented on the bottom of the connection,
false
it will oriented on top.public PointList getPolygonPoints()
IPolygonAnchorableFigure
getPolygonPoints
in interface IPolygonAnchorableFigure
public ConnectionAnchor getConnectionAnchor(java.lang.String terminal)
IAnchorableFigure
getConnectionAnchor
in interface IAnchorableFigure
terminal
- String
identifier associated with the anchor
ConnectionAnchor
that is associated with the given string.public java.lang.String getConnectionAnchorTerminal(ConnectionAnchor c)
IAnchorableFigure
getConnectionAnchorTerminal
in interface IAnchorableFigure
c
- the ConnectionAnchor
reference to an anchor associated with the
given point on the figure
String
that represents the anchor identifier.public ConnectionAnchor getSourceConnectionAnchorAt(Point p)
IAnchorableFigure
getSourceConnectionAnchorAt
in interface IAnchorableFigure
p
- Point
on the figure that gives a hint which anchor to return.
ConnectionAnchor
reference to an anchor associated with the given
point on the figure.public ConnectionAnchor getTargetConnectionAnchorAt(Point p)
IAnchorableFigure
getTargetConnectionAnchorAt
in interface IAnchorableFigure
p
- Point
on the figure that gives a hint which anchor to return.
ConnectionAnchor
reference to an anchor associated with the
given point on the figure.protected ConnectionAnchor createDefaultAnchor()
protected ConnectionAnchor createAnchor(PrecisionPoint p)
p
- - relative reference for the SlidableAnchor
SlidableAnchor
for this figure with relative reference at pprotected ConnectionAnchor createConnectionAnchor(Point p)
p
- Point
on the figure that gives a hint which anchor to return.
ConnectionAnchor
reference to an anchor associated with the
given point on the figure.protected boolean isDefaultAnchorArea(PrecisionPoint p)
SlidableAnchor
belongs to the area where the default anchor
must be created
p
-
boolean
true
if false
otherwiseprotected java.util.Hashtable getConnectionAnchors()
protected double getSlidableAnchorArea()
SlidableAnchor
will be created. The result number: 0<=result<=1
public void setForegroundColor(Color fg)
setForegroundColor
in interface IFigure
setForegroundColor
in class Figure
public void setSourceDecoration(RotatableDecoration dec, ConnectionLocator locator)
Connection
.
dec
- the new source decorationlocator
- the ConnectionLocator
that allows placement of the source
RotableDecoration
.public void setTargetDecoration(RotatableDecoration dec, ConnectionLocator locator)
Connection
.
dec
- the new target decorationlocator
- the ConnectionLocator
that allows placement of the target
RotableDecoration
.protected RotatableDecoration getTargetDecoration()
getTargetDecoration
in class PolylineConnection
protected RotatableDecoration getSourceDecoration()
getSourceDecoration
in class PolylineConnection
public void setTargetDecoration(RotatableDecoration dec)
setTargetDecoration
in class PolylineConnection
public void setSourceDecoration(RotatableDecoration dec)
setSourceDecoration
in class PolylineConnection
public void setLineDash(int[] dashes)
dashes
- int[]
array of dash lengthsGraphics.setLineDash(int[])
public void paintFigure(Graphics graphics)
paintFigure
in class Shape
public Cursor getCursor()
getCursor
in interface IFigure
getCursor
in class Figure
|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.