Package com.mxgraph.shape
Class mxStencil
java.lang.Object
com.mxgraph.shape.mxStencil
- All Implemented Interfaces:
mxIShape
Implements a stencil for the given XML definition. This class implements the mxGraph
stencil schema.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
Holds the aspect of the shape.protected Element
Holds the XML node with the stencil description.protected Element
Holds the top-level node of the stencil definition.protected Element
Holds the XML node with the stencil description.protected double
Holds the height of the shape.protected double
Holds the last x-position of the cursor.protected double
Holds the last y-position of the cursor.protected String
Holds the strokewidth direction from the description.protected double
Holds the width of the shape. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected mxRectangle
computeAspect
(mxCellState state, mxRectangle bounds, String direction) Returns a rectangle that contains the offset in x and y and the horizontal and vertical scale in width and height used to draw this shape inside the given rectangle.protected mxGraphicsCanvas2D
Creates the canvas for rendering the stencil.protected void
drawElement
(mxGraphicsCanvas2D canvas, mxCellState state, Element node, mxRectangle aspect) Drawsthe given element.protected void
drawShadow
(mxGraphicsCanvas2D canvas, mxCellState state, double rotation, boolean flipH, boolean flipV, mxRectangle bounds, double alpha, boolean filled, mxRectangle aspect) Draws the shadow.boolean
drawShape
(mxGraphicsCanvas2D canvas, mxCellState state, mxRectangle bounds, mxRectangle aspect, boolean background) Draws this stencil inside the given bounds.evaluateAttribute
(Element elt, String attribute, mxCellState state) Gets the attribute for the given name from the given node.Returns the description.protected double
Returns the given attribute or 0.protected double
Returns the given attribute or the default value.protected int
Returns the given attribute or the default value.protected String
Returns the given attribute or the default value.void
paintShape
(mxGraphics2DCanvas gc, mxCellState state) Paints the stencil for the given state.protected void
Parses the description of this shape.void
setDescription
(Element value) Sets the description.
-
Field Details
-
desc
Holds the top-level node of the stencil definition. -
aspect
Holds the aspect of the shape. Default is "auto". -
w0
protected double w0Holds the width of the shape. Default is 100. -
h0
protected double h0Holds the height of the shape. Default is 100. -
bgNode
Holds the XML node with the stencil description. -
fgNode
Holds the XML node with the stencil description. -
strokewidth
Holds the strokewidth direction from the description. -
lastMoveX
protected double lastMoveXHolds the last x-position of the cursor. -
lastMoveY
protected double lastMoveYHolds the last y-position of the cursor.
-
-
Constructor Details
-
mxStencil
Constructs a new stencil for the given mxGraph shape description.
-
-
Method Details
-
getDescription
Returns the description. -
setDescription
Sets the description. -
createCanvas
Creates the canvas for rendering the stencil. -
paintShape
Paints the stencil for the given state.- Specified by:
paintShape
in interfacemxIShape
-
drawShadow
protected void drawShadow(mxGraphicsCanvas2D canvas, mxCellState state, double rotation, boolean flipH, boolean flipV, mxRectangle bounds, double alpha, boolean filled, mxRectangle aspect) Draws the shadow. -
drawShape
public boolean drawShape(mxGraphicsCanvas2D canvas, mxCellState state, mxRectangle bounds, mxRectangle aspect, boolean background) Draws this stencil inside the given bounds. -
computeAspect
Returns a rectangle that contains the offset in x and y and the horizontal and vertical scale in width and height used to draw this shape inside the given rectangle. -
drawElement
protected void drawElement(mxGraphicsCanvas2D canvas, mxCellState state, Element node, mxRectangle aspect) Drawsthe given element. -
getInt
Returns the given attribute or the default value. -
getDouble
Returns the given attribute or 0. -
getDouble
Returns the given attribute or the default value. -
getString
Returns the given attribute or the default value. -
parseDescription
protected void parseDescription()Parses the description of this shape. -
evaluateAttribute
Gets the attribute for the given name from the given node. If the attribute does not exist then the text content of the node is evaluated and if it is a function it is invoked withas the only argument and the return value is used as the attribute value to be returned.
-