Eclipse Draw2d
2.1

org.eclipse.draw2d
Class Shape

java.lang.Object
  |
  +--org.eclipse.draw2d.Figure
        |
        +--org.eclipse.draw2d.Shape
All Implemented Interfaces:
IFigure
Direct Known Subclasses:
Ellipse, Polyline, RectangleFigure, RoundedRectangle, Triangle

public abstract class Shape
extends Figure

Provides abstract support for a variety of shapes.


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
protected  int lineStyle
          The line style to be used for this shape's outline.
protected  int lineWidth
          The width of this shape's outline.
 
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
Shape()
          Default constructor.
 
Method Summary
protected abstract  void fillShape(Graphics graphics)
          Fills the interior of the shape with the background color.
 int getLineStyle()
          Returns the line style used to outline this shape.
 int getLineWidth()
          Returns the line width of this shape's outline.
 boolean isOpaque()
          Returns false as shapes only draw themselves onto other figures, and generally dont have rectangular dimensions.
protected abstract  void outlineShape(Graphics graphics)
          Outlines this shape using the foreground color.
 void paintFigure(Graphics graphics)
          Paints the shape.
 void setFill(boolean b)
          Sets whether this shape should fill its region or not.
 void setFillXOR(boolean b)
          Sets whether XOR based fill should be used by the shape.
 void setLineStyle(int s)
          Sets the style of line to be used by this shape.
 void setLineWidth(int w)
          Sets the line width to be used to outline the shape.
 void setOutline(boolean b)
          Sets whether the outline should be drawn for this shape.
 void setOutlineXOR(boolean b)
          Sets whether XOR based outline should be used for this shape.
 void setXOR(boolean b)
          Sets whether XOR based fill and XOR based outline should be used for this shape.
 
Methods inherited from class org.eclipse.draw2d.Figure
add, add, add, add, addAncestorListener, addFigureListener, addFocusListener, addKeyListener, addListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, 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, primTranslate, 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, useLocalCoordinates, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lineWidth

protected int lineWidth
The width of this shape's outline.


lineStyle

protected int lineStyle
The line style to be used for this shape's outline.

Constructor Detail

Shape

public Shape()
Default constructor.

Since:
2.0
Method Detail

fillShape

protected abstract void fillShape(Graphics graphics)
Fills the interior of the shape with the background color.

Parameters:
graphics - the graphics object

getLineStyle

public int getLineStyle()
Returns the line style used to outline this shape.

Returns:
the line style

getLineWidth

public int getLineWidth()
Returns the line width of this shape's outline.

Returns:
the line width

isOpaque

public boolean isOpaque()
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 Figure
Since:
2.0
See Also:
Figure.isOpaque()

outlineShape

protected abstract void outlineShape(Graphics graphics)
Outlines this shape using the foreground color.

Parameters:
graphics - the graphics object

paintFigure

public void paintFigure(Graphics graphics)
Paints the shape. Each shape has an outline to draw, and a region to fill within that outline. Disabled shapes must visually depict the disabled state.

Overrides:
paintFigure in class Figure
Parameters:
graphics - The Graphics used to paint
See Also:
Figure.paintFigure(Graphics)

setFill

public void setFill(boolean b)
Sets whether this shape should fill its region or not. It repaints this figure.

Parameters:
b - fill state
Since:
2.0

setFillXOR

public void setFillXOR(boolean b)
Sets whether XOR based fill should be used by the shape. It repaints this figure.

Parameters:
b - XOR fill state
Since:
2.0

setLineWidth

public void setLineWidth(int w)
Sets the line width to be used to outline the shape.

Parameters:
w - the new width
Since:
2.0

setLineStyle

public void setLineStyle(int s)
Sets the style of line to be used by this shape.

Parameters:
s - the new line style
Since:
2.0

setOutline

public void setOutline(boolean b)
Sets whether the outline should be drawn for this shape.

Parameters:
b - true if the shape should be outlined
Since:
2.0

setOutlineXOR

public void setOutlineXOR(boolean b)
Sets whether XOR based outline should be used for this shape.

Parameters:
b - true if the outline should be XOR'ed
Since:
2.0

setXOR

public void setXOR(boolean b)
Sets whether XOR based fill and XOR based outline should be used for this shape.

Parameters:
b - true if the outline and fill should be XOR'ed
Since:
2.0

Eclipse Draw2d
2.1

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