org.apache.batik.bridge

Class CursorManager

public class CursorManager extends Object implements SVGConstants, ErrorConstants

The CursorManager class is a helper class which preloads the cursors corresponding to the SVG built in cursors.
Field Summary
static CursorANCHOR_CURSOR
Cursor used over anchors
protected BridgeContextctx
BridgeContext associated with this CursorManager
protected CursorManager.CursorCachecursorCache
Cache used to hold references to cursors
protected static MapcursorMap
Maps SVG Cursor Values to Java Cursors
static CursorDEFAULT_CURSOR
Default cursor when value is not found
static intDEFAULT_PREFERRED_HEIGHT
static intDEFAULT_PREFERRED_WIDTH
Default preferred cursor size, used for SVG images
static CursorTEXT_CURSOR
Cursor used over text
Constructor Summary
CursorManager(BridgeContext ctx)
Creates a new CursorManager object.
Method Summary
CursorconvertBuiltInCursor(Element e, String cursorStr)
CursorconvertCursor(Element e)
Returns the Cursor corresponding to the input element's cursor property
CursorconvertSVGCursor(Element e, Value l)
Returns a cursor for the given value list.
CursorconvertSVGCursorElement(Element cursorElement)
Returns a cursor for a given element
protected FiltercursorHrefToFilter(Element cursorElement, ParsedURL purl, Point2D hotSpot)
Converts the input ParsedURL into a Filter and transforms the input hotSpot point (in image space) to cursor space
static CursorgetPredefinedCursor(String cursorName)
Returns a Cursor object for a given cursor value.
protected ImagerenderedImageToImage(RenderedImage ri)
Implementation helper: converts a RenderedImage to an Image

Field Detail

ANCHOR_CURSOR

public static final Cursor ANCHOR_CURSOR
Cursor used over anchors

ctx

protected BridgeContext ctx
BridgeContext associated with this CursorManager

cursorCache

protected CursorManager.CursorCache cursorCache
Cache used to hold references to cursors

cursorMap

protected static Map cursorMap
Maps SVG Cursor Values to Java Cursors

DEFAULT_CURSOR

public static final Cursor DEFAULT_CURSOR
Default cursor when value is not found

DEFAULT_PREFERRED_HEIGHT

public static final int DEFAULT_PREFERRED_HEIGHT

DEFAULT_PREFERRED_WIDTH

public static final int DEFAULT_PREFERRED_WIDTH
Default preferred cursor size, used for SVG images

TEXT_CURSOR

public static final Cursor TEXT_CURSOR
Cursor used over text

Constructor Detail

CursorManager

public CursorManager(BridgeContext ctx)
Creates a new CursorManager object.

Parameters: ctx the BridgeContext associated to this CursorManager

Method Detail

convertBuiltInCursor

public Cursor convertBuiltInCursor(Element e, String cursorStr)

convertCursor

public Cursor convertCursor(Element e)
Returns the Cursor corresponding to the input element's cursor property

Parameters: e the element on which the cursor property is set

convertSVGCursor

public Cursor convertSVGCursor(Element e, Value l)
Returns a cursor for the given value list. Note that the code assumes that the input value has at least two entries. So the caller should check that before calling the method. For example, CSSUtilities.convertCursor performs that check.

convertSVGCursorElement

public Cursor convertSVGCursorElement(Element cursorElement)
Returns a cursor for a given element

cursorHrefToFilter

protected Filter cursorHrefToFilter(Element cursorElement, ParsedURL purl, Point2D hotSpot)
Converts the input ParsedURL into a Filter and transforms the input hotSpot point (in image space) to cursor space

getPredefinedCursor

public static Cursor getPredefinedCursor(String cursorName)
Returns a Cursor object for a given cursor value. This initial implementation does not handle user-defined cursors, so it always uses the cursor at the end of the list

renderedImageToImage

protected Image renderedImageToImage(RenderedImage ri)
Implementation helper: converts a RenderedImage to an Image
Copyright B) 2008 Apache Software Foundation. All Rights Reserved.