org.apache.batik.bridge

Class BridgeContext

public class BridgeContext extends Object implements ErrorConstants, CSSContext

This class represents a context used by the various bridges and the builder. A bridge context is associated to a particular document and cannot be reused. The context encapsulates the dynamic bindings between DOM elements and GVT nodes, graphic contexts such as a GraphicsNodeRenderContext, and the different objects required by the GVT builder to interpret a SVG DOM tree such as the current viewport or the user agent.
Nested Class Summary
protected classBridgeContext.AnimatedAttrListener
A listener class for changes to animated attributes in the document.
static classBridgeContext.CSSEngineUserAgentWrapper
protected classBridgeContext.CSSPropertiesChangedListener
The CSSEngineListener invoked when CSS properties are modified on a particular element.
protected classBridgeContext.DOMAttrModifiedEventListener
The DOM EventListener invoked when an attribute is modified.
protected classBridgeContext.DOMCharacterDataModifiedEventListener
The DOM EventListener invoked when a character data is changed.
protected classBridgeContext.DOMMouseOutEventListener
The DOM EventListener invoked when the mouse exits an element
protected classBridgeContext.DOMMouseOverEventListener
The DOM EventListener invoked when the mouse mouves over a new element.
protected classBridgeContext.DOMNodeInsertedEventListener
The DOM EventListener invoked when a node is added.
protected classBridgeContext.DOMNodeRemovedEventListener
The DOM EventListener invoked when a node is removed.
protected static classBridgeContext.EventListenerMememto
A class used to store an EventListener added to the DOM.
static classBridgeContext.SoftReferenceMememto
Field Summary
protected AnimatedAttributeListeneranimatedAttributeListener
The listener to receive notification of animated attribute changes.
protected SVGAnimationEngineanimationEngine
The animation engine for the document.
protected floatanimationLimitingAmount
The amount of animation limiting.
protected intanimationLimitingMode
The animation limiting mode.
protected HashSetchildContexts
Set of WeakReferences to child BridgeContexts.
protected CSSEngineListenercssPropertiesChangedListener
The CSSEngine listener to receive CSSEngineEvent.
protected CursorManagercursorManager
Manages cursors and performs caching when appropriate
protected BridgedefaultBridge
Default bridge.
protected Documentdocument
The document is bridge context is dedicated to.
protected DocumentLoaderdocumentLoader
The document loader used to load/create Document.
protected Dimension2DdocumentSize
The size of the document.
protected EventListenerdomAttrModifiedEventListener
The DOM EventListener to receive 'DOMAttrModified' event.
protected EventListenerdomCharacterDataModifiedEventListener
The DOM EventListener to receive 'DOMCharacterDataModified' event.
protected EventListenerdomNodeInsertedEventListener
The DOM EventListener to receive 'DOMNodeInserted' event.
protected EventListenerdomNodeRemovedEventListener
The DOM EventListener to receive 'DOMNodeRemoved' event.
protected intdynamicStatus
Whether the bridge should support dynamic, or interactive features.
static intDYNAMIC
Indicates that all DOM listeners should be registered.
protected MapelementDataMap
Element Data Map: This is a general location for elements to 'cache' data.
protected MapelementNodeMap
Binding Map: key is an SVG Element - value is a GraphicsNode
protected SeteventListenerSet
The list of all EventListener attached by bridges that need to be removed on a dispose() call.
protected Listextensions
protected FocusManagerfocusManager
The EventListener that is responsible of managing DOM focus event.
protected static ListglobalExtensions
Returns the extensions supported by this bridge context.
protected GVTBuildergvtBuilder
The GVT builder that might be used to create a GVT subtree.
protected MapinterpreterMap
The interpreter cache per document. key is the language - value is a Interpreter
protected InterpreterPoolinterpreterPool
The interpreter pool used to handle scripts.
protected booleanisSVG12
Whether the document is an SVG 1.2 document.
static intINTERACTIVE
Indicates that DOM listeners should be registered to support, 'interactivity' this includes anchors and cursors, but does not include support for DOM modifications.
protected MapnamespaceURIMap
Bridge Map: Keys are namespace URI - values are HashMap (with keys are local name and values are a Bridge instance).
protected MapnodeElementMap
Binding Map: key is GraphicsNode - value is a SVG Element.
protected BridgeContextprimaryContext
The bridge context for the primary document, if this is a bridge context for a resource document.
protected SetreservedNamespaceSet
Default bridge reserved namespaces set.
static intSTATIC
Indicates that no DOM listeners should be registered.
protected TextPaintertextPainter
The text painter to use.
protected UpdateManagerupdateManager
The update manager.
protected UserAgentuserAgent
The user agent.
protected MapviewportMap
The viewports. key is an Element - value is a Viewport
protected ListviewportStack
The viewport stack.
protected XBLManagerxblManager
The XBL manager.
Constructor Summary
protected BridgeContext()
Constructs a new empty bridge context.
BridgeContext(UserAgent userAgent)
Constructs a new bridge context.
BridgeContext(UserAgent userAgent, DocumentLoader loader)
Constructs a new bridge context.
BridgeContext(UserAgent userAgent, InterpreterPool interpreterPool, DocumentLoader documentLoader)
Constructs a new bridge context.
Method Summary
voidaddDOMListeners()
Adds EventListeners to the DOM and CSSEngineListener to the CSSEngine to handle any modifications on the DOM tree or style properties and update the GVT tree in response.
voidaddGVTListener(Document doc)
Adds the GVT listener for AWT event support.
voidaddUIEventListeners(Document doc)
Adds EventListeners to the input document to handle the cursor property.
voidbind(Node node, GraphicsNode gn)
Binds the specified GraphicsNode to the specified Node.
booleancheckInteractiveElement(Element e)
used by isInteractiveDocument to check if document contains any 'interactive' elements.
booleancheckInteractiveElement(SVGDocument doc, Element e)
used by isInteractiveDocument to check if document contains any 'interactive' elements.
voidcheckLoadExternalResource(ParsedURL resourceURL, ParsedURL docURL)
This method throws a SecurityException if the resource found at url and referenced from docURL should not be loaded.
protected voidclearChildContexts()
Clears the list of child BridgeContexts and disposes them if there are no more references to them.
voidcloseViewport(Element e)
Closes the viewport associated to the specified element.
BridgeContextcreateBridgeContext(SVGOMDocument doc)
This function creates a new BridgeContext, it mostly exists so subclasses can provide an instance of themselves when a sub BridgeContext is needed.
BridgeContextcreateSubBridgeContext(SVGOMDocument newDoc)
This function creates a new 'sub' BridgeContext to associated with 'newDoc' if one currently doesn't exist, otherwise it returns the BridgeContext currently associated with the document.
URIResolvercreateURIResolver(SVGDocument doc, DocumentLoader dl)
Returns a new URIResolver object.
voiddispose()
Disposes this BridgeContext.
protected voidfinalize()
Calls dispose on this BridgeContext, if it is a child context.
SVGAnimationEnginegetAnimationEngine()
Returns the AnimationEngine for the document.
floatgetBlockHeight(Element elt)
Returns the height of the block which directly contains the given element.
floatgetBlockWidth(Element elt)
Returns the width of the block which directly contains the given element.
floatgetBolderFontWeight(float f)
Returns a bolder font-weight.
BridgegetBridge(Element element)
Returns the bridge associated with the specified element.
BridgegetBridge(String namespaceURI, String localName)
Returns the bridge associated with the element type
ListgetBridgeExtensions(Document doc)
protected static BridgeUpdateHandlergetBridgeUpdateHandler(Node node)
Returns the BridgeUpdateHandler associated to the specified Node or null if there is none.
BridgeContext[]getChildContexts()
Returns an array of the child contexts.
CSSEnginegetCSSEngineForElement(Element e)
Returns the CSS engine associated with given element.
CursorManagergetCursorManager()
Returns the cursor manager
ValuegetDefaultFontFamily()
Returns the value corresponding to the default font.
DocumentgetDocument()
Returns the document this bridge context is dedicated to.
DocumentBridgegetDocumentBridge()
Returns the bridge for the document node.
DocumentLoadergetDocumentLoader()
Returns the document loader used to load external documents.
Dimension2DgetDocumentSize()
Returns the actual size of the document or null if the document has not been built yet.
ElementgetElement(GraphicsNode gn)
Returns the Node associated to the specified GraphicsNode or null if any.
ObjectgetElementData(Node n)
Retrieves a data object associated with the given node.
FocusManagergetFocusManager()
Returns the focus manager.
MapgetFontFamilyMap()
Returns the map of font families
static ListgetGlobalBridgeExtensions()
GraphicsNodegetGraphicsNode(Node node)
Returns the GraphicsNode associated to the specified Node or null if any.
GVTBuildergetGVTBuilder()
Returns the GVT builder that is currently used to build the GVT tree.
InterpretergetInterpreter(String language)
Returns a Interpreter for the specified language.
InterpreterPoolgetInterpreterPool()
Returns the interpreter pool used to handle scripts.
floatgetLighterFontWeight(float f)
Returns a lighter font-weight.
floatgetMediumFontSize()
Returns the medium font size.
floatgetPixelToMillimeter()
Returns the size of a px CSS unit in millimeters.
floatgetPixelUnitToMillimeter()
Returns the size of a px CSS unit in millimeters.
BridgeContextgetPrimaryBridgeContext()
Returns the primary bridge context.
ElementgetReferencedElement(Element e, String uri)
Returns the element referenced by the specified element by the specified uri.
NodegetReferencedNode(Element e, String uri)
Returns the node referenced by the specified element by the specified uri.
protected static SVGContextgetSVGContext(Node node)
Returns the SVGContext associated to the specified Node or null if there is none.
ValuegetSystemColor(String ident)
Returns the Value corresponding to the given system color.
TextPaintergetTextPainter()
Returns the text painter that will be used be text nodes.
UpdateManagergetUpdateManager()
Returns the update manager, if the bridge supports dynamic features.
UserAgentgetUserAgent()
Returns the user agent of this bridge context.
ViewportgetViewport(Element e)
Returns the viewport of the specified element.
booleanhasGraphicsNodeBridge(Element element)
Returns true if the specified element has a GraphicsNodeBridge associated to it, false otherwise.
protected voidinitializeDocument(Document document)
Initializes the given document.
booleanisDynamic()
Returns true if the document is dynamic, false otherwise.
booleanisDynamicDocument(Document doc)
Tells whether the given SVG document is dynamic.
booleanisInteractive()
Returns true if the document is interactive, false otherwise.
booleanisInteractiveDocument(Document doc)
Tells whether the given SVG document is Interactive.
booleanisSVG12()
Returns whether the managed document is an SVG 1.2 document.
voidopenViewport(Element e, Viewport viewport)
Starts a new viewport from the specified element.
voidputBridge(String namespaceURI, String localName, Bridge bridge)
Associates the specified Bridge object with the specified namespace URI and local name.
voidputBridge(Bridge bridge)
Associates the specified Bridge object with it's namespace URI and local name.
voidputReservedNamespaceURI(String namespaceURI)
Adds a namespace URI to avoid when creating default bridges.
voidregisterSVGBridges()
Registers the bridges to handle SVG 1.0 elements.
voidremoveBridge(String namespaceURI, String localName)
Removes the Bridge object associated to the specified namespace URI and local name.
protected voidremoveDOMListeners()
Removes event listeners from the DOM and CSS engine.
voidremoveReservedNamespaceURI(String namespaceURI)
Removes a namespace URI to avoid when creating default bridges.
voidremoveUIEventListeners(Document doc)
voidremoveViewport(Element e)
voidsetAnimationLimitingCPU(float pc)
Sets the animation limiting mode to a percentage of CPU.
voidsetAnimationLimitingFPS(float fps)
Sets the animation limiting mode to a number of frames per second.
protected voidsetAnimationLimitingMode()
Set the animationg limiting mode on the animation engine.
voidsetAnimationLimitingNone()
Sets the animation limiting mode to "none".
voidsetDefaultBridge(Bridge bridge)
Sets the Bridge object to be used for foreign namespace elements.
protected voidsetDocument(Document document)
Sets the document this bridge context is dedicated to, to the specified document.
protected voidsetDocumentLoader(DocumentLoader newDocumentLoader)
Sets the document loader used to load external documents.
protected voidsetDocumentSize(Dimension2D d)
Sets the size of the document to the specified dimension.
voidsetDynamic(boolean dynamic)
Sets the document as DYNAMIC if dynamic is true STATIC otherwise.
voidsetDynamicState(int status)
Sets the document as a STATIC, INTERACTIVE or DYNAMIC document.
voidsetElementData(Node n, Object data)
Associates a data object with a node so it can be retrieved later.
protected voidsetFontFamilyMap(Map fontFamilyMap)
Sets the map of font families to the specified value.
protected voidsetGVTBuilder(GVTBuilder gvtBuilder)
Sets the GVT builder that uses this context.
voidsetInteractive(boolean interactive)
Sets the document as INTERACTIVE if interactive is true STATIC otherwise.
protected voidsetInterpreterPool(InterpreterPool interpreterPool)
Sets the interpreter pool used to handle scripts to the specified interpreter pool.
voidsetTextPainter(TextPainter textPainter)
Sets the text painter that will be used by text nodes.
protected voidsetUpdateManager(UpdateManager um)
Sets the update manager.
protected voidsetUpdateManager(BridgeContext ctx, UpdateManager um)
Sets the update manager on the given BridgeContext.
protected voidsetUserAgent(UserAgent userAgent)
Sets the user agent to the specified user agent.
protected voidsetXBLManager(BridgeContext ctx, XBLManager xm)
Sets the xblManager variable of the given BridgeContext.
protected voidstoreEventListener(EventTarget t, String s, EventListener l, boolean b)
Adds to the eventListenerSet the specified event listener registration.
protected voidstoreEventListenerNS(EventTarget t, String n, String s, EventListener l, boolean b)
Adds to the eventListenerSet the specified event listener registration.
voidunbind(Node node)
Removes the binding of the specified Node.

Field Detail

animatedAttributeListener

protected AnimatedAttributeListener animatedAttributeListener
The listener to receive notification of animated attribute changes.

animationEngine

protected SVGAnimationEngine animationEngine
The animation engine for the document.

animationLimitingAmount

protected float animationLimitingAmount
The amount of animation limiting.

animationLimitingMode

protected int animationLimitingMode
The animation limiting mode.

childContexts

protected HashSet childContexts
Set of WeakReferences to child BridgeContexts.

cssPropertiesChangedListener

protected CSSEngineListener cssPropertiesChangedListener
The CSSEngine listener to receive CSSEngineEvent.

cursorManager

protected CursorManager cursorManager
Manages cursors and performs caching when appropriate

defaultBridge

protected Bridge defaultBridge
Default bridge. When a bridge is requested for an element type that does not have a bridge, and there is no other bridge for elements in the same namespace, the default bridge is returned. This is used for custom elements, which all use the same bridge type.

document

protected Document document
The document is bridge context is dedicated to.

documentLoader

protected DocumentLoader documentLoader
The document loader used to load/create Document.

documentSize

protected Dimension2D documentSize
The size of the document.

domAttrModifiedEventListener

protected EventListener domAttrModifiedEventListener
The DOM EventListener to receive 'DOMAttrModified' event.

domCharacterDataModifiedEventListener

protected EventListener domCharacterDataModifiedEventListener
The DOM EventListener to receive 'DOMCharacterDataModified' event.

domNodeInsertedEventListener

protected EventListener domNodeInsertedEventListener
The DOM EventListener to receive 'DOMNodeInserted' event.

domNodeRemovedEventListener

protected EventListener domNodeRemovedEventListener
The DOM EventListener to receive 'DOMNodeRemoved' event.

dynamicStatus

protected int dynamicStatus
Whether the bridge should support dynamic, or interactive features.

DYNAMIC

public static final int DYNAMIC
Indicates that all DOM listeners should be registered. This supports 'interactivity' (anchors and cursors), as well as DOM modifications listeners to update the GVT rendering tree.

elementDataMap

protected Map elementDataMap
Element Data Map: This is a general location for elements to 'cache' data. Such as the graphics tree for a pattern or the Gradient arrays. This is a weak hash map and the data is referenced by SoftReference so both must be referenced elsewhere to stay live.

elementNodeMap

protected Map elementNodeMap
Binding Map: key is an SVG Element - value is a GraphicsNode

eventListenerSet

protected Set eventListenerSet
The list of all EventListener attached by bridges that need to be removed on a dispose() call.

extensions

protected List extensions

focusManager

protected FocusManager focusManager
The EventListener that is responsible of managing DOM focus event.

globalExtensions

protected static List globalExtensions
Returns the extensions supported by this bridge context.

gvtBuilder

protected GVTBuilder gvtBuilder
The GVT builder that might be used to create a GVT subtree.

interpreterMap

protected Map interpreterMap
The interpreter cache per document. key is the language - value is a Interpreter

interpreterPool

protected InterpreterPool interpreterPool
The interpreter pool used to handle scripts.

isSVG12

protected boolean isSVG12
Whether the document is an SVG 1.2 document.

INTERACTIVE

public static final int INTERACTIVE
Indicates that DOM listeners should be registered to support, 'interactivity' this includes anchors and cursors, but does not include support for DOM modifications.

namespaceURIMap

protected Map namespaceURIMap
Bridge Map: Keys are namespace URI - values are HashMap (with keys are local name and values are a Bridge instance).

nodeElementMap

protected Map nodeElementMap
Binding Map: key is GraphicsNode - value is a SVG Element.

primaryContext

protected BridgeContext primaryContext
The bridge context for the primary document, if this is a bridge context for a resource document.

reservedNamespaceSet

protected Set reservedNamespaceSet
Default bridge reserved namespaces set. Default bridges will not be created for elements that have a namespace URI present in this set.

STATIC

public static final int STATIC
Indicates that no DOM listeners should be registered. In this case the generated GVT tree should be totally independent of the DOM tree (in practice text holds references to the source text elements for font resolution).

textPainter

protected TextPainter textPainter
The text painter to use. Typically, you can specify the text painter that will be used be text nodes.

updateManager

protected UpdateManager updateManager
The update manager.

userAgent

protected UserAgent userAgent
The user agent.

viewportMap

protected Map viewportMap
The viewports. key is an Element - value is a Viewport

viewportStack

protected List viewportStack
The viewport stack. Used in building time.

xblManager

protected XBLManager xblManager
The XBL manager.

Constructor Detail

BridgeContext

protected BridgeContext()
Constructs a new empty bridge context.

BridgeContext

public BridgeContext(UserAgent userAgent)
Constructs a new bridge context.

Parameters: userAgent the user agent

BridgeContext

public BridgeContext(UserAgent userAgent, DocumentLoader loader)
Constructs a new bridge context.

Parameters: userAgent the user agent loader document loader

BridgeContext

public BridgeContext(UserAgent userAgent, InterpreterPool interpreterPool, DocumentLoader documentLoader)
Constructs a new bridge context.

Parameters: userAgent the user agent interpreterPool the interpreter pool documentLoader document loader

Method Detail

addDOMListeners

public void addDOMListeners()
Adds EventListeners to the DOM and CSSEngineListener to the CSSEngine to handle any modifications on the DOM tree or style properties and update the GVT tree in response.

addGVTListener

public void addGVTListener(Document doc)
Adds the GVT listener for AWT event support.

addUIEventListeners

public void addUIEventListeners(Document doc)
Adds EventListeners to the input document to handle the cursor property. This is not done in the addDOMListeners method because addDOMListeners is only used for dynamic content whereas cursor support is provided for all content. Also note that it is very important that the listeners be registered for the capture phase as the 'default' behavior for cursors is handled by the BridgeContext during the capture phase and the 'custom' behavior (handling of 'auto' on anchors, for example), is handled during the bubbling phase.

bind

public void bind(Node node, GraphicsNode gn)
Binds the specified GraphicsNode to the specified Node. This method automatically bind the graphics node to the element and the element to the graphics node.

Parameters: node the DOM Node to bind to the specified graphics node gn the graphics node to bind to the specified element

checkInteractiveElement

public boolean checkInteractiveElement(Element e)
used by isInteractiveDocument to check if document contains any 'interactive' elements.

checkInteractiveElement

public boolean checkInteractiveElement(SVGDocument doc, Element e)
used by isInteractiveDocument to check if document contains any 'interactive' elements.

checkLoadExternalResource

public void checkLoadExternalResource(ParsedURL resourceURL, ParsedURL docURL)
This method throws a SecurityException if the resource found at url and referenced from docURL should not be loaded. This is a convenience method to call checkLoadExternalResource on the ExternalResourceSecurity strategy returned by getExternalResourceSecurity.

Parameters: resourceURL url for the script, as defined in the resource's xlink:href attribute. If that attribute was empty, then this parameter should be null docURL url for the document into which the resource was found.

clearChildContexts

protected void clearChildContexts()
Clears the list of child BridgeContexts and disposes them if there are no more references to them.

closeViewport

public void closeViewport(Element e)
Closes the viewport associated to the specified element.

Parameters: e the element that closes its viewport

createBridgeContext

public BridgeContext createBridgeContext(SVGOMDocument doc)
This function creates a new BridgeContext, it mostly exists so subclasses can provide an instance of themselves when a sub BridgeContext is needed.

createSubBridgeContext

public BridgeContext createSubBridgeContext(SVGOMDocument newDoc)
This function creates a new 'sub' BridgeContext to associated with 'newDoc' if one currently doesn't exist, otherwise it returns the BridgeContext currently associated with the document.

Parameters: newDoc The document to get/create a BridgeContext for.

createURIResolver

public URIResolver createURIResolver(SVGDocument doc, DocumentLoader dl)
Returns a new URIResolver object.

dispose

public void dispose()
Disposes this BridgeContext.

finalize

protected void finalize()
Calls dispose on this BridgeContext, if it is a child context.

getAnimationEngine

public SVGAnimationEngine getAnimationEngine()
Returns the AnimationEngine for the document. Creates one if it doesn't exist.

getBlockHeight

public float getBlockHeight(Element elt)
Returns the height of the block which directly contains the given element.

getBlockWidth

public float getBlockWidth(Element elt)
Returns the width of the block which directly contains the given element.

getBolderFontWeight

public float getBolderFontWeight(float f)
Returns a bolder font-weight.

getBridge

public Bridge getBridge(Element element)
Returns the bridge associated with the specified element.

Parameters: element the element

getBridge

public Bridge getBridge(String namespaceURI, String localName)
Returns the bridge associated with the element type

Parameters: namespaceURI namespace of the requested element localName element's local name

getBridgeExtensions

public List getBridgeExtensions(Document doc)

getBridgeUpdateHandler

protected static BridgeUpdateHandler getBridgeUpdateHandler(Node node)
Returns the BridgeUpdateHandler associated to the specified Node or null if there is none.

getChildContexts

public BridgeContext[] getChildContexts()
Returns an array of the child contexts.

getCSSEngineForElement

public CSSEngine getCSSEngineForElement(Element e)
Returns the CSS engine associated with given element.

getCursorManager

public CursorManager getCursorManager()
Returns the cursor manager

getDefaultFontFamily

public Value getDefaultFontFamily()
Returns the value corresponding to the default font.

getDocument

public Document getDocument()
Returns the document this bridge context is dedicated to.

getDocumentBridge

public DocumentBridge getDocumentBridge()
Returns the bridge for the document node.

getDocumentLoader

public DocumentLoader getDocumentLoader()
Returns the document loader used to load external documents.

getDocumentSize

public Dimension2D getDocumentSize()
Returns the actual size of the document or null if the document has not been built yet.

getElement

public Element getElement(GraphicsNode gn)
Returns the Node associated to the specified GraphicsNode or null if any.

Parameters: gn the graphics node associated to the element to return

getElementData

public Object getElementData(Node n)
Retrieves a data object associated with the given node.

getFocusManager

public FocusManager getFocusManager()
Returns the focus manager.

getFontFamilyMap

public Map getFontFamilyMap()
Returns the map of font families

getGlobalBridgeExtensions

public static List getGlobalBridgeExtensions()

getGraphicsNode

public GraphicsNode getGraphicsNode(Node node)
Returns the GraphicsNode associated to the specified Node or null if any.

Parameters: node the DOM Node associated to the graphics node to return

getGVTBuilder

public GVTBuilder getGVTBuilder()
Returns the GVT builder that is currently used to build the GVT tree.

getInterpreter

public Interpreter getInterpreter(String language)
Returns a Interpreter for the specified language.

Parameters: language the scripting language

getInterpreterPool

public InterpreterPool getInterpreterPool()
Returns the interpreter pool used to handle scripts.

getLighterFontWeight

public float getLighterFontWeight(float f)
Returns a lighter font-weight.

getMediumFontSize

public float getMediumFontSize()
Returns the medium font size.

getPixelToMillimeter

public float getPixelToMillimeter()
Returns the size of a px CSS unit in millimeters. This will be removed after next release.

See Also: getPixelUnitToMillimeter

getPixelUnitToMillimeter

public float getPixelUnitToMillimeter()
Returns the size of a px CSS unit in millimeters.

getPrimaryBridgeContext

public BridgeContext getPrimaryBridgeContext()
Returns the primary bridge context.

getReferencedElement

public Element getReferencedElement(Element e, String uri)
Returns the element referenced by the specified element by the specified uri. The referenced element can not be a Document.

Parameters: e the element referencing uri the uri of the referenced element

getReferencedNode

public Node getReferencedNode(Element e, String uri)
Returns the node referenced by the specified element by the specified uri. The referenced node can be either an element given by a fragment ID, or the document node.

Parameters: e the element referencing uri the uri of the referenced node

getSVGContext

protected static SVGContext getSVGContext(Node node)
Returns the SVGContext associated to the specified Node or null if there is none.

getSystemColor

public Value getSystemColor(String ident)
Returns the Value corresponding to the given system color.

getTextPainter

public TextPainter getTextPainter()
Returns the text painter that will be used be text nodes.

getUpdateManager

public UpdateManager getUpdateManager()
Returns the update manager, if the bridge supports dynamic features.

getUserAgent

public UserAgent getUserAgent()
Returns the user agent of this bridge context.

getViewport

public Viewport getViewport(Element e)
Returns the viewport of the specified element.

Parameters: e the element interested in its viewport

hasGraphicsNodeBridge

public boolean hasGraphicsNodeBridge(Element element)
Returns true if the specified element has a GraphicsNodeBridge associated to it, false otherwise.

Parameters: element the element

initializeDocument

protected void initializeDocument(Document document)
Initializes the given document.

isDynamic

public boolean isDynamic()
Returns true if the document is dynamic, false otherwise.

isDynamicDocument

public boolean isDynamicDocument(Document doc)
Tells whether the given SVG document is dynamic.

isInteractive

public boolean isInteractive()
Returns true if the document is interactive, false otherwise.

isInteractiveDocument

public boolean isInteractiveDocument(Document doc)
Tells whether the given SVG document is Interactive. We say it is, if it has any <title>, <desc>, or <a> elements, of if the 'cursor' property is anything but Auto on any element.

isSVG12

public boolean isSVG12()
Returns whether the managed document is an SVG 1.2 document.

openViewport

public void openViewport(Element e, Viewport viewport)
Starts a new viewport from the specified element.

Parameters: e the element that defines a new viewport viewport the viewport of the element

putBridge

public void putBridge(String namespaceURI, String localName, Bridge bridge)
Associates the specified Bridge object with the specified namespace URI and local name.

Parameters: namespaceURI the namespace URI localName the local name bridge the bridge that manages the element

putBridge

public void putBridge(Bridge bridge)
Associates the specified Bridge object with it's namespace URI and local name.

Parameters: bridge the bridge that manages the element

putReservedNamespaceURI

public void putReservedNamespaceURI(String namespaceURI)
Adds a namespace URI to avoid when creating default bridges.

registerSVGBridges

public void registerSVGBridges()
Registers the bridges to handle SVG 1.0 elements.

removeBridge

public void removeBridge(String namespaceURI, String localName)
Removes the Bridge object associated to the specified namespace URI and local name.

Parameters: namespaceURI the namespace URI localName the local name

removeDOMListeners

protected void removeDOMListeners()
Removes event listeners from the DOM and CSS engine.

removeReservedNamespaceURI

public void removeReservedNamespaceURI(String namespaceURI)
Removes a namespace URI to avoid when creating default bridges.

removeUIEventListeners

public void removeUIEventListeners(Document doc)

removeViewport

public void removeViewport(Element e)

setAnimationLimitingCPU

public void setAnimationLimitingCPU(float pc)
Sets the animation limiting mode to a percentage of CPU.

Parameters: pc the maximum percentage of CPU to use (0 < pc ≤ 1)

setAnimationLimitingFPS

public void setAnimationLimitingFPS(float fps)
Sets the animation limiting mode to a number of frames per second.

Parameters: fps the maximum number of frames per second (fps > 0)

setAnimationLimitingMode

protected void setAnimationLimitingMode()
Set the animationg limiting mode on the animation engine.

setAnimationLimitingNone

public void setAnimationLimitingNone()
Sets the animation limiting mode to "none".

setDefaultBridge

public void setDefaultBridge(Bridge bridge)
Sets the Bridge object to be used for foreign namespace elements.

Parameters: bridge the bridge that manages the element

setDocument

protected void setDocument(Document document)
Sets the document this bridge context is dedicated to, to the specified document.

Parameters: document the document

setDocumentLoader

protected void setDocumentLoader(DocumentLoader newDocumentLoader)
Sets the document loader used to load external documents.

Parameters: newDocumentLoader the new document loader

setDocumentSize

protected void setDocumentSize(Dimension2D d)
Sets the size of the document to the specified dimension.

Parameters: d the actual size of the SVG document

setDynamic

public void setDynamic(boolean dynamic)
Sets the document as DYNAMIC if dynamic is true STATIC otherwise.

setDynamicState

public void setDynamicState(int status)
Sets the document as a STATIC, INTERACTIVE or DYNAMIC document. Call this method before the build phase (ie. before gvtBuilder.build(...)) otherwise, that will have no effect.

Parameters: status the document dynamicStatus

setElementData

public void setElementData(Node n, Object data)
Associates a data object with a node so it can be retrieved later. This is primarily used for caching the graphics node generated from a 'pattern' element. A soft reference to the data object is used.

setFontFamilyMap

protected void setFontFamilyMap(Map fontFamilyMap)
Sets the map of font families to the specified value.

Parameters: fontFamilyMap the map of font families

setGVTBuilder

protected void setGVTBuilder(GVTBuilder gvtBuilder)
Sets the GVT builder that uses this context.

setInteractive

public void setInteractive(boolean interactive)
Sets the document as INTERACTIVE if interactive is true STATIC otherwise.

setInterpreterPool

protected void setInterpreterPool(InterpreterPool interpreterPool)
Sets the interpreter pool used to handle scripts to the specified interpreter pool.

Parameters: interpreterPool the interpreter pool

setTextPainter

public void setTextPainter(TextPainter textPainter)
Sets the text painter that will be used by text nodes. This attributes might be used by bridges (especially SVGTextElementBridge) to set the text painter of each TextNode.

Parameters: textPainter the text painter for text nodes

setUpdateManager

protected void setUpdateManager(UpdateManager um)
Sets the update manager.

setUpdateManager

protected void setUpdateManager(BridgeContext ctx, UpdateManager um)
Sets the update manager on the given BridgeContext.

setUserAgent

protected void setUserAgent(UserAgent userAgent)
Sets the user agent to the specified user agent.

Parameters: userAgent the user agent

setXBLManager

protected void setXBLManager(BridgeContext ctx, XBLManager xm)
Sets the xblManager variable of the given BridgeContext.

storeEventListener

protected void storeEventListener(EventTarget t, String s, EventListener l, boolean b)
Adds to the eventListenerSet the specified event listener registration.

storeEventListenerNS

protected void storeEventListenerNS(EventTarget t, String n, String s, EventListener l, boolean b)
Adds to the eventListenerSet the specified event listener registration.

unbind

public void unbind(Node node)
Removes the binding of the specified Node.

Parameters: node the DOM Node to unbind

Copyright B) 2008 Apache Software Foundation. All Rights Reserved.