Package kiyut.sketsa.canvas

## Class CanvasUserAgent

- java.lang.Object
- - org.apache.batik.bridge.UserAgentAdapter
  - - kiyut.sketsa.canvas.CanvasUserAgent

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

      public class CanvasUserAgent
      extends org.apache.batik.bridge.UserAgentAdapter
      implements EditorUserAgent

  CanvasUserAgent
  Author:
    KIYUT

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected VectorCanvas` | `canvas` |
    `protected Exception` | `exception` |
    `protected float` | `pxToMM` |
    `protected Dimension2D` | `viewportSize` | viewport size

    - ### Fields inherited from class org.apache.batik.bridge.UserAgentAdapter

      `ctx, extensions, FEATURES`

  - ### 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 class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### 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

    - #### canvas

          protected VectorCanvas canvas

    - #### pxToMM

          protected float pxToMM

    - #### exception

          protected Exception exception

  - ### 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()`

    - #### getException

          public Exception getException()

      Description copied from interface: `EditorUserAgent`
      Return displayError exception.
      Specified by:
        `getException` in interface `EditorUserAgent`
      Returns:
        Exception
      See Also:
        `EditorUserAgent.exceptionHandled()`

    - #### exceptionHandled

          public void exceptionHandled()

      Description copied from interface: `EditorUserAgent`
      Tell this user agent that the exception has been handled. Subsequent call to getException will be null, until there is another exception occur
      Specified by:
        `exceptionHandled` in interface `EditorUserAgent`
      See Also:
        `EditorUserAgent.getException()`

    - #### 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`