com.mxgraph.canvas

## Class mxVmlCanvas

- java.lang.Object
- - com.mxgraph.canvas.mxBasicCanvas
  - - com.mxgraph.canvas.mxVmlCanvas

- All Implemented Interfaces:
    mxICanvas

      public class mxVmlCanvas
      extends mxBasicCanvas

  An implementation of a canvas that uses VML for painting.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `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, imageCache, PRESERVE_IMAGE_ASPECT, scale, translate`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `mxVmlCanvas()` Constructs a new VML canvas for the specified dimension and scale.
    `mxVmlCanvas(org.w3c.dom.Document document)` Constructs a new VML canvas for the specified bounds, scale and background color.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `appendVmlElement(org.w3c.dom.Element node)`
    `java.lang.Object` | `drawCell(mxCellState state)` Draws the given cell.
    `java.lang.Object` | `drawLabel(java.lang.String label, mxCellState state, boolean html)` Draws the given label.
    `org.w3c.dom.Element` | `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.
    `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.
    `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

      `flushImageCache, getImageBasePath, getImageForStyle, getScale, getTranslate, isDrawLabels, loadImage, 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

    - #### mxVmlCanvas

          public mxVmlCanvas()

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

    - #### mxVmlCanvas

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

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

  - ### Method Detail

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

    - #### appendVmlElement

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

    - #### drawCell

          public java.lang.Object drawCell(mxCellState state)

      Description copied from interface: `mxICanvas`
      Draws the given cell.
      Parameters:
        `state` - State of the cell to be painted.
      Returns:
        Object that represents the cell.

    - #### drawLabel

          public java.lang.Object drawLabel(java.lang.String label,
                                   mxCellState state,
                                   boolean html)

      Description copied from interface: `mxICanvas`
      Draws the given label.
      Parameters:
        `label` - String that represents the label.
        `state` - State of the cell whose label is to be painted.
        `html` - Specifies if the label contains HTML markup.
      Returns:
        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 org.w3c.dom.Element 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.

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

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