Package kiyut.sketsa.loaders
Class SVGEditorSupport
- java.lang.Object
-
- kiyut.sketsa.loaders.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 Editorkiyut.sketsa.windows.canvas.CanvasTopComponent CanvasTopComponentandSVGDocumentto aDataObject.- Author:
- KIYUT
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSVGEditorSupport.ListenerRegistryclassSVGEditorSupport.SVGDocumentLoaderDocumentLoader Helper classclassSVGEditorSupport.SVGRevertCookieclassSVGEditorSupport.SVGSaveCookie
-
Field Summary
Fields Modifier and Type Field Description protected SVGDataObjectdataObjectprotected CanvasTopComponenteditorTCprotected RevertCookierevertCookieprotected org.openide.cookies.SaveCookiesaveCookie
-
Constructor Summary
Constructors Constructor Description SVGEditorSupport(SVGDataObject dataObject)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddRevertCookie()Add RevertCookie in the DataObject CookieSetprotected voidaddSaveCookie()Add SaveCookie in the DataObject CookieSetprotected StringannotateName(String label, boolean html, boolean modified)Helper only for formating whether HTML (modified-bold) or normal text (modified *)protected booleancanClose()booleanclose()Close and dispose the DataObjectprotected org.openide.windows.TopComponentcreateTopComponent()voidedit()CanvasTopComponentgetCanvasTopComponent()GetCanvasTopComponentfor this object.static SVGEditorSupport.ListenerRegistrygetListenerRegistry()Get theSVGEditorSupport.ListenerRegistrycontaining all the registered listener.SVGDataObjectgetSVGDataObject()ReturnSVGDataObjectfor this objectorg.openide.awt.UndoRedogetUndoRedo()GetUndoRedofor this objectVectorCanvasgetVectorCanvas()GetVectorCanvasfor this object.CanvasTopComponentgetVectorCanvasTopComponent()Deprecated.booleanisOpened()Indicates whether the editorVectorCanvasis opened.protected StringmessageHTMLName()protected StringmessageName()protected StringmessageOpened()protected StringmessageOpening()protected StringmessageSave()protected StringmessageToolTip()voidopen()This implementation also open the Document in the separate thread.voidpropertyChange(PropertyChangeEvent evt)protected voidremoveRevertCookie()Remove RevertCookie from the DataObject CookieSetprotected voidremoveSaveCookie()Remove SaveCookie from the DataObject CookieSetvoidrevertDocument()Reload the SVGDocument from the sourcevoidsaveAs()Implementation of saveAs, it call saveDocumentAs Invoke saveAs operation, it is up to the implementation to provide the operation eg: open JFileChooservoidsaveAs(String path, boolean compress)Invoke saveAs operation based on the paramvoidsaveAs(org.openide.filesystems.FileObject folder, String fileName)protected voidsaveDocument()Save Document, based on SVGDataObject.getSVGFile, if null it will call saveDocumentAsprotected voidsaveDocument(String path, boolean compress)Save Documentprotected voidsaveDocumentAs()Save Document As, this method will display JFileChooserprotected voidupdateName(org.openide.windows.TopComponent component)
-
-
-
Field Detail
-
dataObject
protected SVGDataObject dataObject
-
editorTC
protected CanvasTopComponent editorTC
-
saveCookie
protected org.openide.cookies.SaveCookie saveCookie
-
revertCookie
protected RevertCookie revertCookie
-
-
Constructor Detail
-
SVGEditorSupport
public SVGEditorSupport(SVGDataObject dataObject)
-
-
Method Detail
-
getVectorCanvas
public VectorCanvas getVectorCanvas()
Description copied from interface:SVGEditorCookieGetVectorCanvasfor this object.- Specified by:
getVectorCanvasin interfaceSVGEditorCookie- Returns:
VectorCanvasornull
-
getVectorCanvasTopComponent
@Deprecated public CanvasTopComponent getVectorCanvasTopComponent()
Deprecated.Description copied from interface:SVGEditorCookieGetCanvasTopComponentfor this object.- Specified by:
getVectorCanvasTopComponentin interfaceSVGEditorCookie- Returns:
CanvasTopComponentornull
-
getCanvasTopComponent
public CanvasTopComponent getCanvasTopComponent()
Description copied from interface:SVGEditorCookieGetCanvasTopComponentfor this object.- Specified by:
getCanvasTopComponentin interfaceSVGEditorCookie- Returns:
CanvasTopComponentornull
-
getUndoRedo
public org.openide.awt.UndoRedo getUndoRedo()
Description copied from interface:SVGEditorCookieGetUndoRedofor this object- Specified by:
getUndoRedoin interfaceSVGEditorCookie- Returns:
UndoRedo
-
isOpened
public boolean isOpened()
Description copied from interface:SVGEditorCookieIndicates whether the editorVectorCanvasis opened.- Specified by:
isOpenedin interfaceSVGEditorCookie- Returns:
- true/false
-
getSVGDataObject
public SVGDataObject getSVGDataObject()
Description copied from interface:SVGEditorCookieReturnSVGDataObjectfor this object- Specified by:
getSVGDataObjectin interfaceSVGEditorCookie- Returns:
SVGDataObject
-
saveAs
public void saveAs() throws IOExceptionImplementation of saveAs, it call saveDocumentAs Invoke saveAs operation, it is up to the implementation to provide the operation eg: open JFileChooser- Specified by:
saveAsin interfaceSaveAsCookie- 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:SaveAsCookieInvoke saveAs operation based on the param- Specified by:
saveAsin interfaceSaveAsCookie- Parameters:
path- absolute pathcompress- 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:
saveAsin interfaceorg.openide.loaders.SaveAsCapable- Throws:
IOException
-
open
public void open()
This implementation also open the Document in the separate thread.- Specified by:
openin interfaceorg.netbeans.api.actions.Openable
-
edit
public void edit()
- Specified by:
editin interfaceorg.netbeans.api.actions.Editable
-
revertDocument
public void revertDocument()
Reload the SVGDocument from the source
-
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 annotatehtml- flag for output is HTML or notmodified- flag true or false indicated modified- Returns:
- the annotateName
-
messageToolTip
protected String messageToolTip()
-
propertyChange
public void propertyChange(PropertyChangeEvent evt)
- Specified by:
propertyChangein interfacePropertyChangeListener
-
updateName
protected void updateName(org.openide.windows.TopComponent component)
-
saveDocument
protected void saveDocument() throws IOExceptionSave Document, based on SVGDataObject.getSVGFile, if null it will call saveDocumentAs- Throws:
IOException- if an I/O error occured- See Also:
saveDocumentAs(),saveDocument(String, boolean)
-
saveDocumentAs
protected void saveDocumentAs() throws IOExceptionSave Document As, this method will display JFileChooser- Throws:
IOException- if an I/O error occured- See Also:
saveDocument(String, boolean)
-
saveDocument
protected void saveDocument(String path, boolean compress) throws IOException
Save Document- Parameters:
path- absolute pathcompress-trueorfalse- 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:
closein interfaceorg.netbeans.api.actions.Closable
-
getListenerRegistry
public static SVGEditorSupport.ListenerRegistry getListenerRegistry()
Get theSVGEditorSupport.ListenerRegistrycontaining all the registered listener.- Returns:
- the ListenerRegistry
-
-