JGraph X 1.3.0.0

## com.mxgraph.canvas
Class mxHtmlCanvas

    java.lang.Object
      com.mxgraph.canvas.mxBasicCanvas
          com.mxgraph.canvas.mxHtmlCanvas

All Implemented Interfaces:
  mxICanvas

    public class mxHtmlCanvas

extends mxBasicCanvas

An implementation of a canvas that uses HTML for painting.

Field Summary
`protected org.w3c.dom.Document` `document` Holds the HTML document that represents the canvas.

Fields inherited from class com.mxgraph.canvas.mxBasicCanvas
`DEFAULT_IMAGEBASEPATH, drawLabels, imageBasePath, scale, translate`

Constructor Summary
`mxHtmlCanvas()` Constructs a new HTML canvas for the specified dimension and scale.
`mxHtmlCanvas(org.w3c.dom.Document document)` Constructs a new HTML canvas for the specified bounds, scale and background color.

Method Summary
`void` `appendHtmlElement(org.w3c.dom.Element node)`
`java.lang.Object` `drawEdge(java.util.List<mxPoint> pts, java.util.Map<java.lang.String,java.lang.Object> style)` Draws the given edge.
`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(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.
`protected void` `drawSegment(int x0, int y0, int x1, int y1, java.lang.String strokeColor, int strokeWidth)` Draws the specified segment of a line.
`org.w3c.dom.Element` `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.
`org.w3c.dom.Element` `drawText(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 text either using drawHtmlString or using drawString.
`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.
`org.w3c.dom.Document` `getDocument()` Returns a reference to the document that represents the canvas.
`void` `setDocument(org.w3c.dom.Document document)`

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

### document

    protected org.w3c.dom.Document document

  Holds the HTML document that represents the canvas.

Constructor Detail

### mxHtmlCanvas

    public mxHtmlCanvas()

  Constructs a new HTML canvas for the specified dimension and scale.

### mxHtmlCanvas

    public mxHtmlCanvas(org.w3c.dom.Document document)

  Constructs a new HTML canvas for the specified bounds, scale and background color.

Method Detail

### appendHtmlElement

    public void appendHtmlElement(org.w3c.dom.Element node)

### setDocument

    public void setDocument(org.w3c.dom.Document document)

### getDocument

    public org.w3c.dom.Document getDocument()

  Returns a reference to the document that represents the canvas.

  Returns:
    Returns the document.

### drawVertex

    public java.lang.Object drawVertex(int x,
                                       int y,
                                       int w,
                                       int h,
                                       java.util.Map<java.lang.String,java.lang.Object> style)

  Description copied from interface: `mxICanvas`
  Draws the given vertex.

  Parameters:
    `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.
  Returns:
    Optional object that represents the vertex.

### drawEdge

    public java.lang.Object drawEdge(java.util.List<mxPoint> pts,
                                     java.util.Map<java.lang.String,java.lang.Object> style)

  Description copied from interface: `mxICanvas`
  Draws the given edge.

  Parameters:
    `pts` - List of mxPoints that make up the edge.
    `style` - Style of the edge.
  Returns:
    Optional object that represents the edge.

### drawLabel

    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)

  Description copied from interface: `mxICanvas`
  Draws the given label.

  Parameters:
    `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.
  Returns:
    Optional object that represents the label.

### drawShape

    public org.w3c.dom.Element 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.

  Parameters:
    `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.

### drawLine

    public 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.

  Parameters:
    `pts` - List of points that define the line.
    `style` - Style to be used for painting the line.

### drawSegment

    protected void drawSegment(int x0,
                               int y0,
                               int x1,
                               int y1,
                               java.lang.String strokeColor,
                               int strokeWidth)

  Draws the specified segment of a line.

  Parameters:
    `x0` - X-coordinate of the start point.
    `y0` - Y-coordinate of the start point.
    `x1` - X-coordinate of the end point.
    `y1` - Y-coordinate of the end point.
    `strokeColor` - Color of the stroke to be painted.
    `strokeWidth` - Width of the stroke to be painted.

### drawText

    public org.w3c.dom.Element drawText(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 text either using drawHtmlString or using drawString.

  Parameters:
    `text` - Text 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

Copyright (c) 2008 Gaudenz Alder. All rights reserved.