mxGraph 1.10.3.1


com.mxgraph.canvas
Class mxBasicCanvas

java.lang.Object
  extended by com.mxgraph.canvas.mxBasicCanvas
All Implemented Interfaces:
mxICanvas
Direct Known Subclasses:
mxGraphics2DCanvas, mxHtmlCanvas, mxSvgCanvas, mxVmlCanvas

public abstract class mxBasicCanvas
extends Object
implements mxICanvas


Field Summary
static String DEFAULT_IMAGEBASEPATH
          Defines the default value for the imageBasePath in all GDI canvases.
protected  boolean drawLabels
          Specifies whether labels should be painted.
protected  String imageBasePath
          Defines the base path for images with relative paths.
protected  Hashtable<String,BufferedImage> imageCache
          Cache for images.
static boolean PRESERVE_IMAGE_ASPECT
          Specifies if image aspect should be preserved in drawImage.
protected  double scale
          Specifies the current scale.
protected  Point translate
          Specifies the current translation.
 
Constructor Summary
mxBasicCanvas()
           
 
Method Summary
 void flushImageCache()
           
 String getImageBasePath()
           
 String getImageForStyle(Map<String,Object> style)
          Gets the image path from the given style.
 double getScale()
          Returns the scale.
 Point getTranslate()
          Returns the current translate.
 boolean isDrawLabels()
           
 BufferedImage loadImage(String image)
          Returns an image instance for the given URL.
 void setDrawLabels(boolean drawLabels)
           
 void setImageBasePath(String imageBasePath)
           
 void setScale(double scale)
          Sets the scale for the following drawing requests.
 void setTranslate(int dx, int dy)
          Sets the current translate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.mxgraph.canvas.mxICanvas
drawCell, drawLabel
 

Field Detail

PRESERVE_IMAGE_ASPECT

public static boolean PRESERVE_IMAGE_ASPECT
Specifies if image aspect should be preserved in drawImage. Default is true.


DEFAULT_IMAGEBASEPATH

public static String DEFAULT_IMAGEBASEPATH
Defines the default value for the imageBasePath in all GDI canvases. Default is an empty string.


imageBasePath

protected String imageBasePath
Defines the base path for images with relative paths. Trailing slash is required. Default value is DEFAULT_IMAGEBASEPATH.


translate

protected Point translate
Specifies the current translation. Default is (0,0).


scale

protected double scale
Specifies the current scale. Default is 1.


drawLabels

protected boolean drawLabels
Specifies whether labels should be painted. Default is true.


imageCache

protected Hashtable<String,BufferedImage> imageCache
Cache for images.

Constructor Detail

mxBasicCanvas

public mxBasicCanvas()
Method Detail

setTranslate

public void setTranslate(int dx,
                         int dy)
Sets the current translate.

Specified by:
setTranslate in interface mxICanvas

getTranslate

public Point getTranslate()
Returns the current translate.

Specified by:
getTranslate in interface mxICanvas
Returns:
Returns the current translation.

setScale

public void setScale(double scale)
Description copied from interface: mxICanvas
Sets the scale for the following drawing requests.

Specified by:
setScale in interface mxICanvas

getScale

public double getScale()
Description copied from interface: mxICanvas
Returns the scale.

Specified by:
getScale in interface mxICanvas

setDrawLabels

public void setDrawLabels(boolean drawLabels)

getImageBasePath

public String getImageBasePath()

setImageBasePath

public void setImageBasePath(String imageBasePath)

isDrawLabels

public boolean isDrawLabels()

loadImage

public BufferedImage loadImage(String image)
Returns an image instance for the given URL. If the URL has been loaded before than an instance of the same instance is returned as in the previous call.


flushImageCache

public void flushImageCache()

getImageForStyle

public String getImageForStyle(Map<String,Object> style)
Gets the image path from the given style. If the path is relative (does not start with a slash) then it is appended to the imageBasePath.


mxGraph 1.10.3.1


Copyright (c) 2010 Gaudenz Alder, David Benson. All rights reserved.