Eclipse Draw2d
2.1

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.


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.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 IFigure's bounds.
protected  void fillShape(Graphics g)
          Null implementation for a line.
 Rectangle getBounds()
          Returns the smallest rectangle completely enclosing the figure.
 Point getEnd()
          Returns the last point in the Polyline.
 PointList getPoints()
          Returns the points in this Polyline by reference.
 Point getStart()
           
 void insertPoint(Point pt, int index)
          Inserts a given point at a specified index in the Polyline.
 boolean isOpaque()
          Returns false as shapes only draw themselves onto other figures, and generally dont have rectangular dimensions.
protected  void outlineShape(Graphics g)
          Outlines this shape using the foreground color.
 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 to outline 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, 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, layout, paint, paintBorder, paintChildren, paintClientArea, remove, removeAll, removeAncestorListener, removeFigureListener, removeFocusListener, removeKeyListener, 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, 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 IFigure's bounds.

Specified by:
containsPoint in interface IFigure
Overrides:
containsPoint in class Figure
See Also:
IFigure.containsPoint(int, int)

fillShape

protected void fillShape(Graphics g)
Null implementation for a line.

Specified by:
fillShape in class Shape
Parameters:
g - the graphics object
See Also:
Shape.fillShape(Graphics)

getBounds

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

Specified by:
getBounds in interface IFigure
Overrides:
getBounds in class Figure
Returns:
The bounds of this Figure
See Also:
IFigure.getBounds()

getEnd

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

Returns:
the last point
Since:
2.0

getPoints

public 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.

Returns:
this Polyline's points
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 false as shapes only draw themselves onto other figures, and generally dont have rectangular dimensions.

Specified by:
isOpaque in interface IFigure
Overrides:
isOpaque in class Shape
Returns:
false because Polyline's aren't filled
See Also:
Figure.isOpaque()

outlineShape

protected void outlineShape(Graphics g)
Description copied from class: Shape
Outlines this shape using the foreground color.

Specified by:
outlineShape in class Shape
Parameters:
g - the graphics object
See Also:
Shape.outlineShape(Graphics)

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
Parameters:
x - The amount to translate horizontally
y - The amount to translate vertically
See Also:
Figure.primTranslate(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 to outline the shape.

Overrides:
setLineWidth in class Shape
Parameters:
w - the new width
See Also:
Shape.setLineWidth(int)

setPoint

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

Parameters:
pt - the point
index - the index

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
Returns:
true if this Figure uses local coordinates
See Also:
Figure.useLocalCoordinates()

Eclipse Draw2d
2.1

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