Class CanvasUserAgent

  • All Implemented Interfaces:
    EditorUserAgent, org.apache.batik.bridge.UserAgent

    public class CanvasUserAgent
    extends org.apache.batik.bridge.UserAgentAdapter
    implements EditorUserAgent
    CanvasUserAgent
    Author:
    KIYUT
    • Constructor Summary

      Constructors 
      Constructor Description
      CanvasUserAgent​(VectorCanvas canvas)
      Creates a new instance of BridgeUserAgent
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void displayError​(Exception ex)
      This does not display the specified error, but store the exception so it is available from getException()
      void displayError​(String message)
      Display the specified error message
      void displayMessage​(String message)
      Since it is editor, it display nothing
      void exceptionHandled()
      Tell this user agent that the exception has been handled.
      org.w3c.dom.svg.SVGDocument getBrokenLinkDocument​(Element e, String url, String message)  
      Exception getException()
      Return displayError exception.
      float getPixelUnitToMillimeter()
      Returns the size of a px CSS unit in millimeters.
      Dimension2D getViewportSize()
      Returns the default size of this user agent.
      void showAlert​(String message)
      Since it is editor, it display nothing
      • Methods inherited from class org.apache.batik.bridge.UserAgentAdapter

        addStdFeatures, checkLoadExternalResource, checkLoadScript, deselectAll, getAlternateStyleSheet, getBolderFontWeight, getClientAreaLocationOnScreen, getDefaultFontFamily, getEventDispatcher, getExternalResourceSecurity, getFontFamilyResolver, getLanguages, getLighterFontWeight, getMedia, getMediumFontSize, getPixelToMM, getScriptSecurity, getStandardBolderFontWeight, getStandardLighterFontWeight, getTransform, getUserStyleSheetURI, getXMLParserClassName, handleElement, hasFeature, isXMLParserValidating, loadDocument, openLink, registerExtension, runThread, setBridgeContext, setSVGCursor, setTextSelection, setTransform, showConfirm, showPrompt, showPrompt, supportExtension
      • Methods inherited from interface org.apache.batik.bridge.UserAgent

        checkLoadExternalResource, checkLoadScript, deselectAll, getAlternateStyleSheet, getBolderFontWeight, getClientAreaLocationOnScreen, getDefaultFontFamily, getEventDispatcher, getExternalResourceSecurity, getFontFamilyResolver, getLanguages, getLighterFontWeight, getMedia, getMediumFontSize, getPixelToMM, getScriptSecurity, getTransform, getUserStyleSheetURI, getXMLParserClassName, handleElement, hasFeature, isXMLParserValidating, loadDocument, openLink, registerExtension, setSVGCursor, setTextSelection, setTransform, showConfirm, showPrompt, showPrompt, supportExtension
    • Field Detail

      • viewportSize

        protected Dimension2D viewportSize
        viewport size
      • pxToMM

        protected float pxToMM
    • Constructor Detail

      • CanvasUserAgent

        public CanvasUserAgent​(VectorCanvas canvas)
        Creates a new instance of BridgeUserAgent
        Parameters:
        canvas - VectorCanvas
    • Method Detail

      • getViewportSize

        public Dimension2D getViewportSize()
        Returns the default size of this user agent. It is the same as GeneralPreferences default SVGWidth and SVGHeight
        Specified by:
        getViewportSize in interface org.apache.batik.bridge.UserAgent
        Overrides:
        getViewportSize in class org.apache.batik.bridge.UserAgentAdapter
        Returns:
        the default size of this user agent
      • displayMessage

        public void displayMessage​(String message)
        Since it is editor, it display nothing
        Specified by:
        displayMessage in interface org.apache.batik.bridge.UserAgent
        Overrides:
        displayMessage in class org.apache.batik.bridge.UserAgentAdapter
        Parameters:
        message - the Message
      • displayError

        public void displayError​(String message)
        Display the specified error message
        Overrides:
        displayError in class org.apache.batik.bridge.UserAgentAdapter
        Parameters:
        message - The message
      • displayError

        public void displayError​(Exception ex)
        This does not display the specified error, but store the exception so it is available from getException()
        Specified by:
        displayError in interface org.apache.batik.bridge.UserAgent
        Overrides:
        displayError in class org.apache.batik.bridge.UserAgentAdapter
        Parameters:
        ex - The exception
        See Also:
        getException(), exceptionHandled()
      • showAlert

        public void showAlert​(String message)
        Since it is editor, it display nothing
        Specified by:
        showAlert in interface org.apache.batik.bridge.UserAgent
        Overrides:
        showAlert in class org.apache.batik.bridge.UserAgentAdapter
        Parameters:
        message - The message
      • getPixelUnitToMillimeter

        public float getPixelUnitToMillimeter()
        Returns the size of a px CSS unit in millimeters.
        Specified by:
        getPixelUnitToMillimeter in interface org.apache.batik.bridge.UserAgent
        Overrides:
        getPixelUnitToMillimeter in class org.apache.batik.bridge.UserAgentAdapter
        Returns:
        the size of a px CSS unit in millimeters.
      • getBrokenLinkDocument

        public org.w3c.dom.svg.SVGDocument getBrokenLinkDocument​(Element e,
                                                                 String url,
                                                                 String message)
        Specified by:
        getBrokenLinkDocument in interface org.apache.batik.bridge.UserAgent
        Overrides:
        getBrokenLinkDocument in class org.apache.batik.bridge.UserAgentAdapter