|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.batik.bridge.BridgeContext
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.
Field Summary | |
protected DocumentLoader |
documentLoader
The document loader used to load/create Document. |
protected java.awt.geom.Dimension2D |
documentSize
The size of the document. |
protected java.util.HashMap |
elementNodeMap
Binding Map: key is an SVG Element - value is a GraphicsNode |
protected java.util.HashMap |
elementStyleAttMap
Binding Map: key is style Element - value is a list of styleReference |
protected GVTBuilder |
gvtBuilder
The GVT builder that might be used to create a GVT subtree. |
protected InterpreterPool |
interpreterPool
The interpreter pool used to handle scripts. |
protected java.util.HashMap |
namespaceURIMap
Bridge Map: Keys are namespace URI - values are HashMap (with keys are local name and values are a Bridge instance). |
protected java.util.HashMap |
nodeElementMap
Binding Map: key is GraphicsNode - value is a SVG Element. |
protected java.util.HashMap |
nodeStyleMap
Binding Map: key is GraphicsNode - value is list of StyleElement. |
protected TextPainter |
textPainter
The text painter to use. |
protected UserAgent |
userAgent
The user agent. |
protected java.util.Map |
viewportMap
The viewports. key is an Element - value is a Viewport |
protected java.util.List |
viewportStack
The viewport stack. |
Fields inherited from interface org.apache.batik.bridge.ErrorConstants |
ERR_ATTRIBUTE_MISSING, ERR_ATTRIBUTE_VALUE_MALFORMED, ERR_CSS_LENGTH_NEGATIVE, ERR_CSS_URI_BAD_TARGET, ERR_LENGTH_NEGATIVE, ERR_URI_BAD_TARGET, ERR_URI_IMAGE_INVALID, ERR_URI_IO, ERR_URI_MALFORMED, ERR_URI_REFERENCE_A_DOCUMENT, ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES, MSG_BROKEN_LINK_TITLE |
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 |
bind(Element element,
GraphicsNode node)
Binds the specified GraphicsNode to the specified Element. |
void |
bind(Element element,
StyleReference reference)
Binds a style element to a style reference. |
void |
closeViewport(Element e)
Closes the viewport associated to the specified element. |
Bridge |
getBridge(Element element)
Returns the bridge associated with the specified element. |
Bridge |
getBridge(java.lang.String namespaceURI,
java.lang.String localName)
Returns the bridge associated with the element type |
static java.util.List |
getBridgeExtensions()
|
DocumentLoader |
getDocumentLoader()
Returns the document loader used to load external documents. |
java.awt.geom.Dimension2D |
getDocumentSize()
Returns the actual size of the document or null if the document has not been built yet. |
Element |
getElement(GraphicsNode node)
Returns the Element associated to the specified GraphicsNode or null if any. |
GraphicsNode |
getGraphicsNode(Element element)
Returns the GraphicsNode associated to the specified Element or null if any. |
GVTBuilder |
getGVTBuilder()
Returns the GVT builder that is currently used to build the GVT tree. |
InterpreterPool |
getInterpreterPool()
Returns the interpreter pool used to handle scripts. |
Element |
getReferencedElement(Element e,
java.lang.String uri)
Returns the element referenced by the specified element by the specified uri. |
java.util.List |
getStyleReferenceList(Element element)
Returns an enumeration of all style refence for the specified style element. |
TextPainter |
getTextPainter()
Returns the text painter that will be used be text nodes. |
UserAgent |
getUserAgent()
Returns the user agent of this bridge context. |
Viewport |
getViewport(Element e)
Returns the viewport of the specified element. |
boolean |
isDynamic()
Returns true if the bridge should support dynamic SVG content, false otherwise. |
void |
openViewport(Element e,
Viewport viewport)
Starts a new viewport from the specified element. |
void |
putBridge(Bridge bridge)
Associates the specified Bridge object with it's namespace URI and local name. |
void |
putBridge(java.lang.String namespaceURI,
java.lang.String localName,
Bridge bridge)
Associates the specified Bridge object with the specified namespace URI and local name. |
static void |
registerSVGBridges(BridgeContext ctx)
Registers the bridges to handle SVG 1.0 elements. |
void |
removeBridge(java.lang.String namespaceURI,
java.lang.String localName)
Removes the Bridge object associated to the specified namespace URI and local name. |
protected void |
setDocumentLoader(DocumentLoader newDocumentLoader)
Sets the document loader used to load external documents. |
protected void |
setDocumentSize(java.awt.geom.Dimension2D d)
Sets the size of the document to the specified dimension. |
protected void |
setGVTBuilder(GVTBuilder gvtBuilder)
Sets the GVT builder that uses this context. |
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 |
setUserAgent(UserAgent userAgent)
Sets the user agent to the specified user agent. |
void |
unbind(Element element)
Removes the binding of the specified Element. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected GVTBuilder gvtBuilder
protected java.util.Map viewportMap
protected java.util.List viewportStack
protected UserAgent userAgent
protected java.util.HashMap elementNodeMap
protected java.util.HashMap nodeElementMap
protected java.util.HashMap elementStyleAttMap
protected java.util.HashMap nodeStyleMap
protected java.util.HashMap namespaceURIMap
protected InterpreterPool interpreterPool
protected DocumentLoader documentLoader
protected java.awt.geom.Dimension2D documentSize
protected TextPainter textPainter
Constructor Detail |
protected BridgeContext()
public BridgeContext(UserAgent userAgent)
userAgent
- the user agentpublic BridgeContext(UserAgent userAgent, DocumentLoader loader)
userAgent
- the user agentdocumentLoader
- document loaderpublic BridgeContext(UserAgent userAgent, InterpreterPool interpreterPool, DocumentLoader documentLoader)
userAgent
- the user agentinterpreterPool
- the interpreter pooldocumentLoader
- document loaderMethod Detail |
public void setTextPainter(TextPainter textPainter)
textPainter
- the text painter for text nodespublic TextPainter getTextPainter()
public UserAgent getUserAgent()
protected void setUserAgent(UserAgent userAgent)
userAgent
- the user agentprotected void setGVTBuilder(GVTBuilder gvtBuilder)
public GVTBuilder getGVTBuilder()
public InterpreterPool getInterpreterPool()
protected void setInterpreterPool(InterpreterPool interpreterPool)
interpreterPool
- the interpreter poolpublic DocumentLoader getDocumentLoader()
protected void setDocumentLoader(DocumentLoader newDocumentLoader)
newDocumentLoader
- the new document loaderpublic Element getReferencedElement(Element e, java.lang.String uri)
e
- the element referencinguri
- the uri of the referenced elementpublic java.awt.geom.Dimension2D getDocumentSize()
protected void setDocumentSize(java.awt.geom.Dimension2D d)
d
- the actual size of the SVG documentpublic Viewport getViewport(Element e)
e
- the element interested in its viewportpublic void openViewport(Element e, Viewport viewport)
e
- the element that starts the viewportviewport
- the viewport of the elementpublic void closeViewport(Element e)
e
- the element that closes its viewportpublic boolean isDynamic()
public void bind(Element element, GraphicsNode node)
element
- the element to bind to the specified graphics nodenode
- the graphics node to bind to the specified elementpublic void unbind(Element element)
element
- the element to unbindpublic GraphicsNode getGraphicsNode(Element element)
element
- the element associated to the graphics node to returnpublic Element getElement(GraphicsNode node)
node
- the graphics node associated to the element to returnpublic void bind(Element element, StyleReference reference)
element
- the elementreference
- the style referencepublic java.util.List getStyleReferenceList(Element element)
element
- the elementpublic Bridge getBridge(Element element)
element
- the elementpublic Bridge getBridge(java.lang.String namespaceURI, java.lang.String localName)
nameSpaceURI
- namespace of the requested elementlocalName
- element's local namepublic void putBridge(java.lang.String namespaceURI, java.lang.String localName, Bridge bridge)
namespaceURI
- the namespace URIlocalName
- the local namebridge
- the bridge that manages the elementpublic void putBridge(Bridge bridge)
bridge
- the bridge that manages the elementpublic void removeBridge(java.lang.String namespaceURI, java.lang.String localName)
namespaceURI
- the namespace URIlocalName
- the local namepublic static void registerSVGBridges(BridgeContext ctx)
ctx
- the bridge context to initializepublic static java.util.List getBridgeExtensions()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |