public abstract class SwingSaver extends AbstractSaver implements ChangeMonitorable, Savable
| Constructor and Description |
|---|
SwingSaver() |
SwingSaver(java.lang.String defaultName) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
askToSave()
Promts the user wheather to save changed data and calls save() if necessary.
|
boolean |
askToSave(java.awt.Component parentComponent) |
javax.swing.JFileChooser |
getFileChooser()
Returns the file dialog used by this instance in
saveAs() and saveAs(Component). |
boolean |
saveAs()
Opens a save dialog and asks the user where to save the file.
|
boolean |
saveAs(java.awt.Component parentComponent)
Opens a save dialog and asks the user where to save the file.
|
addFileExtension, endsWithDefaultExt, endsWithValidExt, getDefaultExtension, getDefaultName, getDefaultNameOrPath, getFile, getFileExtensions, hasFile, removeFileExtention, save, saveDataToFile, setDefaultExtension, setDefaultName, setFilehasChanged, registerChange, resetclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddFileExtension, endsWithDefaultExt, endsWithValidExt, getDefaultExtension, getDefaultName, getDefaultNameOrPath, getFile, getFileExtensions, hasFile, removeFileExtention, save, setDefaultExtension, setDefaultName, setFilehasChanged, registerChange, resetpublic SwingSaver()
public SwingSaver(java.lang.String defaultName)
public boolean askToSave()
Savabletrue.askToSave in interface SavableaskToSave in class AbstractSavertrue if the file can be closed or false if the user
wants to cancelpublic boolean askToSave(java.awt.Component parentComponent)
public boolean saveAs()
saveAs(null).
Note that this method must only be called inside the Swing thread because the used Swing methods are not thread save.
saveAs in interface SavablesaveAs in class AbstractSavertrue if the file was successfully saved, false if the user canceled the operationpublic boolean saveAs(java.awt.Component parentComponent)
Note that this method must only be called inside the Swing thread because the used Swing methods are not thread save.
parentComponent - the parent component used to position the file dialogtrue if the file was successfully saved, false if the user canceled the operationpublic javax.swing.JFileChooser getFileChooser()
saveAs() and saveAs(Component).
Note that this component will be created when this method is called for the first time. The creation of that component is not thread save and therefore this method should only be called from the Swing thread.