Package org.eclipse.draw2d

# Class Polyline

java.lang.Object
org.eclipse.draw2d.Figure
org.eclipse.draw2d.Shape
org.eclipse.draw2d.AbstractPointListShape
org.eclipse.draw2d.Polyline

All Implemented Interfaces:
  `IFigure`

Direct Known Subclasses:
  `Polygon`, `PolylineConnection`, `PolylineDecoration`

public class Polyline extends AbstractPointListShape
Renders a `PointList` as a series of line segments. A Polyline figure should be positioned by manipulating its points, NOT by calling `Figure.setBounds(Rectangle)`.

A polyline's bounds will be calculated automatically based on its PointList. The bounds will be the smallest Rectangle large enough to render the line properly. Children should not be added to a Polyline and will not affect the bounds calculation.

## Nested Class Summary

## Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure

`Figure.FigureIterator, Figure.IdentitySearch, Figure.ReverseFigureChildrenIterator`

## Nested classes/interfaces inherited from interface 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

Constructors
Constructor
Description
`Polyline()`

## Method Summary

Modifier and Type
Method
Description
`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.
`boolean`
`isOpaque()`
Returns `true` if this IFigure is opaque.
`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`
`repaint()`
Repaints this IFigure.
`void`
`setLineWidth(int w)`
Sets the line width to be used to outline the shape.
`void`
`setPoints(PointList points)`
Sets the list of points to be used by this polyline connection.
`void`
`setTolerance(int tolerance)`
Sets the tolerance
`protected boolean`
`shapeContainsPoint(int x, int y)`
Returns `true` if the point `(x, y)` is contained within this figure.

### Methods inherited from class org.eclipse.draw2d.AbstractPointListShape

`addPoint, childrenContainsPoint, getEnd, getPoints, getStart, insertPoint, removePoint, setEnd, setEndpoints, setPoint, setStart`

### Methods inherited from class org.eclipse.draw2d.Shape

`getAlpha, getAntialias, getLineAttributes, getLineCap, getLineDash, getLineDashOffset, getLineJoin, getLineMiterLimit, getLineStyle, getLineWidth, getLineWidthFloat, paintFigure, setAlpha, setAlpha, setAntialias, setAntialias, setFill, setFillXOR, setLineAttributes, setLineCap, setLineDash, setLineDashOffset, setLineJoin, setLineMiterLimit, setLineStyle, setLineWidthFloat, setOutline, setOutlineXOR, setXOR`

### Methods inherited from class org.eclipse.draw2d.Figure

`add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getChildren, getChildrenRevIterable, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getListenersIterable, getLocalBackgroundColor, getLocalFont, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, handleMouseWheelScrolled, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, layout, optimizeClip, paint, paintBorder, paintChildren, paintClientArea, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, 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, useDoublePrecision, useLocalCoordinates, validate`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### Polyline

public Polyline()

## Method Details

### 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 `AbstractPointListShape`
Parameters:
  `x` - The X coordinate
  `y` - The Y coordinate
Returns:
  `true` if the point (x,y) is contained in this IFigure's bounds
See Also:
  - `IFigure.containsPoint(int, int)`

### shapeContainsPoint

protected boolean shapeContainsPoint(int x, int y)
Description copied from class: `AbstractPointListShape`
Returns `true` if the point `(x, y)` is contained within this figure.

Specified by:
  `shapeContainsPoint` in class `AbstractPointListShape`
Parameters:
  `x` - The X coordinate
  `y` - The Y coordinate
Returns:
  `true` if the point (x,y) is contained in this figure

### 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()`

### isOpaque

public boolean isOpaque()
Description copied from interface: `IFigure`
Returns `true` if this IFigure is opaque.

Specified by:
  `isOpaque` in interface `IFigure`
Overrides:
  `isOpaque` in class `Figure`
Returns:
  `false` because Polyline's aren't filled
See Also:
  - `IFigure.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`.

Overrides:
  `removeAllPoints` in class `AbstractPointListShape`
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)`

### setPoints

public void setPoints(PointList points)
Sets the list of points to be used by this polyline connection. Removes any previously existing points. The polyline will hold onto the given list by reference.

Overrides:
  `setPoints` in class `AbstractPointListShape`
Parameters:
  `points` - new set of points
Since:
  2.0

### setTolerance

public void setTolerance(int tolerance)
Sets the tolerance

Parameters:
  `tolerance` - the new tolerance value of the Polyline

### repaint

public void repaint()
Description copied from interface: `IFigure`
Repaints this IFigure.

Specified by:
  `repaint` in interface `IFigure`
Overrides:
  `repaint` in class `Figure`
See Also:
  - `IFigure.repaint()`