|
JGraph X 1.3.0.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mxgraph.canvas.mxBasicCanvas
com.mxgraph.canvas.mxGraphics2DCanvas
public class mxGraphics2DCanvas
An implementation of a canvas that uses Graphics2D for painting.
Field Summary | |
---|---|
protected java.awt.Graphics2D |
g
Global graphics handle to the image. |
protected java.util.Hashtable<java.lang.String,java.awt.Image> |
imageCache
Cache for images. |
protected javax.swing.CellRendererPane |
rendererPane
Optional renderer pane to be used for HTML label rendering. |
Fields inherited from class com.mxgraph.canvas.mxBasicCanvas |
---|
DEFAULT_IMAGEBASEPATH, drawLabels, imageBasePath, scale, translate |
Constructor Summary | |
---|---|
mxGraphics2DCanvas()
Constructs a new graphics canvas with an empty graphics object. |
|
mxGraphics2DCanvas(java.awt.Graphics2D g)
Constructs a new graphics canvas for the given graphics object. |
Method Summary | |
---|---|
protected java.awt.Polygon |
createArrow(mxPoint p0,
mxPoint pe)
Creates a polygon that represents an arrow. |
protected void |
drawActor(int x,
int y,
int w,
int h,
java.awt.Color fillColor,
java.awt.Paint fillPaint,
java.awt.Color penColor,
boolean shadow)
Draws an actor shape for the given parameters. |
protected void |
drawArrow(java.util.List<mxPoint> pts,
java.awt.Color fillColor,
java.awt.Paint fillPaint,
java.awt.Color penColor,
boolean shadow)
Draws the given arrow shape. |
protected void |
drawCloud(int x,
int y,
int w,
int h,
java.awt.Color fillColor,
java.awt.Paint fillPaint,
java.awt.Color penColor,
boolean shadow)
Draws a cloud shape for the given parameters. |
protected void |
drawConnector(java.util.List<mxPoint> pts,
float penWidth,
java.awt.Color penColor,
java.lang.Object startMarker,
float startSize,
java.lang.Object endMarker,
float endSize,
boolean rounded,
java.util.Map<java.lang.String,java.lang.Object> style)
Draws the given connector shape. |
protected void |
drawCylinder(int x,
int y,
int w,
int h,
java.awt.Color fillColor,
java.awt.Paint fillPaint,
java.awt.Color penColor,
boolean isShadow)
Draws a cylinder for the given parameters. |
java.lang.Object |
drawEdge(java.util.List<mxPoint> pts,
java.util.Map<java.lang.String,java.lang.Object> style)
Draws the given edge. |
protected void |
drawHexagon(int x,
int y,
int w,
int h,
java.awt.Color fillColor,
java.awt.Paint fillPaint,
java.awt.Color penColor,
boolean shadow,
java.lang.String direction)
Draws a hexagon shape for the given parameters. |
protected void |
drawHtmlText(java.lang.String text,
int x,
int y,
int w,
int h,
java.util.Map<java.lang.String,java.lang.Object> style)
Draws the specified HTML markup. |
protected void |
drawImage(int x,
int y,
int w,
int h,
java.lang.String image)
Draws an image for the given parameters. |
java.lang.Object |
drawLabel(java.lang.String label,
int x,
int y,
int w,
int h,
java.util.Map<java.lang.String,java.lang.Object> style,
boolean isHtml)
Draws the given label. |
void |
drawLine(int x0,
int y0,
int x1,
int y1)
Draws the given line if the line is inside the clipping area. |
void |
drawLine(java.util.List<mxPoint> pts,
java.util.Map<java.lang.String,java.lang.Object> style)
Draws the given lines as segments between all points of the given list of mxPoints. |
mxPoint |
drawMarker(java.lang.Object type,
mxPoint p0,
mxPoint pe,
float size,
float strokeWidth)
Draws the given type of marker. |
protected void |
drawOval(int x,
int y,
int w,
int h,
java.awt.Color fillColor,
java.awt.Paint fillPaint,
java.awt.Color penColor,
boolean shadow)
Draws an oval for the given parameters. |
protected void |
drawPath(java.awt.geom.GeneralPath path,
java.awt.Color fillColor,
java.awt.Paint fillPaint,
java.awt.Color penColor,
boolean shadow)
Draws a path for the given parameters. |
protected void |
drawPlainText(java.lang.String text,
int x,
int y,
int w,
int h,
java.util.Map<java.lang.String,java.lang.Object> style)
Draws the specified string as plain text. |
protected void |
drawPolygon(java.awt.Polygon polygon,
java.awt.Color fillColor,
java.awt.Paint fillPaint,
java.awt.Color penColor,
boolean shadow)
Draws a a polygon for the given parameters. |
protected void |
drawRect(int x,
int y,
int w,
int h,
java.awt.Color fillColor,
java.awt.Paint fillPaint,
java.awt.Color penColor,
boolean shadow,
boolean rounded)
Draws a rectangle for the given parameters. |
protected void |
drawRhombus(int x,
int y,
int w,
int h,
java.awt.Color fillColor,
java.awt.Paint fillPaint,
java.awt.Color penColor,
boolean shadow)
Draws a rhombus (aka. |
void |
drawShape(int x,
int y,
int w,
int h,
java.util.Map<java.lang.String,java.lang.Object> style)
Draws the shape specified with the STYLE_SHAPE key in the given style. |
protected void |
drawTriangle(int x,
int y,
int w,
int h,
java.awt.Color fillColor,
java.awt.Paint fillPaint,
java.awt.Color penColor,
boolean shadow,
java.lang.String direction)
Draws a triangle shape for the given parameters. |
java.lang.Object |
drawVertex(int x,
int y,
int w,
int h,
java.util.Map<java.lang.String,java.lang.Object> style)
Draws the given vertex. |
static int |
getArcSize(int w,
int h)
Computes the arc size for the given dimension. |
protected java.awt.Paint |
getFillPaint(java.awt.Rectangle bounds,
java.awt.Color fillColor,
java.util.Map<java.lang.String,java.lang.Object> style)
|
java.awt.Graphics2D |
getGraphics()
Returns the graphics object for this canvas. |
protected java.awt.Image |
loadImage(java.lang.String image)
Returns an image instance for the given URL. |
void |
setGraphics(java.awt.Graphics2D g)
Sets the graphics object for this canvas. |
protected void |
setStroke(float penWidth,
java.util.Map<java.lang.String,java.lang.Object> style)
Draws the given lines as segments between all points of the given list of mxPoints. |
Methods inherited from class com.mxgraph.canvas.mxBasicCanvas |
---|
getImageBasePath, getImageForStyle, getScale, getTranslate, isDrawLabels, setDrawLabels, setImageBasePath, setScale, setTranslate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Hashtable<java.lang.String,java.awt.Image> imageCache
protected javax.swing.CellRendererPane rendererPane
protected java.awt.Graphics2D g
Constructor Detail |
---|
public mxGraphics2DCanvas()
public mxGraphics2DCanvas(java.awt.Graphics2D g)
Method Detail |
---|
public java.awt.Graphics2D getGraphics()
public void setGraphics(java.awt.Graphics2D g)
protected java.awt.Image loadImage(java.lang.String image)
public java.lang.Object drawVertex(int x, int y, int w, int h, java.util.Map<java.lang.String,java.lang.Object> style)
mxICanvas
x
- X-coordinate of the vertex.y
- Y-coordinate of the vertex.w
- Width of the vertex.h
- Height of the vertex.style
- Style of the vertex.
public java.lang.Object drawEdge(java.util.List<mxPoint> pts, java.util.Map<java.lang.String,java.lang.Object> style)
mxICanvas
pts
- List of mxPoints that make up the edge.style
- Style of the edge.
public java.lang.Object drawLabel(java.lang.String label, int x, int y, int w, int h, java.util.Map<java.lang.String,java.lang.Object> style, boolean isHtml)
mxICanvas
label
- String that represents the label.x
- X-coordinate of the label.y
- Y-coordinate of the label.w
- Width of the label.h
- Height of the label.style
- Style of the label.isHtml
- Specifies if the label contains HTML markup.
public void drawShape(int x, int y, int w, int h, java.util.Map<java.lang.String,java.lang.Object> style)
x
- X-coordinate of the shape.y
- Y-coordinate of the shape.w
- Width of the shape.h
- Height of the shape.style
- Style of the the shape.protected void drawPolygon(java.awt.Polygon polygon, java.awt.Color fillColor, java.awt.Paint fillPaint, java.awt.Color penColor, boolean shadow)
polygon
- Points of the polygon.fillColor
- Optional fill color of the shape.fillPaint
- Optional paint of the shape.penColor
- Optional stroke color.shadow
- Boolean indicating if a shadow should be painted.protected void drawPath(java.awt.geom.GeneralPath path, java.awt.Color fillColor, java.awt.Paint fillPaint, java.awt.Color penColor, boolean shadow)
path
- Path object to be drawn.fillColor
- Optional fill color of the shape.fillPaint
- Optional paint of the shape.penColor
- Optional stroke color.shadow
- Boolean indicating if a shadow should be painted.protected void drawRect(int x, int y, int w, int h, java.awt.Color fillColor, java.awt.Paint fillPaint, java.awt.Color penColor, boolean shadow, boolean rounded)
x
- X-coordinate of the shape.y
- Y-coordinate of the shape.w
- Width of the shape.h
- Height of the shape.fillColor
- Optional fill color of the shape.fillPaint
- Optional paint of the shape.penColor
- Optional stroke color.shadow
- Boolean indicating if a shadow should be painted.rounded
- Boolean indicating if the rectangle is rounded.protected void drawImage(int x, int y, int w, int h, java.lang.String image)
x
- X-coordinate of the image.y
- Y-coordinate of the image.w
- Width of the image.h
- Height of the image.image
- URL of the image.protected void drawOval(int x, int y, int w, int h, java.awt.Color fillColor, java.awt.Paint fillPaint, java.awt.Color penColor, boolean shadow)
x
- X-coordinate of the shape.y
- Y-coordinate of the shape.w
- Width of the shape.h
- Height of the shape.fillColor
- Optional fill color of the shape.fillPaint
- Optional paint of the shape.penColor
- Optional stroke color.shadow
- Boolean indicating if a shadow should be painted.protected void drawRhombus(int x, int y, int w, int h, java.awt.Color fillColor, java.awt.Paint fillPaint, java.awt.Color penColor, boolean shadow)
x
- X-coordinate of the shape.y
- Y-coordinate of the shape.w
- Width of the shape.h
- Height of the shape.fillColor
- Optional fill color of the shape.fillPaint
- Optional paint of the shape.penColor
- Optional stroke color.shadow
- Boolean indicating if a shadow should be painted.protected void drawCylinder(int x, int y, int w, int h, java.awt.Color fillColor, java.awt.Paint fillPaint, java.awt.Color penColor, boolean isShadow)
x
- X-coordinate of the shape.y
- Y-coordinate of the shape.w
- Width of the shape.h
- Height of the shape.fillColor
- Optional fill color of the shape.fillPaint
- Optional paint of the shape.penColor
- Optional stroke color.isShadow
- Boolean indicating if a shadow should be painted.protected void drawActor(int x, int y, int w, int h, java.awt.Color fillColor, java.awt.Paint fillPaint, java.awt.Color penColor, boolean shadow)
x
- X-coordinate of the shape.y
- Y-coordinate of the shape.w
- Width of the shape.h
- Height of the shape.fillColor
- Optional fill color of the shape.fillPaint
- Optional paint of the shape.penColor
- Optional stroke color.shadow
- Boolean indicating if a shadow should be painted.protected void drawCloud(int x, int y, int w, int h, java.awt.Color fillColor, java.awt.Paint fillPaint, java.awt.Color penColor, boolean shadow)
x
- X-coordinate of the shape.y
- Y-coordinate of the shape.w
- Width of the shape.h
- Height of the shape.fillColor
- Optional fill color of the shape.fillPaint
- Optional paint of the shape.penColor
- Optional stroke color.shadow
- Boolean indicating if a shadow should be painted.protected void drawTriangle(int x, int y, int w, int h, java.awt.Color fillColor, java.awt.Paint fillPaint, java.awt.Color penColor, boolean shadow, java.lang.String direction)
x
- X-coordinate of the shape.y
- Y-coordinate of the shape.w
- Width of the shape.h
- Height of the shape.fillColor
- Optional fill color of the shape.fillPaint
- Optional paint of the shape.penColor
- Optional stroke color.shadow
- Boolean indicating if a shadow should be painted.protected void drawHexagon(int x, int y, int w, int h, java.awt.Color fillColor, java.awt.Paint fillPaint, java.awt.Color penColor, boolean shadow, java.lang.String direction)
x
- X-coordinate of the shape.y
- Y-coordinate of the shape.w
- Width of the shape.h
- Height of the shape.fillColor
- Optional fill color of the shape.fillPaint
- Optional paint of the shape.penColor
- Optional stroke color.shadow
- Boolean indicating if a shadow should be painted.public static int getArcSize(int w, int h)
w
- Width of the rectangle.h
- Height of the rectangle.
protected java.awt.Polygon createArrow(mxPoint p0, mxPoint pe)
p0
- Start point of the arrow.pe
- End point of the arrow.
protected void drawArrow(java.util.List<mxPoint> pts, java.awt.Color fillColor, java.awt.Paint fillPaint, java.awt.Color penColor, boolean shadow)
pts
- List of points that define the line.protected void drawConnector(java.util.List<mxPoint> pts, float penWidth, java.awt.Color penColor, java.lang.Object startMarker, float startSize, java.lang.Object endMarker, float endSize, boolean rounded, java.util.Map<java.lang.String,java.lang.Object> style)
pts
- List of points that define the line.protected java.awt.Paint getFillPaint(java.awt.Rectangle bounds, java.awt.Color fillColor, java.util.Map<java.lang.String,java.lang.Object> style)
fillColor
- style
-
public void drawLine(java.util.List<mxPoint> pts, java.util.Map<java.lang.String,java.lang.Object> style)
pts
- List of points that define the line.style
- Style to be used for painting the line.protected void setStroke(float penWidth, java.util.Map<java.lang.String,java.lang.Object> style)
penWidth
- Specifies the width of the pen.style
- Style to be used for painting the line.public void drawLine(int x0, int y0, int x1, int y1)
public mxPoint drawMarker(java.lang.Object type, mxPoint p0, mxPoint pe, float size, float strokeWidth)
type
- p0
- pe
- size
- strokeWidth
-
protected void drawHtmlText(java.lang.String text, int x, int y, int w, int h, java.util.Map<java.lang.String,java.lang.Object> style)
text
- HTML markup to be painted.x
- X-coordinate of the text.y
- Y-coordinate of the text.w
- Width of the text.h
- Height of the text.style
- Style to be used for painting the text.protected void drawPlainText(java.lang.String text, int x, int y, int w, int h, java.util.Map<java.lang.String,java.lang.Object> style)
text
- HTML markup to be painted.x
- X-coordinate of the text.y
- Y-coordinate of the text.w
- Width of the text.h
- Height of the text.style
- Style to be used for painting the text.
|
JGraph X 1.3.0.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |