Class SVGDocumentBridge

    • Constructor Summary

      Constructors 
      Constructor Description
      SVGDocumentBridge()
      Constructs a new bridge the SVG document.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void buildGraphicsNode​(BridgeContext ctx, org.w3c.dom.Document doc, RootGraphicsNode node)
      Builds using the specified BridgeContext and element, the specified graphics node.
      RootGraphicsNode createGraphicsNode​(BridgeContext ctx, org.w3c.dom.Document doc)
      Creates a GraphicsNode according to the specified parameters.
      void dispose()
      Disposes this BridgeUpdateHandler and releases all resources.
      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).
      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.
      float getFontSize()
      Returns the font-size on the associated element.
      java.awt.geom.AffineTransform getGlobalTransform()
      Returns the global transformation matrix from the current element to the root.
      Bridge getInstance()
      Returns a new instance of this bridge.
      java.lang.String getLocalName()
      Returns the local name of the element this Bridge is dedicated to.
      java.lang.String getNamespaceURI()
      Returns the namespace URI of the element this Bridge is dedicated to.
      float getPixelToMM()
      Returns the size of a px CSS unit in millimeters.
      float getPixelUnitToMillimeter()
      Returns the size of a px CSS unit in millimeters.
      java.awt.geom.AffineTransform getScreenTransform()
      Returns the transform from the global transform space to pixels.
      float getViewportHeight()
      Returns the height of the viewport which directly contains the associated element.
      float getViewportWidth()
      Returns the width of the viewport which directly contains the associated element.
      void handleAnimatedAttributeChanged​(AnimatedLiveAttributeValue alav)
      Invoked when the animated value of an animated attribute has changed.
      void handleCSSEngineEvent​(CSSEngineEvent evt)
      Invoked when an CSSEngineEvent is fired.
      void handleDOMAttrModifiedEvent​(org.w3c.dom.events.MutationEvent evt)
      Invoked when an MutationEvent of type 'DOMAttrModified' is fired.
      void handleDOMCharacterDataModified​(org.w3c.dom.events.MutationEvent evt)
      Invoked when an MutationEvent of type 'DOMCharacterDataModified' is fired.
      void handleDOMNodeInsertedEvent​(org.w3c.dom.events.MutationEvent evt)
      Invoked when an MutationEvent of type 'DOMNodeInserted' is fired.
      void handleDOMNodeRemovedEvent​(org.w3c.dom.events.MutationEvent evt)
      Invoked when an MutationEvent of type 'DOMNodeRemoved' is fired.
      void handleOtherAnimationChanged​(java.lang.String type)
      Invoked when an 'other' animation value has changed.
      void setScreenTransform​(java.awt.geom.AffineTransform at)
      Sets the transform to be used from the global transform space to pixels.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • document

        protected org.w3c.dom.Document document
        The document node this bridge is associated with.
      • node

        protected RootGraphicsNode node
        The graphics node constructed by this bridge.
    • Constructor Detail

      • SVGDocumentBridge

        public SVGDocumentBridge()
        Constructs a new bridge the SVG document.
    • Method Detail

      • getNamespaceURI

        public java.lang.String getNamespaceURI()
        Returns the namespace URI of the element this Bridge is dedicated to. Returns null, as a Document node has no namespace URI.
        Specified by:
        getNamespaceURI in interface Bridge
      • getLocalName

        public java.lang.String getLocalName()
        Returns the local name of the element this Bridge is dedicated to. Returns null, as a Document node has no local name.
        Specified by:
        getLocalName in interface Bridge
      • getInstance

        public Bridge getInstance()
        Returns a new instance of this bridge.
        Specified by:
        getInstance in interface Bridge
      • createGraphicsNode

        public RootGraphicsNode createGraphicsNode​(BridgeContext ctx,
                                                   org.w3c.dom.Document doc)
        Creates a GraphicsNode according to the specified parameters. This is called before children have been added to the returned GraphicsNode (obviously since you construct and return it).
        Specified by:
        createGraphicsNode in interface DocumentBridge
        Parameters:
        ctx - the bridge context to use
        doc - the document node that describes the graphics node to build
        Returns:
        a graphics node that represents the specified document node
      • buildGraphicsNode

        public void buildGraphicsNode​(BridgeContext ctx,
                                      org.w3c.dom.Document doc,
                                      RootGraphicsNode node)
        Builds using the specified BridgeContext and element, the specified graphics node. This is called after all the children of the node have been constructed and added, so it is safe to do work that depends on being able to see your children nodes in this method.
        Specified by:
        buildGraphicsNode in interface DocumentBridge
        Parameters:
        ctx - the bridge context to use
        doc - the document node that describes the graphics node to build
        node - the graphics node to build
      • 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
      • 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
      • 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()
        Description copied from interface: SVGContext
        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
      • getScreenTransform

        public java.awt.geom.AffineTransform getScreenTransform()
        Description copied from interface: SVGContext
        Returns the transform from the global transform space to pixels.
        Specified by:
        getScreenTransform in interface SVGContext
      • setScreenTransform

        public void setScreenTransform​(java.awt.geom.AffineTransform at)
        Description copied from interface: SVGContext
        Sets the transform to be used from the global transform space to pixels.
        Specified by:
        setScreenTransform in interface SVGContext
      • getCTM

        public java.awt.geom.AffineTransform getCTM()
        Description copied from interface: SVGContext
        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
      • getGlobalTransform

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

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

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

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