org.apache.batik.bridge
public class BridgeContext extends Object implements ErrorConstants, CSSContext
| Nested Class Summary | |
|---|---|
| protected class | BridgeContext.AnimatedAttrListener
A listener class for changes to animated attributes in the document. |
| static class | BridgeContext.CSSEngineUserAgentWrapper |
| protected class | BridgeContext.CSSPropertiesChangedListener
The CSSEngineListener invoked when CSS properties are modified
on a particular element. |
| protected class | BridgeContext.DOMAttrModifiedEventListener
The DOM EventListener invoked when an attribute is modified. |
| protected class | BridgeContext.DOMCharacterDataModifiedEventListener
The DOM EventListener invoked when a character data is changed. |
| protected class | BridgeContext.DOMMouseOutEventListener
The DOM EventListener invoked when the mouse exits an element |
| protected class | BridgeContext.DOMMouseOverEventListener
The DOM EventListener invoked when the mouse mouves over a new
element.
|
| protected class | BridgeContext.DOMNodeInsertedEventListener
The DOM EventListener invoked when a node is added. |
| protected class | BridgeContext.DOMNodeRemovedEventListener
The DOM EventListener invoked when a node is removed. |
| protected static class | BridgeContext.EventListenerMememto
A class used to store an EventListener added to the DOM. |
| static class | BridgeContext.SoftReferenceMememto |
| Field Summary | |
|---|---|
| protected AnimatedAttributeListener | animatedAttributeListener
The listener to receive notification of animated attribute changes. |
| protected SVGAnimationEngine | animationEngine
The animation engine for the document. |
| protected float | animationLimitingAmount
The amount of animation limiting. |
| protected int | animationLimitingMode
The animation limiting mode. |
| protected HashSet | childContexts
Set of WeakReferences to child BridgeContexts. |
| protected CSSEngineListener | cssPropertiesChangedListener
The CSSEngine listener to receive CSSEngineEvent. |
| protected CursorManager | cursorManager
Manages cursors and performs caching when appropriate |
| protected Bridge | defaultBridge
Default bridge.
|
| protected Document | document
The document is bridge context is dedicated to. |
| protected DocumentLoader | documentLoader
The document loader used to load/create Document. |
| protected Dimension2D | documentSize
The size of the document. |
| protected EventListener | domAttrModifiedEventListener
The DOM EventListener to receive 'DOMAttrModified' event. |
| protected EventListener | domCharacterDataModifiedEventListener
The DOM EventListener to receive 'DOMCharacterDataModified' event. |
| protected EventListener | domNodeInsertedEventListener
The DOM EventListener to receive 'DOMNodeInserted' event. |
| protected EventListener | domNodeRemovedEventListener
The DOM EventListener to receive 'DOMNodeRemoved' event. |
| protected int | dynamicStatus
Whether the bridge should support dynamic, or interactive features. |
| static int | DYNAMIC
Indicates that all DOM listeners should be registered. |
| protected Map | elementDataMap
Element Data Map:
This is a general location for elements to 'cache'
data. |
| protected Map | elementNodeMap
Binding Map:
key is an SVG Element -
value is a GraphicsNode |
| protected Set | eventListenerSet
The list of all EventListener attached by bridges that need to
be removed on a dispose() call. |
| protected List | extensions |
| protected FocusManager | focusManager
The EventListener that is responsible of managing DOM focus event. |
| protected static List | globalExtensions
Returns the extensions supported by this bridge context. |
| protected GVTBuilder | gvtBuilder
The GVT builder that might be used to create a GVT subtree. |
| protected Map | interpreterMap
The interpreter cache per document.
key is the language -
value is a Interpreter |
| protected InterpreterPool | interpreterPool
The interpreter pool used to handle scripts. |
| protected boolean | isSVG12
Whether the document is an SVG 1.2 document. |
| static 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. |
| protected Map | namespaceURIMap
Bridge Map:
Keys are namespace URI - values are HashMap (with keys are local
name and values are a Bridge instance). |
| protected Map | nodeElementMap
Binding Map:
key is GraphicsNode -
value is a SVG Element. |
| protected BridgeContext | primaryContext
The bridge context for the primary document, if this is a bridge
context for a resource document. |
| protected Set | reservedNamespaceSet
Default bridge reserved namespaces set.
|
| static int | STATIC
Indicates that no DOM listeners should be registered. |
| protected TextPainter | textPainter
The text painter to use. |
| protected UpdateManager | updateManager
The update manager. |
| protected UserAgent | userAgent
The user agent. |
| protected Map | viewportMap
The viewports.
key is an Element -
value is a Viewport |
| protected List | viewportStack
The viewport stack. |
| protected XBLManager | xblManager
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 | |
|---|---|
| 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. |
| void | addGVTListener(Document doc)
Adds the GVT listener for AWT event support. |
| void | addUIEventListeners(Document doc)
Adds EventListeners to the input document to handle the cursor
property.
|
| void | bind(Node node, GraphicsNode gn)
Binds the specified GraphicsNode to the specified Node. |
| boolean | checkInteractiveElement(Element e)
used by isInteractiveDocument to check if document
contains any 'interactive' elements. |
| boolean | checkInteractiveElement(SVGDocument doc, Element e)
used by isInteractiveDocument to check if document
contains any 'interactive' elements. |
| 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.
|
| protected void | clearChildContexts()
Clears the list of child BridgeContexts and disposes them if there are
no more references to them. |
| void | closeViewport(Element e)
Closes the viewport associated to the specified element. |
| 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. |
| 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. |
| URIResolver | createURIResolver(SVGDocument doc, DocumentLoader dl)
Returns a new URIResolver object. |
| void | dispose()
Disposes this BridgeContext. |
| protected void | finalize()
Calls dispose on this BridgeContext, if it is a child context. |
| SVGAnimationEngine | getAnimationEngine()
Returns the AnimationEngine for the document. |
| float | getBlockHeight(Element elt)
Returns the height of the block which directly contains the
given element. |
| float | getBlockWidth(Element elt)
Returns the width of the block which directly contains the
given element. |
| float | getBolderFontWeight(float f)
Returns a bolder font-weight. |
| Bridge | getBridge(Element element)
Returns the bridge associated with the specified element.
|
| Bridge | getBridge(String namespaceURI, String localName)
Returns the bridge associated with the element type
|
| List | getBridgeExtensions(Document doc) |
| protected static BridgeUpdateHandler | getBridgeUpdateHandler(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. |
| CSSEngine | getCSSEngineForElement(Element e)
Returns the CSS engine associated with given element. |
| CursorManager | getCursorManager()
Returns the cursor manager |
| Value | getDefaultFontFamily()
Returns the value corresponding to the default font. |
| Document | getDocument()
Returns the document this bridge context is dedicated to. |
| DocumentBridge | getDocumentBridge()
Returns the bridge for the document node. |
| DocumentLoader | getDocumentLoader()
Returns the document loader used to load external documents. |
| Dimension2D | getDocumentSize()
Returns the actual size of the document or null if the document
has not been built yet. |
| Element | getElement(GraphicsNode gn)
Returns the Node associated to the specified GraphicsNode or
null if any.
|
| Object | getElementData(Node n)
Retrieves a data object associated with the given node. |
| FocusManager | getFocusManager()
Returns the focus manager. |
| Map | getFontFamilyMap()
Returns the map of font families |
| static List | getGlobalBridgeExtensions() |
| GraphicsNode | getGraphicsNode(Node node)
Returns the GraphicsNode associated to the specified Node or
null if any.
|
| GVTBuilder | getGVTBuilder()
Returns the GVT builder that is currently used to build the GVT tree. |
| Interpreter | getInterpreter(String language)
Returns a Interpreter for the specified language.
|
| InterpreterPool | getInterpreterPool()
Returns the interpreter pool used to handle scripts. |
| float | getLighterFontWeight(float f)
Returns a lighter font-weight. |
| float | getMediumFontSize()
Returns the medium font size. |
| float | getPixelToMillimeter()
Returns the size of a px CSS unit in millimeters.
|
| float | getPixelUnitToMillimeter()
Returns the size of a px CSS unit in millimeters. |
| BridgeContext | getPrimaryBridgeContext()
Returns the primary bridge context. |
| Element | getReferencedElement(Element e, String uri)
Returns the element referenced by the specified element by the
specified uri. |
| Node | getReferencedNode(Element e, String uri)
Returns the node referenced by the specified element by the specified
uri. |
| protected static SVGContext | getSVGContext(Node node)
Returns the SVGContext associated to the specified Node or null if
there is none. |
| Value | getSystemColor(String ident)
Returns the Value corresponding to the given system color. |
| TextPainter | getTextPainter()
Returns the text painter that will be used be text nodes. |
| UpdateManager | getUpdateManager()
Returns the update manager, if the bridge supports dynamic features. |
| UserAgent | getUserAgent()
Returns the user agent of this bridge context. |
| Viewport | getViewport(Element e)
Returns the viewport of the specified element.
|
| boolean | hasGraphicsNodeBridge(Element element)
Returns true if the specified element has a GraphicsNodeBridge
associated to it, false otherwise.
|
| protected void | initializeDocument(Document document)
Initializes the given document. |
| boolean | isDynamic()
Returns true if the document is dynamic, false otherwise. |
| boolean | isDynamicDocument(Document doc)
Tells whether the given SVG document is dynamic. |
| boolean | isInteractive()
Returns true if the document is interactive, false otherwise. |
| boolean | isInteractiveDocument(Document doc)
Tells whether the given SVG document is Interactive.
|
| boolean | isSVG12()
Returns whether the managed document is an SVG 1.2 document. |
| void | openViewport(Element e, Viewport viewport)
Starts a new viewport from the specified element.
|
| void | putBridge(String namespaceURI, String localName, Bridge bridge)
Associates the specified Bridge object with the specified
namespace URI and local name. |
| void | putBridge(Bridge bridge)
Associates the specified Bridge object with it's
namespace URI and local name.
|
| void | putReservedNamespaceURI(String namespaceURI)
Adds a namespace URI to avoid when creating default bridges. |
| void | registerSVGBridges()
Registers the bridges to handle SVG 1.0 elements. |
| void | removeBridge(String namespaceURI, String localName)
Removes the Bridge object associated to the specified
namespace URI and local name.
|
| protected void | removeDOMListeners()
Removes event listeners from the DOM and CSS engine. |
| void | removeReservedNamespaceURI(String namespaceURI)
Removes a namespace URI to avoid when creating default bridges. |
| void | removeUIEventListeners(Document doc) |
| void | removeViewport(Element e) |
| void | setAnimationLimitingCPU(float pc)
Sets the animation limiting mode to a percentage of CPU. |
| void | setAnimationLimitingFPS(float fps)
Sets the animation limiting mode to a number of frames per second. |
| protected void | setAnimationLimitingMode()
Set the animationg limiting mode on the animation engine. |
| void | setAnimationLimitingNone()
Sets the animation limiting mode to "none". |
| void | setDefaultBridge(Bridge bridge)
Sets the Bridge object to be used for foreign
namespace elements.
|
| protected void | setDocument(Document document)
Sets the document this bridge context is dedicated to, to the
specified document. |
| protected void | setDocumentLoader(DocumentLoader newDocumentLoader)
Sets the document loader used to load external documents. |
| protected void | setDocumentSize(Dimension2D d)
Sets the size of the document to the specified dimension.
|
| void | setDynamic(boolean dynamic)
Sets the document as DYNAMIC if dynamic is true
STATIC otherwise. |
| void | setDynamicState(int status)
Sets the document as a STATIC, INTERACTIVE or DYNAMIC document.
|
| void | setElementData(Node n, Object data)
Associates a data object with a node so it can be retrieved later.
|
| protected void | setFontFamilyMap(Map fontFamilyMap)
Sets the map of font families to the specified value.
|
| protected void | setGVTBuilder(GVTBuilder gvtBuilder)
Sets the GVT builder that uses this context. |
| void | setInteractive(boolean interactive)
Sets the document as INTERACTIVE if interactive is
true STATIC otherwise. |
| protected void | setInterpreterPool(InterpreterPool interpreterPool)
Sets the interpreter pool used to handle scripts to the
specified interpreter pool. |
| void | setTextPainter(TextPainter textPainter)
Sets the text painter that will be used by text nodes. |
| protected void | setUpdateManager(UpdateManager um)
Sets the update manager. |
| protected void | setUpdateManager(BridgeContext ctx, UpdateManager um)
Sets the update manager on the given BridgeContext. |
| protected void | setUserAgent(UserAgent userAgent)
Sets the user agent to the specified user agent. |
| protected void | setXBLManager(BridgeContext ctx, XBLManager xm)
Sets the xblManager variable of the given BridgeContext. |
| protected void | storeEventListener(EventTarget t, String s, EventListener l, boolean b)
Adds to the eventListenerSet the specified event listener
registration. |
| protected void | storeEventListenerNS(EventTarget t, String n, String s, EventListener l, boolean b)
Adds to the eventListenerSet the specified event listener
registration. |
| void | unbind(Node node)
Removes the binding of the specified Node.
|
Parameters: userAgent the user agent
Parameters: userAgent the user agent loader document loader
Parameters: userAgent the user agent interpreterPool the interpreter pool documentLoader document loader
Parameters: node the DOM Node to bind to the specified graphics node gn the graphics node to bind to the specified element
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.
Parameters: e the element that closes its viewport
Parameters: newDoc The document to get/create a BridgeContext for.
Parameters: element the element
Parameters: namespaceURI namespace of the requested element localName element's local name
Parameters: gn the graphics node associated to the element to return
Parameters: node the DOM Node associated to the graphics node to return
Parameters: language the scripting language
See Also: getPixelUnitToMillimeter
Parameters: e the element referencing uri the uri of the referenced element
Parameters: e the element referencing uri the uri of the referenced node
Parameters: e the element interested in its viewport
Parameters: element the element
Parameters: e the element that defines a new viewport viewport the viewport of the element
Parameters: namespaceURI the namespace URI localName the local name bridge the bridge that manages the element
Parameters: bridge the bridge that manages the element
Parameters: namespaceURI the namespace URI localName the local name
Parameters: pc the maximum percentage of CPU to use (0 < pc ≤ 1)
Parameters: fps the maximum number of frames per second (fps > 0)
Parameters: bridge the bridge that manages the element
Parameters: document the document
Parameters: newDocumentLoader the new document loader
Parameters: d the actual size of the SVG document
Parameters: status the document dynamicStatus
Parameters: fontFamilyMap the map of font families
Parameters: interpreterPool the interpreter pool
Parameters: textPainter the text painter for text nodes
Parameters: userAgent the user agent
Parameters: node the DOM Node to unbind