public abstract class AbstractDocumentHandler extends AbstractDataHandler<Path>
Path
-based DocumentHandler
. It observes registered DataCapabilityProvider
s and adds the found data capabilities to it's local context.
You can use this class as a base class for your own document handler implementations.Constructor and Description |
---|
AbstractDocumentHandler(String defaultFileExtenion)
Creates a new instance of this class with an unkown (null) document path.
|
AbstractDocumentHandler(String defaultFileExtenion,
Path path)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
String |
getDefaultFileExtenion()
Gets the default file extension for the document type.
|
protected org.drombler.commons.client.dialog.FileChooserProvider |
getFileChooserProvider()
The system wide FileChooserProvider used for the saveNew dialog.
|
Path |
getPath()
The path of the document or null if it does not exist yet.
|
String |
getTitle() |
String |
getTooltipText() |
Path |
getUniqueKey() |
void |
save()
Saves the content to the file.
|
boolean |
saveNew(String initialFileName)
Saves the content to a file selected from the saveNew dialog.
|
protected abstract void |
writeContent()
Writes the content to the file.
|
getLocalContext, isDirty, markClean, markDirty
public AbstractDocumentHandler(String defaultFileExtenion)
defaultFileExtenion
- the default file extension for the document typepublic Path getPath()
public String getTitle()
public String getTooltipText()
public String getDefaultFileExtenion()
public void save() throws IOException
IOException
saveNew(java.lang.String)
public boolean saveNew(String initialFileName) throws IOException
initialFileName
- the initial file nameIOException
save()
protected abstract void writeContent() throws IOException
IOException
public void close()
close
in interface AutoCloseable
close
in class AbstractDataHandler<Path>
public Path getUniqueKey()
protected org.drombler.commons.client.dialog.FileChooserProvider getFileChooserProvider()
Copyright © 2012–2017 Drombler. All rights reserved.