Class AbstractGraphicsNodeBridge

    • Field Detail

      • node

        protected GraphicsNode node
        The graphics node constructed by this bridge.
      • isSVG12

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

        protected java.lang.ref.SoftReference bboxShape
      • bbox

        protected java.awt.geom.Rectangle2D bbox
    • Constructor Detail

      • AbstractGraphicsNodeBridge

        protected AbstractGraphicsNodeBridge()
        Constructs a new abstract bridge.
    • Method Detail

      • createGraphicsNode

        public GraphicsNode createGraphicsNode​(BridgeContext ctx,
                                               org.w3c.dom.Element e)
        Creates a GraphicsNode according to the specified parameters.
        Specified by:
        createGraphicsNode in interface GraphicsNodeBridge
        Parameters:
        ctx - the bridge context to use
        e - the element that describes the graphics node to build
        Returns:
        a graphics node that represents the specified element
      • instantiateGraphicsNode

        protected abstract GraphicsNode instantiateGraphicsNode()
        Creates the GraphicsNode depending on the GraphicsNodeBridge implementation.
      • buildGraphicsNode

        public void buildGraphicsNode​(BridgeContext ctx,
                                      org.w3c.dom.Element e,
                                      GraphicsNode node)
        Builds using the specified BridgeContext and element, the specified graphics node.
        Specified by:
        buildGraphicsNode in interface GraphicsNodeBridge
        Parameters:
        ctx - the bridge context to use
        e - the element that describes the graphics node to build
        node - the graphics node to build
      • getDisplay

        public boolean getDisplay​(org.w3c.dom.Element e)
        Returns true if the graphics node has to be displayed, false otherwise.
        Specified by:
        getDisplay in interface GraphicsNodeBridge
      • computeTransform

        protected java.awt.geom.AffineTransform computeTransform​(org.w3c.dom.svg.SVGTransformable te,
                                                                 BridgeContext ctx)
        Returns an AffineTransform that is the transformation to be applied to the node.
      • setTransform

        protected void setTransform​(GraphicsNode n,
                                    org.w3c.dom.Element e,
                                    BridgeContext ctx)
        Sets the graphics node's transform to the current animated transform value.
      • associateSVGContext

        protected void associateSVGContext​(BridgeContext ctx,
                                           org.w3c.dom.Element e,
                                           GraphicsNode node)
        Associates the SVGContext with the element. This method should be called even for static documents, since some bridges will need to access animated attribute values even during the first build.
      • initializeDynamicSupport

        protected void initializeDynamicSupport​(BridgeContext ctx,
                                                org.w3c.dom.Element e,
                                                GraphicsNode node)
        This method is invoked during the build phase if the document is dynamic. The responsibility of this method is to ensure that any dynamic modifications of the element this bridge is dedicated to, happen on its associated GVT product.
      • handleDOMAttrModifiedEvent

        public void handleDOMAttrModifiedEvent​(org.w3c.dom.events.MutationEvent evt)
        Invoked when an MutationEvent of type 'DOMAttrModified' is fired.
        Specified by:
        handleDOMAttrModifiedEvent in interface BridgeUpdateHandler
      • handleGeometryChanged

        protected void handleGeometryChanged()
        Invoked when the geometry of a graphical element has changed.
      • fireShapeChangeEvent

        protected void fireShapeChangeEvent()
        Fires a ShapeChange event on the element this bridge is managing.
      • handleDOMNodeInsertedEvent

        public void handleDOMNodeInsertedEvent​(org.w3c.dom.events.MutationEvent evt)
        Invoked when an MutationEvent of type 'DOMNodeInserted' is fired.
        Specified by:
        handleDOMNodeInsertedEvent in interface BridgeUpdateHandler
      • handleDOMNodeRemovedEvent

        public void handleDOMNodeRemovedEvent​(org.w3c.dom.events.MutationEvent evt)
        Invoked when an MutationEvent of type 'DOMNodeRemoved' is fired.
        Specified by:
        handleDOMNodeRemovedEvent in interface BridgeUpdateHandler
      • handleDOMCharacterDataModified

        public void handleDOMCharacterDataModified​(org.w3c.dom.events.MutationEvent evt)
        Invoked when an MutationEvent of type 'DOMCharacterDataModified' is fired.
        Specified by:
        handleDOMCharacterDataModified in interface BridgeUpdateHandler
      • dispose

        public void dispose()
        Disposes this BridgeUpdateHandler and releases all resources.
        Specified by:
        dispose in interface BridgeUpdateHandler
      • disposeTree

        protected static void disposeTree​(org.w3c.dom.Node node)
        Disposes all resources related to the specified node and its subtree.
      • disposeTree

        protected static void disposeTree​(org.w3c.dom.Node node,
                                          boolean removeContext)
        Disposes all resources related to the specified node and its subtree, and optionally removes the nodes' SVGContext.
      • handleCSSPropertyChanged

        protected void handleCSSPropertyChanged​(int property)
        Invoked for each CSS property that has changed.
      • checkBBoxChange

        protected void checkBBoxChange()
        Checks if the bounding box of the node has changed, and if so, fires a bboxchange event on the element.
      • fireBBoxChangeEvent

        protected void fireBBoxChangeEvent()
        Fires an svg:bboxchange event on the element.
      • getPixelUnitToMillimeter

        public float getPixelUnitToMillimeter()
        Returns the size of a px CSS unit in millimeters.
        Specified by:
        getPixelUnitToMillimeter in interface SVGContext
      • getBBox

        public java.awt.geom.Rectangle2D getBBox()
        Returns the tight bounding box in current user space (i.e., after application of the transform attribute, if any) on the geometry of all contained graphics elements, exclusive of stroke-width and filter effects).
        Specified by:
        getBBox in interface SVGContext
      • getCTM

        public java.awt.geom.AffineTransform getCTM()
        Returns the transformation matrix from current user units (i.e., after application of the transform attribute, if any) to the viewport coordinate system for the nearestViewportElement.
        Specified by:
        getCTM in interface SVGContext
      • getScreenTransform

        public java.awt.geom.AffineTransform getScreenTransform()
        Returns the display transform.
        Specified by:
        getScreenTransform in interface SVGContext
      • setScreenTransform

        public void setScreenTransform​(java.awt.geom.AffineTransform at)
        Sets the display transform.
        Specified by:
        setScreenTransform in interface SVGContext
      • getGlobalTransform

        public java.awt.geom.AffineTransform getGlobalTransform()
        Returns the global transformation matrix from the current element to the root.
        Specified by:
        getGlobalTransform in interface SVGContext
      • getViewportWidth

        public float getViewportWidth()
        Returns the width of the viewport which directly contains the given element.
        Specified by:
        getViewportWidth in interface SVGContext
      • getViewportHeight

        public float getViewportHeight()
        Returns the height of the viewport which directly contains the given element.
        Specified by:
        getViewportHeight in interface SVGContext
      • getFontSize

        public float getFontSize()
        Returns the font-size on the associated element.
        Specified by:
        getFontSize in interface SVGContext