file handler. this class provides actions and methods
to save and load files to a textpane.
currentFile
protected File currentFile
the currently loaded file.
this will be null if load from stream.
currentFileChanged
protected boolean currentFileChanged
true if the document is changed after last save.
currentFileDate
protected Date currentFileDate
the date of the current file loaded.
this will be used to check the loaded file against the file on disk.
currentFileName
protected String currentFileName
the filename of the currently loaded file.
this will always have a value even if load from stream.
dontCheckFileOnDisk
protected boolean dontCheckFileOnDisk
if this is true no check file on disk will be done.
this is dirty hack to prevent check file on disk to occur on
less favourable events (for example when save/load dialog is open).
dontFireChange
protected boolean dontFireChange
if this is true no change event will be fired.
cheap hack to prevent title updating
during save load operation.
newAction
public Action newAction
openAction
public Action openAction
revertAction
public Action revertAction
saveAction
public Action saveAction
saveAsAction
public Action saveAsAction
changedUpdate
public void changedUpdate(DocumentEvent e)
checkFileOnDisk
public void checkFileOnDisk()
this will check the currently loaded file against
the file on disk, and warn the user if file on disk has changed.
this will be called from the timer started in constructor.
errorCannotCreateFile
protected void errorCannotCreateFile(String name)
errorCannotReadFromFile
protected void errorCannotReadFromFile(String name)
errorCannotWriteToFile
protected void errorCannotWriteToFile(String name)
errorFileDoesNotExist
protected void errorFileDoesNotExist(String name)
getNewDocumentFile
protected File getNewDocumentFile()
getNewDocumentStream
protected InputStream getNewDocumentStream()
insertUpdate
public void insertUpdate(DocumentEvent e)
okToLoadNewDocument
protected boolean okToLoadNewDocument()
okToOpenDocument
protected boolean okToOpenDocument()
okToOverwriteFile
protected boolean okToOverwriteFile(String name)
okToReloadFileFromDisk
protected boolean okToReloadFileFromDisk(String name)
okToRevertDocument
protected boolean okToRevertDocument(String name)
openDocument
public void openDocument(File file)
this method might never be called, but it is here anyway
openDocument
public void openDocument(InputStream in,
String name)
this method is called to load examples from the jar as stream
removeUpdate
public void removeUpdate(DocumentEvent e)
revertDocument
public void revertDocument()
revert the current loaded file with the file on disk.
saveAsDocument
public void saveAsDocument(File file)
this method might never be called, but it is here anyway
saveAsDocument
public void saveAsDocument(OutputStream out,
String name)
this method might never be called, but it is here anyway
saveDocument
public void saveDocument()
save the current loaded file.