public interface Savable extends ChangeMonitorable
Modifier and Type | Method and Description |
---|---|
void |
addFileExtension(java.lang.String ext)
Adds an file extension to the list of the allowed file extensions which can be entered
by the user in the save as dialog.
|
boolean |
askToSave()
Promts the user wheather to save changed data and calls save() if necessary.
|
boolean |
endsWithDefaultExt(java.lang.String path)
Tests if the given string ends with the default file extension.
|
boolean |
endsWithValidExt(java.lang.String path)
Tests if the given string ends with one of the valid file extensions stored.
|
java.lang.String |
getDefaultExtension()
The file extension which should be add to file name chosen in the save as dialog,
if not one of the allowed ones is already present.
|
java.lang.String |
getDefaultName()
The path that should be proposed by the saveAs()-method if no path has been assigned.
|
java.lang.String |
getDefaultNameOrPath()
The path of the assigned file or the default name if no file has been specified.
|
java.io.File |
getFile()
Returns the assigned file.
|
java.lang.String[] |
getFileExtensions() |
boolean |
hasFile()
Checks weather a file has been assigned
|
void |
removeFileExtention(java.lang.String ext) |
boolean |
save()
This method should save the data to a file defined by the path and should call
saveAs() if no path was assigned.
|
boolean |
saveAs()
Promts the user der select a path to save the data.
|
void |
setDefaultExtension(java.lang.String ext) |
void |
setDefaultName(java.lang.String path)
Sets the path that should be proposed by the saveAs()-method if no path has been
assigned.
|
void |
setFile(java.io.File file)
Manually assignes a path.
|
hasChanged, registerChange, reset
java.lang.String getDefaultExtension()
void setDefaultExtension(java.lang.String ext)
void addFileExtension(java.lang.String ext)
ext
- the extension to add starting with a "."void removeFileExtention(java.lang.String ext)
java.lang.String[] getFileExtensions()
boolean endsWithValidExt(java.lang.String path)
path
- the path or file name to testboolean endsWithDefaultExt(java.lang.String path)
path
- the path or file name to testboolean hasFile()
java.io.File getFile()
void setFile(java.io.File file)
java.lang.String getDefaultName()
void setDefaultName(java.lang.String path)
java.lang.String getDefaultNameOrPath()
boolean save()
boolean saveAs()
boolean askToSave()
true
.true
if the file can be closed or false
if the user
wants to cancel