Eclipse Draw2d
2.1

org.eclipse.draw2d
Class PolylineConnection

java.lang.Object
  |
  +--org.eclipse.draw2d.Figure
        |
        +--org.eclipse.draw2d.Shape
              |
              +--org.eclipse.draw2d.Polyline
                    |
                    +--org.eclipse.draw2d.PolylineConnection
All Implemented Interfaces:
AnchorListener, Connection, IFigure

public class PolylineConnection
extends Polyline
implements Connection, AnchorListener

Connection based on polyline. The layout of the connection is handled by routers.


Nested Class Summary
 
Nested classes inherited from class org.eclipse.draw2d.Figure
Figure.FigureIterator
 
Nested classes inherited from class org.eclipse.draw2d.IFigure
IFigure.NoInsets
 
Field Summary
 
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
PolylineConnection()
           
 
Method Summary
 void addNotify()
          Hooks the source and target anchors.
 void anchorMoved(ConnectionAnchor anchor)
          Called by the anchors of this connection when they have moved, revalidating this polyline connection.
 Rectangle getBounds()
          Returns the bounds which holds all the points in this polyline connection.
 ConnectionRouter getConnectionRouter()
          Returns the ConnectionRouter used to layout this connection.
 Object getRoutingConstraint()
          Returns this connection's routing constraint from its connection router.
 ConnectionAnchor getSourceAnchor()
          Returns the ConnectionAnchor at the source end of this Connection.
protected  RotatableDecoration getSourceDecoration()
           
 ConnectionAnchor getTargetAnchor()
          Returns the ConnectionAnchor at the target end of this Connection.
protected  RotatableDecoration getTargetDecoration()
           
 void layout()
          Layouts this polyline.
 void removeNotify()
          Called just before the receiver is being removed from its parent.
 void setConnectionRouter(ConnectionRouter cr)
          Sets the connection router which handles the layout of this polyline.
 void setRoutingConstraint(Object cons)
          Sets the routing constraint for this connection.
 void setSourceAnchor(ConnectionAnchor anchor)
          Sets the anchor to be used at the start of this polyline connection.
 void setSourceDecoration(RotatableDecoration dec)
          Sets the decoration to be used at the start of the Connection.
 void setTargetAnchor(ConnectionAnchor anchor)
          Sets the anchor to be used at the end of the polyline connection.
 void setTargetDecoration(RotatableDecoration dec)
          Sets the decoration to be used at the end of the Connection.
 
Methods inherited from class org.eclipse.draw2d.Polyline
addPoint, containsPoint, fillShape, getEnd, getPoints, getStart, insertPoint, isOpaque, outlineShape, primTranslate, removeAllPoints, removePoint, setEnd, setEndpoints, setLineWidth, setPoint, setPoints, setStart, useLocalCoordinates
 
Methods inherited from class org.eclipse.draw2d.Shape
getLineStyle, getLineWidth, paintFigure, setFill, setFillXOR, setLineStyle, setOutline, setOutlineXOR, setXOR
 
Methods inherited from class org.eclipse.draw2d.Figure
add, add, add, add, addAncestorListener, addFigureListener, addFocusListener, addKeyListener, addListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getChildren, getClientArea, getClientArea, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getLocalBackgroundColor, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isEnabled, isFocusTraversable, isMouseEventTarget, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, paint, paintBorder, paintChildren, paintClientArea, remove, removeAll, removeAncestorListener, removeFigureListener, removeFocusListener, removeKeyListener, removeListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, validate
 
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, setPoints
 
Methods inherited from interface org.eclipse.draw2d.IFigure
add, add, add, add, addAncestorListener, addFigureListener, addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, getBackgroundColor, getBorder, getChildren, getClientArea, getClientArea, getCursor, getFont, getForegroundColor, getInsets, getLayoutManager, getLocalBackgroundColor, getLocalForegroundColor, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isEnabled, isFocusTraversable, isOpaque, isRequestFocusEnabled, isShowing, isVisible, paint, remove, removeAncestorListener, removeFigureListener, removeFocusListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setConstraint, setCursor, setEnabled, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, validate
 

Constructor Detail

PolylineConnection

public PolylineConnection()
Method Detail

addNotify

public void addNotify()
Hooks the source and target anchors.

Specified by:
addNotify in interface IFigure
Overrides:
addNotify in class Figure
See Also:
Figure.addNotify()

anchorMoved

public void anchorMoved(ConnectionAnchor anchor)
Called by the anchors of this connection when they have moved, revalidating this polyline connection.

Specified by:
anchorMoved in interface AnchorListener
Parameters:
anchor - the anchor that moved

getBounds

public Rectangle getBounds()
Returns the bounds which holds all the points in this polyline connection. Returns any previously existing bounds, else calculates by unioning all the children's dimensions.

Specified by:
getBounds in interface IFigure
Overrides:
getBounds in class Polyline
Returns:
the bounds

getConnectionRouter

public ConnectionRouter getConnectionRouter()
Returns the ConnectionRouter used to layout this connection. Will not return null.

Specified by:
getConnectionRouter in interface Connection
Returns:
this connection's router

getRoutingConstraint

public Object getRoutingConstraint()
Returns this connection's routing constraint from its connection router. May return null.

Specified by:
getRoutingConstraint in interface Connection
Returns:
the connection's routing constraint

getSourceAnchor

public ConnectionAnchor getSourceAnchor()
Description copied from interface: Connection
Returns the ConnectionAnchor at the source end of this Connection.

Specified by:
getSourceAnchor in interface Connection
Returns:
the anchor at the start of this polyline connection (may be null)

getSourceDecoration

protected RotatableDecoration getSourceDecoration()
Returns:
the source decoration (may be null)

getTargetAnchor

public ConnectionAnchor getTargetAnchor()
Description copied from interface: Connection
Returns the ConnectionAnchor at the target end of this Connection.

Specified by:
getTargetAnchor in interface Connection
Returns:
the anchor at the end of this polyline connection (may be null)

getTargetDecoration

protected RotatableDecoration getTargetDecoration()
Returns:
the target decoration (may be null)
Since:
2.0

layout

public void layout()
Layouts this polyline. If the start and end anchors are present, the connection router is used to route this, after which it is laid out. It also fires a moved method.

Overrides:
layout in class Figure

removeNotify

public void removeNotify()
Called just before the receiver is being removed from its parent. Results in removing itself from the connection router.

Specified by:
removeNotify in interface IFigure
Overrides:
removeNotify in class Figure
Since:
2.0

setConnectionRouter

public void setConnectionRouter(ConnectionRouter cr)
Sets the connection router which handles the layout of this polyline. Generally set by the parent handling the polyline connection.

Specified by:
setConnectionRouter in interface Connection
Parameters:
cr - the connection router

setRoutingConstraint

public void setRoutingConstraint(Object cons)
Sets the routing constraint for this connection.

Specified by:
setRoutingConstraint in interface Connection
Parameters:
cons - the constraint

setSourceAnchor

public void setSourceAnchor(ConnectionAnchor anchor)
Sets the anchor to be used at the start of this polyline connection.

Specified by:
setSourceAnchor in interface Connection
Parameters:
anchor - the new source anchor

setSourceDecoration

public void setSourceDecoration(RotatableDecoration dec)
Sets the decoration to be used at the start of the Connection.

Parameters:
dec - the new source decoration
Since:
2.0

setTargetAnchor

public void setTargetAnchor(ConnectionAnchor anchor)
Sets the anchor to be used at the end of the polyline connection. Removes this listener from the old anchor and adds it to the new anchor.

Specified by:
setTargetAnchor in interface Connection
Parameters:
anchor - the new target anchor

setTargetDecoration

public void setTargetDecoration(RotatableDecoration dec)
Sets the decoration to be used at the end of the Connection.

Parameters:
dec - the new target decoration

Eclipse Draw2d
2.1

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.