Package org.eclipse.draw2d
Class Shape
java.lang.Object
org.eclipse.draw2d.Figure
org.eclipse.draw2d.Shape
- All Implemented Interfaces:
IFigure
- Direct Known Subclasses:
AbstractPointListShape,Ellipse,RectangleFigure,RoundedRectangle,Triangle
Provides abstract support for a variety of shapes.
When customizing shapes, you shouldn't override paintFigure(). Override fillShape() and outlineShape() methods instead.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure
Figure.FigureIterator, Figure.IdentitySearch, Figure.ReverseFigureChildrenIteratorNested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure
IFigure.NoInsets -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intDeprecated.protected intDeprecated.UsesetLineWidth(int)orsetLineWidthFloat(float)instead.Fields inherited from class org.eclipse.draw2d.Figure
bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTipFields inherited from interface org.eclipse.draw2d.IFigure
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidFills the interior of the shape with the background color.getAlpha()Returns line attributes used when drawing this shape.intReturns the line cap style of this shape's outline.float[]Returns the line dash style of this shape's outline.floatReturns the line dash offset of this shape's outline.intReturns the line join style of this shape's outline.floatReturns the line dash miter limit of this shape's outline.intReturns the line style of this shape's outline.intReturns the line width of this shape's outline.floatReturns the line width of this shape's outline.protected abstract voidoutlineShape(Graphics graphics) Outlines this shape using the foreground color.voidpaintFigure(Graphics graphics) Paints the shape.voidsetAlpha(int value) voidvoidsetAntialias(int value) voidsetAntialias(Integer value) voidsetFill(boolean b) Sets whether this shape should fill its region or not.voidsetFillXOR(boolean b) Sets whether XOR based fill should be used by the shape.voidSets all line attributes at once.voidsetLineCap(int cap) Sets the line cap style of this shape's outline.voidsetLineDash(float[] dash) Sets the line dash style of this shape's outline.voidsetLineDashOffset(float dashOffset) Sets the line dash offset of this shape's outline.voidsetLineJoin(int join) Sets the line join style of this shape's outline.voidsetLineMiterLimit(float miterLimit) Sets the line dash miter limit of this shape's outline.voidsetLineStyle(int style) Sets the line style of this shape's outline.voidsetLineWidth(int w) Sets the line width to be used to outline the shape.voidsetLineWidthFloat(float value) Sets the line width of this shape's outline.voidsetOutline(boolean b) Sets whether the outline should be drawn for this shape.voidsetOutlineXOR(boolean b) Sets whether XOR based outline should be used for this shape.voidsetXOR(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, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, 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, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, layout, optimizeClip, paint, paintBorder, paintChildren, paintClientArea, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, 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, useLocalCoordinates, validate
-
Field Details
-
lineWidth
Deprecated.UsesetLineWidth(int)orsetLineWidthFloat(float)instead.The width of this shape's outline. -
lineStyle
Deprecated.UsesetLineStyle(int)instead.The line style to be used for this shape's outline.
-
-
Constructor Details
-
Shape
public Shape()Default constructor.- Since:
- 2.0
-
-
Method Details
-
fillShape
Fills the interior of the shape with the background color.- Parameters:
graphics- the graphics object
-
outlineShape
Outlines this shape using the foreground color.- Parameters:
graphics- the graphics object
-
paintFigure
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:
paintFigurein classFigure- Parameters:
graphics- The Graphics used to paint- See Also:
-
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
-
setOutline
public void setOutline(boolean b) Sets whether the outline should be drawn for this shape.- Parameters:
b-trueif 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-trueif 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-trueif the outline and fill should be XOR'ed- Since:
- 2.0
-
getAlpha
- Since:
- 3.5
-
getAntialias
- Since:
- 3.5
-
getLineAttributes
Returns line attributes used when drawing this shape.- Returns:
- current line attributes
- Since:
- 3.5
- See Also:
-
getLineWidth
public int getLineWidth()Returns the line width of this shape's outline.- Returns:
- the line width
-
getLineWidthFloat
public float getLineWidthFloat()Returns the line width of this shape's outline.- Since:
- 3.5
- See Also:
-
getLineJoin
public int getLineJoin()Returns the line join style of this shape's outline.- Since:
- 3.5
- See Also:
-
getLineCap
public int getLineCap()Returns the line cap style of this shape's outline.- Since:
- 3.5
- See Also:
-
getLineStyle
public int getLineStyle()Returns the line style of this shape's outline.- Returns:
- the line style
- See Also:
-
getLineDash
public float[] getLineDash()Returns the line dash style of this shape's outline.- Since:
- 3.5
- See Also:
-
getLineDashOffset
public float getLineDashOffset()Returns the line dash offset of this shape's outline.- Since:
- 3.5
- See Also:
-
getLineMiterLimit
public float getLineMiterLimit()Returns the line dash miter limit of this shape's outline.- Since:
- 3.5
- See Also:
-
setAlpha
- Since:
- 3.5
-
setAlpha
public void setAlpha(int value) - Since:
- 3.5
-
setAntialias
- Parameters:
value-- Since:
- 3.5
- See Also:
-
setAntialias
public void setAntialias(int value) - Since:
- 3.5
-
setLineAttributes
Sets all line attributes at once.- Parameters:
la-- Since:
- 3.5
- See Also:
-
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
-
setLineWidthFloat
public void setLineWidthFloat(float value) Sets the line width of this shape's outline.- Parameters:
value-- Since:
- 3.5
- See Also:
-
setLineJoin
public void setLineJoin(int join) Sets the line join style of this shape's outline.- Parameters:
join-- Since:
- 3.5
- See Also:
-
setLineCap
public void setLineCap(int cap) Sets the line cap style of this shape's outline.- Parameters:
cap-- Since:
- 3.5
- See Also:
-
setLineStyle
public void setLineStyle(int style) Sets the line style of this shape's outline.- Parameters:
style- the new line style- Since:
- 2.0
- See Also:
-
setLineDash
public void setLineDash(float[] dash) Sets the line dash style of this shape's outline.- Parameters:
dash-- Since:
- 3.5
- See Also:
-
setLineDashOffset
public void setLineDashOffset(float dashOffset) Sets the line dash offset of this shape's outline.- Parameters:
dashOffset-- Since:
- 3.5
- See Also:
-
setLineMiterLimit
public void setLineMiterLimit(float miterLimit) Sets the line dash miter limit of this shape's outline.- Parameters:
miterLimit-- Since:
- 3.5
- See Also:
-
setLineStyle(int)instead.