Class SVGEditorSupport

  • All Implemented Interfaces:
    PropertyChangeListener, EventListener, SaveAsCookie, SVGEditorCookie, org.netbeans.api.actions.Closable, org.netbeans.api.actions.Editable, org.netbeans.api.actions.Openable, org.openide.cookies.CloseCookie, org.openide.cookies.EditCookie, org.openide.cookies.OpenCookie, org.openide.loaders.SaveAsCapable, org.openide.nodes.Node.Cookie

    public class SVGEditorSupport
    extends Object
    implements org.openide.cookies.OpenCookie, org.openide.cookies.EditCookie, org.openide.cookies.CloseCookie, SVGEditorCookie, org.openide.loaders.SaveAsCapable, SaveAsCookie, PropertyChangeListener
    Support for associating a SVG Editor kiyut.sketsa.windows.canvas.CanvasTopComponent CanvasTopComponent and SVGDocument to a DataObject.
    Author:
    KIYUT
    • Constructor Detail

      • SVGEditorSupport

        public SVGEditorSupport​(SVGDataObject dataObject)
    • Method Detail

      • getUndoRedo

        public org.openide.awt.UndoRedo getUndoRedo()
        Description copied from interface: SVGEditorCookie
        Get UndoRedo for this object
        Specified by:
        getUndoRedo in interface SVGEditorCookie
        Returns:
        UndoRedo
      • isOpened

        public boolean isOpened()
        Description copied from interface: SVGEditorCookie
        Indicates whether the editor VectorCanvas is opened.
        Specified by:
        isOpened in interface SVGEditorCookie
        Returns:
        true/false
      • saveAs

        public void saveAs()
                    throws IOException
        Implementation of saveAs, it call saveDocumentAs Invoke saveAs operation, it is up to the implementation to provide the operation eg: open JFileChooser
        Specified by:
        saveAs in interface SaveAsCookie
        Throws:
        IOException - if an I/O error occured
        See Also:
        saveDocumentAs()
      • saveAs

        public void saveAs​(String path,
                           boolean compress)
                    throws IOException
        Description copied from interface: SaveAsCookie
        Invoke saveAs operation based on the param
        Specified by:
        saveAs in interface SaveAsCookie
        Parameters:
        path - absolute path
        compress - true or false
        Throws:
        IOException - if an I/O error occured
      • saveAs

        public void saveAs​(org.openide.filesystems.FileObject folder,
                           String fileName)
                    throws IOException
        Specified by:
        saveAs in interface org.openide.loaders.SaveAsCapable
        Throws:
        IOException
      • open

        public void open()
        This implementation also open the Document in the separate thread.
        Specified by:
        open in interface org.netbeans.api.actions.Openable
      • edit

        public void edit()
        Specified by:
        edit in interface org.netbeans.api.actions.Editable
      • revertDocument

        public void revertDocument()
        Reload the SVGDocument from the source
        See Also:
        open(), edit()
      • createTopComponent

        protected org.openide.windows.TopComponent createTopComponent()
      • messageOpening

        protected String messageOpening()
      • messageOpened

        protected String messageOpened()
      • messageSave

        protected String messageSave()
      • messageName

        protected String messageName()
      • messageHTMLName

        protected String messageHTMLName()
      • annotateName

        protected String annotateName​(String label,
                                      boolean html,
                                      boolean modified)
        Helper only for formating whether HTML (modified-bold) or normal text (modified *)
        Parameters:
        label - the name or label to annotate
        html - flag for output is HTML or not
        modified - flag true or false indicated modified
        Returns:
        the annotateName
      • messageToolTip

        protected String messageToolTip()
      • updateName

        protected void updateName​(org.openide.windows.TopComponent component)
      • saveDocument

        protected void saveDocument​(String path,
                                    boolean compress)
                             throws IOException
        Save Document
        Parameters:
        path - absolute path
        compress - true or false
        Throws:
        IOException - if an I/O error occured
      • addSaveCookie

        protected void addSaveCookie()
        Add SaveCookie in the DataObject CookieSet
        See Also:
        removeSaveCookie()
      • removeSaveCookie

        protected void removeSaveCookie()
        Remove SaveCookie from the DataObject CookieSet
        See Also:
        addSaveCookie()
      • addRevertCookie

        protected void addRevertCookie()
        Add RevertCookie in the DataObject CookieSet
        See Also:
        removeRevertCookie()
      • removeRevertCookie

        protected void removeRevertCookie()
        Remove RevertCookie from the DataObject CookieSet
        See Also:
        addRevertCookie()
      • canClose

        protected boolean canClose()
      • close

        public boolean close()
        Close and dispose the DataObject
        Specified by:
        close in interface org.netbeans.api.actions.Closable