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.Modifier and Type | Field and Description |
---|---|
static String |
PATH_PROPERTY_NAME |
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 |
---|---|
String |
getDefaultFileExtenion()
Gets the default file extension for the document type.
|
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.
|
void |
saveNew(Path newPath)
Saves the content to a file and updates the path property.
|
protected abstract void |
writeContent()
Writes the content to the file.
|
addCloseEventListener, addPropertyChangeListener, close, fireCloseEvent, getContextContent, getLocalContext, getPropertyChangeSupport, isDirty, isInitialized, markClean, markDirty, removeCloseEventListener, removePropertyChangeListener, setInitialized, toString
public static final String PATH_PROPERTY_NAME
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.nio.file.Path)
public void saveNew(Path newPath) throws IOException
newPath
- the new document pathIOException
save()
protected abstract void writeContent() throws IOException
IOException
public Path getUniqueKey()
Copyright © 2012–2018 Drombler. All rights reserved.