Draw2D v2.0

org.eclipse.draw2d
Class Polyline

java.lang.Object
  |
  +--org.eclipse.draw2d.Figure
        |
        +--org.eclipse.draw2d.Shape
              |
              +--org.eclipse.draw2d.Polyline
All Implemented Interfaces:
IFigure
Direct Known Subclasses:
Polygon, PolylineConnection, PolylineDecoration

public class Polyline
extends Shape

Provides for graphical lines comprised of Points.


Inner classes inherited from class org.eclipse.draw2d.Figure
Figure.FigureIterator
 
Inner classes inherited from class org.eclipse.draw2d.IFigure
IFigure.NoInsets
 
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.IFigure
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS
 
Constructor Summary
Polyline()
           
 
Method Summary
 void addPoint(Point pt)
          Adds the passed point to the Polyline.
 boolean containsPoint(int x, int y)
          Returns true if the point (x, y) is contained within this IFigures bounds.
protected  void fillShape(Graphics g)
           
 Rectangle getBounds()
          Returns the smallest rectangle completely enclosing the figure.
 Point getEnd()
          Returns the last point in the Polyline.
protected  PointList getPoints()
          Returns the points in this Polyline by reference.
 Point getStart()
          Returns the first point in the Polyline.
 void insertPoint(Point pt, int index)
          Inserts a given point at a specified index in the Polyline.
 boolean isOpaque()
          Returns the opaque state of this shape.
protected  void outlineShape(Graphics g)
           
 void primTranslate(int x, int y)
          Translates this figure's bounds, without firing a move.
 void removeAllPoints()
          Erases the Polyline and removes all of its Points.
 void removePoint(int index)
          Removes a point from the Polyline.
 void setEnd(Point end)
          Sets the end point of the Polyline
 void setEndpoints(Point start, Point end)
          Sets the points at both extremes of the Polyline
 void setLineWidth(int w)
          Sets the line width to be used by the shape.
 void setPoint(Point pt, int index)
          Sets the point at index to the Point pt.
 void setPoints(PointList points)
          Sets the list of points to be used by this polyline connection.
 void setStart(Point start)
          Sets the start point of the Polyline
protected  boolean useLocalCoordinates()
          Returns true if this figure uses local coordinates.
 
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, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getChildren, getClientArea, getClientArea, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getLocation, getMaximumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, isEnabled, isFocusTraversable, isMouseEventTarget, isRequestFocusEnabled, isValid, isValidationRoot, isVisible, layout, paint, paintBorder, paintChildren, paintClientArea, remove, removeAll, removeAncestorListener, removeFigureListener, removeFocusListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, 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, setUpdateManager, 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
 

Constructor Detail

Polyline

public Polyline()
Method Detail

addPoint

public void addPoint(Point pt)
Adds the passed point to the Polyline.
Parameters:
pt - The Point to be added to the Polyline.
Since:
2.0

containsPoint

public boolean containsPoint(int x,
                             int y)
Description copied from interface: IFigure
Returns true if the point (x, y) is contained within this IFigures bounds.
Overrides:
containsPoint in class Figure

fillShape

protected void fillShape(Graphics g)
Overrides:
fillShape in class Shape

getBounds

public Rectangle getBounds()
Description copied from interface: IFigure
Returns the smallest rectangle completely enclosing the figure. Implementation may return the Rectangle by reference. For this reason, callers of this method must not modify the returned Rectangle.
Overrides:
getBounds in class Figure

getEnd

public Point getEnd()
Returns the last point in the Polyline.
Since:
2.0

getPoints

protected PointList getPoints()
Returns the points in this Polyline by reference. If the returned list is modified, this Polyline must be informed by calling setPoints(PointList). Failure to do so will result in layout and paint problems.
Since:
2.0

getStart

public Point getStart()
Returns the first point in the Polyline.
Since:
2.0

insertPoint

public void insertPoint(Point pt,
                        int index)
Inserts a given point at a specified index in the Polyline.
Parameters:
pt - The point to be added
index - The position in the Polyline where the point is to be added.
Since:
2.0

isOpaque

public boolean isOpaque()
Description copied from class: Shape
Returns the opaque state of this shape.
Overrides:
isOpaque in class Shape
Following copied from class: org.eclipse.draw2d.Shape
Returns:
Returns false as shapes only draw themselves onto other figures, and generally dont have rectangular dimensions.

outlineShape

protected void outlineShape(Graphics g)
Overrides:
outlineShape in class Shape

primTranslate

public void primTranslate(int x,
                          int y)
Description copied from class: Figure
Translates this figure's bounds, without firing a move.
Overrides:
primTranslate in class Figure
Following copied from class: org.eclipse.draw2d.Figure
See Also:
Figure.translate(int, int)

removeAllPoints

public void removeAllPoints()
Erases the Polyline and removes all of its Points.
Since:
2.0

removePoint

public void removePoint(int index)
Removes a point from the Polyline.
Parameters:
index - The position of the point to be removed.
Since:
2.0

setEnd

public void setEnd(Point end)
Sets the end point of the Polyline
Parameters:
end - The point that will become the last point in the Polyline.
Since:
2.0

setEndpoints

public void setEndpoints(Point start,
                         Point end)
Sets the points at both extremes of the Polyline
Parameters:
start - The point to become the first point in the Polyline.
end - The point to become the last point in the Polyline.
Since:
2.0

setLineWidth

public void setLineWidth(int w)
Description copied from class: Shape
Sets the line width to be used by the shape.
Overrides:
setLineWidth in class Shape
Following copied from class: org.eclipse.draw2d.Shape
Parameters:
w - Width of the line to be used.

setPoint

public void setPoint(Point pt,
                     int index)
Sets the point at index to the Point pt. Calling this method results in a repaint. If you're going to set multiple Points, use setPoints(PointList).

setPoints

public void setPoints(PointList points)
Sets the list of points to be used by this polyline connection. Removes any previously existing points.
Parameters:
points - New set of points.
Since:
2.0

setStart

public void setStart(Point start)
Sets the start point of the Polyline
Parameters:
start - The point that will become the first point in the Polyline.
Since:
2.0

useLocalCoordinates

protected boolean useLocalCoordinates()
Description copied from class: Figure
Returns true if this figure uses local coordinates. This means its children are placed relative to this figure's top-left corner.
Overrides:
useLocalCoordinates in class Figure

Draw2D v2.0