Package org.apache.batik.bridge.svg12
Class DefaultXBLManager
java.lang.Object
org.apache.batik.bridge.svg12.DefaultXBLManager
- All Implemented Interfaces:
XBLManager
,XBLConstants
A full featured sXBL manager.
- Version:
- $Id: DefaultXBLManager.java 1851346 2019-01-15 13:41:00Z ssteiner $
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
DOM attribute mutation listener for definition elements.protected static class
Record class for storing information about an XBL definition.protected class
DOM node inserted listener for definition elements.protected class
DOM node removed listener for definition elements.protected class
DOM node inserted listener for the document.protected class
DOM node removed listener for the document.protected class
DOM subtree mutation listener for the document.protected class
DOM attribute mutation listener for import elements.protected class
DOM node inserted listener for imported XBL trees.protected class
Record class for storing information about an XBL import.protected static class
DOM node removed listener for imported XBL trees.protected class
DOM subtree listener for imported XBL trees.protected class
DOM attribute mutation listener for referencing definition elements.protected class
DOM mutation listener for template elements.protected class
To iterate over the XBL child nodes.protected class
XBL record.protected class
To iterate over the scoped XBL child nodes. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected EventListenerList
Global event listener list for XBL binding related events.protected Map
Map of shadow trees to content managers.protected EventListenerList
Global event listener list for ContentSelectionChanged events.protected BridgeContext
The BridgeContext.protected DoublyIndexedTable
Map of namespace URI/local name pairs to ordered sets of definition records.protected DoublyIndexedTable
Map of definition element/import element pairs to definition records.protected DefaultXBLManager.DocInsertedListener
DOM node inserted listener for the document.protected DefaultXBLManager.DocRemovedListener
DOM node removed listener for the document.protected DefaultXBLManager.DocSubtreeListener
DOM subtree mutation listener for the document.protected Document
The document.protected DefaultXBLManager.ImportAttrListener
DOM attribute listener for import elements.protected Map
Map of import elements to import records.protected boolean
Whether XBL processing is currently taking place.protected DefaultXBLManager.RefAttrListener
DOM attribute listener for referencing definition elements.Fields inherited from interface org.apache.batik.util.XBLConstants
XBL_BINDINGS_ATTRIBUTE, XBL_BOUND_EVENT_TYPE, XBL_CONTENT_TAG, XBL_DEFINITION_TAG, XBL_ELEMENT_ATTRIBUTE, XBL_HANDLER_GROUP_TAG, XBL_IMPORT_TAG, XBL_INCLUDES_ATTRIBUTE, XBL_NAMESPACE_URI, XBL_ONBOUND_ATTRIBUTE, XBL_ONPREBIND_ATTRIBUTE, XBL_ONUNBINDING_ATTRIBUTE, XBL_PREBIND_EVENT_TYPE, XBL_REF_ATTRIBUTE, XBL_SHADOW_TREE_TAG, XBL_TEMPLATE_TAG, XBL_UNBINDING_EVENT_TYPE, XBL_XBL_TAG
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultXBLManager
(Document doc, BridgeContext ctx) Creates a new DefaultXBLManager for the given document. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the specified BindingListener to the global listener list.void
Adds the specified ContentSelectionChangedListener to the global listener list.protected void
addDefinition
(String namespaceURI, String localName, XBLOMDefinitionElement def, Element imp) Adds an xbl:definition element to the list of definitions that could possibly affect elements with the specified QName.protected void
Adds DOM mutation listeners to the given definition element.protected void
addDefinitionRef
(Element defRef) Adds a definition through its referring definition element (one with a 'ref' attribute).protected void
Imports bindings from another document.protected void
addImportedDefinitions
(Element imp, Node n) Adds the definitions in the given imported subtree.protected void
Adds DOM mutation listeners to the given template element.protected void
Binds each bindable element in the given element's subtree.protected XBLOMShadowTreeElement
cloneTemplate
(XBLOMTemplateElement template) Clones a template element for use as a shadow tree.static int
computeBubbleLimit
(Node from, Node to) Determines the number of nodes events should bubble if the mouse pointer has moved from one element to another.protected void
dispatchBindingChangedEvent
(Element bindableElement, Element shadowTree) Dispatches a BindingEvent the registered listeners.protected void
fireShadowTreeEvent
(BindableElement elt, String type, XBLShadowTreeElement e) Fires a ShadowTreeEvent of the given type on this element.protected DefaultXBLManager.DefinitionRecord
getActiveDefinition
(String namespaceURI, String localName) Returns the definition record of the active definition for namespace URI/local name pair.Returns the ContentManager that handles the shadow tree the given node resides in.protected Object[]
Returns an array of the gloabl ContentSelectionChangedListeners.protected DefaultXBLManager.XBLRecord
Returns the XBL record for the given node.Get the bound element whose shadow tree a node resides in.Get the list of child nodes of a node in the fully flattened tree.Returns the content element that caused the given node to be present in the flattened tree.Get the xbl:definition elements currently binding an element.Get the first child node of a node in the fully flattened tree.Get the first element child of a node in the fully flattened tree.Get the last child node of a node in the fully flattened tree.Get the last element child of a node in the fully flattened tree.Get the first element that follows a node in the xblParentNode's xblChildNodes list.Get the node which directly follows a node in the xblParentNode's xblChildNodes list.Get the parent of a node in the fully flattened tree.Get the first element that precedes the a node in the xblParentNode's xblChildNodes list.Get the node which directly precedes a node in the xblParentNode's xblChildNodes list.Get the list of child nodes of a node in the fully flattened tree that are within the same shadow scope.Get the shadow tree of a node.void
Mark the xblChildNodes and xblScopedChildNodes variables as invalid.protected boolean
isActiveDefinition
(XBLOMDefinitionElement def, Element imp) Returns whether the given definition element is the active one for its element name.boolean
Returns whether XBL processing is currently enabled.protected void
Rebinds each bindable element of the given name in the given element's subtree.void
Removes the specified BindingListener from the global listener list.void
Removes the specified ContentSelectionChangedListener from the global listener list.protected void
Removes an xbl:definition element from the list of definitions that could possibly affect elements with the specified QName.protected void
Removes DOM mutation listeners from the given definition element.protected void
removeDefinitionRef
(Element defRef) Removes a definition through its referring definition element (one with a 'ref' attribute).protected void
removeImport
(Element imp) Removes an import.protected void
Removes DOM mutation listeners from the given template element.protected void
Sets the given definition as the active one for a particular bindable element.(package private) void
setContentManager
(Element shadow, ContentManager cm) Records the ContentManager that handles the given shadow tree.protected void
setXblShadowTree
(BindableElement elt, XBLOMShadowTreeElement newShadow) Sets the shadow tree for the given bindable element.(package private) void
shadowTreeSelectedContentChanged
(Set deselected, Set selected) Called by the ContentManager of a shadow tree to indicate some selected nodes have changed.void
Starts XBL processing on the document.void
Stops XBL processing on the document.protected void
Unbinds each bindable element in the given element's subtree.protected void
updateLinks
(Node n) Updates the xblPreviousSibling and xblNextSibling properties of the given XBL node.
-
Field Details
-
isProcessing
protected boolean isProcessingWhether XBL processing is currently taking place. -
document
The document. -
ctx
The BridgeContext. -
definitionLists
Map of namespace URI/local name pairs to ordered sets of definition records. -
definitions
Map of definition element/import element pairs to definition records. -
contentManagers
Map of shadow trees to content managers. -
imports
Map of import elements to import records. -
docInsertedListener
DOM node inserted listener for the document. -
docRemovedListener
DOM node removed listener for the document. -
docSubtreeListener
DOM subtree mutation listener for the document. -
importAttrListener
DOM attribute listener for import elements. -
refAttrListener
DOM attribute listener for referencing definition elements. -
bindingListenerList
Global event listener list for XBL binding related events. -
contentSelectionChangedListenerList
Global event listener list for ContentSelectionChanged events.
-
-
Constructor Details
-
DefaultXBLManager
Creates a new DefaultXBLManager for the given document.
-
-
Method Details
-
startProcessing
public void startProcessing()Starts XBL processing on the document.- Specified by:
startProcessing
in interfaceXBLManager
-
stopProcessing
public void stopProcessing()Stops XBL processing on the document.- Specified by:
stopProcessing
in interfaceXBLManager
-
isProcessing
public boolean isProcessing()Returns whether XBL processing is currently enabled.- Specified by:
isProcessing
in interfaceXBLManager
-
addDefinitionRef
Adds a definition through its referring definition element (one with a 'ref' attribute). -
removeDefinitionRef
Removes a definition through its referring definition element (one with a 'ref' attribute). -
addImport
Imports bindings from another document. -
addImportedDefinitions
Adds the definitions in the given imported subtree. -
removeImport
Removes an import. -
addDefinition
protected void addDefinition(String namespaceURI, String localName, XBLOMDefinitionElement def, Element imp) Adds an xbl:definition element to the list of definitions that could possibly affect elements with the specified QName. This may or may not actually cause a new binding to come in to effect, as this new definition element may be added earlier in the document than another already in effect.- Parameters:
namespaceURI
- the namespace URI of the bound elementslocalName
- the local name of the bound elementsdef
- the xbl:definition elementimp
- the xbl:import or xbl;definition element through which this definition is being added, or null if the binding is in the original document
-
addDefinitionElementListeners
protected void addDefinitionElementListeners(XBLOMDefinitionElement def, DefaultXBLManager.ImportRecord ir) Adds DOM mutation listeners to the given definition element. -
addTemplateElementListeners
protected void addTemplateElementListeners(XBLOMTemplateElement template, DefaultXBLManager.ImportRecord ir) Adds DOM mutation listeners to the given template element. -
removeDefinition
Removes an xbl:definition element from the list of definitions that could possibly affect elements with the specified QName. This will only cause a new binding to come in to effect if it is currently active. -
removeDefinitionElementListeners
protected void removeDefinitionElementListeners(XBLOMDefinitionElement def, DefaultXBLManager.ImportRecord ir) Removes DOM mutation listeners from the given definition element. -
removeTemplateElementListeners
protected void removeTemplateElementListeners(XBLOMTemplateElement template, DefaultXBLManager.ImportRecord ir) Removes DOM mutation listeners from the given template element. -
getActiveDefinition
protected DefaultXBLManager.DefinitionRecord getActiveDefinition(String namespaceURI, String localName) Returns the definition record of the active definition for namespace URI/local name pair. -
unbind
Unbinds each bindable element in the given element's subtree. -
bind
Binds each bindable element in the given element's subtree. -
rebind
Rebinds each bindable element of the given name in the given element's subtree. -
setActiveDefinition
Sets the given definition as the active one for a particular bindable element. -
setXblShadowTree
Sets the shadow tree for the given bindable element. -
fireShadowTreeEvent
Fires a ShadowTreeEvent of the given type on this element. -
cloneTemplate
Clones a template element for use as a shadow tree. -
getXblParentNode
Get the parent of a node in the fully flattened tree.- Specified by:
getXblParentNode
in interfaceXBLManager
-
getXblChildNodes
Get the list of child nodes of a node in the fully flattened tree.- Specified by:
getXblChildNodes
in interfaceXBLManager
-
getXblScopedChildNodes
Get the list of child nodes of a node in the fully flattened tree that are within the same shadow scope.- Specified by:
getXblScopedChildNodes
in interfaceXBLManager
-
getXblFirstChild
Get the first child node of a node in the fully flattened tree.- Specified by:
getXblFirstChild
in interfaceXBLManager
-
getXblLastChild
Get the last child node of a node in the fully flattened tree.- Specified by:
getXblLastChild
in interfaceXBLManager
-
getXblPreviousSibling
Get the node which directly precedes a node in the xblParentNode's xblChildNodes list.- Specified by:
getXblPreviousSibling
in interfaceXBLManager
-
getXblNextSibling
Get the node which directly follows a node in the xblParentNode's xblChildNodes list.- Specified by:
getXblNextSibling
in interfaceXBLManager
-
getXblFirstElementChild
Get the first element child of a node in the fully flattened tree.- Specified by:
getXblFirstElementChild
in interfaceXBLManager
-
getXblLastElementChild
Get the last element child of a node in the fully flattened tree.- Specified by:
getXblLastElementChild
in interfaceXBLManager
-
getXblPreviousElementSibling
Get the first element that precedes the a node in the xblParentNode's xblChildNodes list.- Specified by:
getXblPreviousElementSibling
in interfaceXBLManager
-
getXblNextElementSibling
Get the first element that follows a node in the xblParentNode's xblChildNodes list.- Specified by:
getXblNextElementSibling
in interfaceXBLManager
-
getXblBoundElement
Get the bound element whose shadow tree a node resides in.- Specified by:
getXblBoundElement
in interfaceXBLManager
-
getXblShadowTree
Get the shadow tree of a node.- Specified by:
getXblShadowTree
in interfaceXBLManager
-
getXblDefinitions
Get the xbl:definition elements currently binding an element.- Specified by:
getXblDefinitions
in interfaceXBLManager
-
getRecord
Returns the XBL record for the given node. -
updateLinks
Updates the xblPreviousSibling and xblNextSibling properties of the given XBL node. -
getXblContentElement
Returns the content element that caused the given node to be present in the flattened tree. -
computeBubbleLimit
Determines the number of nodes events should bubble if the mouse pointer has moved from one element to another.- Parameters:
from
- the element from which the mouse pointer movedto
- the element to which the mouse pointer moved
-
getContentManager
Returns the ContentManager that handles the shadow tree the given node resides in. -
setContentManager
Records the ContentManager that handles the given shadow tree. -
invalidateChildNodes
Mark the xblChildNodes and xblScopedChildNodes variables as invalid. -
addContentSelectionChangedListener
Adds the specified ContentSelectionChangedListener to the global listener list. -
removeContentSelectionChangedListener
Removes the specified ContentSelectionChangedListener from the global listener list. -
getContentSelectionChangedListeners
Returns an array of the gloabl ContentSelectionChangedListeners. -
shadowTreeSelectedContentChanged
Called by the ContentManager of a shadow tree to indicate some selected nodes have changed. -
addBindingListener
Adds the specified BindingListener to the global listener list. -
removeBindingListener
Removes the specified BindingListener from the global listener list. -
dispatchBindingChangedEvent
Dispatches a BindingEvent the registered listeners.- Parameters:
bindableElement
- the bindable element whose binding has changedshadowTree
- the new shadow tree of the bindable element
-
isActiveDefinition
Returns whether the given definition element is the active one for its element name.
-