public interface PluginDocument extends XMLSerializable
XMLSerializable.fromXML(org.jdom.Element).
If the document stores URNs of other documents in its toXML() function,
use URN.toXML(java.lang.String) to store the URNs. This enables Geneious to recognise
that the document references other documents, and to handle these references
appropriately when exporting and sharing documents. Documents which
have their URNs stored in the XML of other documents are known as
referenced documents. A referenced document can be retrieved using
its URN using DocumentUtilities.getDocumentByURN(URN).
To control whether or not Geneious pre-loads referenced documents in a non-swing
thread before passing the referencing document to a DocumentViewer,
see PluginDocument.ReferencedDocumentsAlwaysLoaded
and PluginDocument.ReferencedDocumentsNotLoaded| Modifier and Type | Interface and Description |
|---|---|
static interface |
PluginDocument.ReferencedDocumentsAlwaysLoaded
PluginDocuments can optionally implement this empty interface to signify that they generally require their referenced documents when
they are deserialized and for general use such as viewing the document, even if those referenced documents have not
been modified since this PluginDocument was last saved.
|
static interface |
PluginDocument.ReferencedDocumentsNotLoaded
PluginDocuments can optionally implement this empty interface to signify that they don't require their referenced documents when
they are deserialized and for general use such as viewing the document.
|
static interface |
PluginDocument.SizeRequiredToLoadIntoMemoryProvider
A PluginDocument may implement this interface to indicate to Geneious the amount of memory it will probably require in order to load the document.
|
XMLSerializable.OldVersionCompatible, XMLSerializable.VersionSupportType| Modifier and Type | Field and Description |
|---|---|
static String |
FILE_DATA_ATTRIBUTE_NAME
A PluginDocument may choose to serialize some or all of its data to a file instead of to in memory XML.
|
static int |
MAXIMUM_HTML_LENGTH
toHTML() should not return a string greater in length to this. |
static DocumentField |
MODIFIED_DATE_FIELD
A field indicating when a document was last modified.
|
ROOT_ELEMENT_NAME| Modifier and Type | Method and Description |
|---|---|
Date |
getCreationDate()
Get the date this document was created.
|
String |
getDescription()
A human readable single line of text describing this document,
to appear in the description field in the document table.
|
List<DocumentField> |
getDisplayableFields()
A list of columns for display in the main document panel.
|
Object |
getFieldValue(String fieldCodeName)
Get the value of a particular field.
|
String |
getName()
A short name (preferably one or two words) for the document.
|
URN |
getURN()
A Universal Resource Name.
|
String |
toHTML()
Provide a textual view of document.
|
fromXML, toXMLstatic final DocumentField MODIFIED_DATE_FIELD
getCreationDate(), then it should return a Date from
getFieldValue(MODIFIED_DATE_FIELD.getCode()).
Geneious will then use this as the initial modified date for
the AnnotatedPluginDocument.getFieldValue(KEY_MODIFIED_DATE).static final String FILE_DATA_ATTRIBUTE_NAME
WritableDatabaseService that stores such an element
for a PluginDocument will store a copy of the contents of this file (or potentially a file system hard link to the temporary file)
and when deserializing, provide a reference
to a file containing the data. The PluginDocument must therefore never modify the contents of a temporary file
it creates after it has provided it to a WritableDatabaseService and it must never modify the contents of a file
it is provided with for deserialization purposes. Instead it should create a new file to hold any changes made. A single document
may use references to multiple files by adding this attribute to multiple elements.
For example, a PluginDocument may generate XML such as the following:WritableDatabaseService,
the WritableDatabaseService will make a copy of the file and give back XML with the file name adjusted to point
to its own copy of the file.
It is recommended that PluginDocument implementations use
FileUtilities.createTempFile for temporary
file management, which supports automatically deleting temporary files once their names are no longer referenced.
A PluginDocument may prefer to use DocumentUtilities.pluginDocumentFileDataToXml and
DocumentUtilities.pluginDocumentFileDataFromXml
instead of using this attribute directly. These methods support detection and gracefully handling the underlying file data being corrupted which is prone to happening on Windows systems that use a network drive for data storage.static final int MAXIMUM_HTML_LENGTH
toHTML() should not return a string greater in length to this. The Text view truncates anything that is
longer.List<DocumentField> getDisplayableFields()
getFieldValue(String).
Each column is specified by a Field. The fields should be obtained from a call to the appropriate
Field.createXXXXField, where XXXX is the appropriate type.
While it is not required, it is recommended that a PluginDocument
handle returning a complete list of its displayable fields before
the document has been properly constructed via a call to XMLSerializable.fromXML(org.jdom.Element)
The returned list need not and should not be modifiable.Object getFieldValue(String fieldCodeName)
fieldCodeName - field code. This should be the
code of one of the fields
returned from getDisplayableFields().DocumentField.getValueType() (or a subclass) of the corresponding DocumentField returned from getDisplayableFields().String getName()
AnnotatedPluginDocument then this method
will be overridden and delegate back to AnnotatedPluginDocument.getName(). One way to look at it is
that when you call PluginDocument.getName() you will get the current name of the document. If you are implementing PluginDocument.getName() then you are
returning the default name for the document.URN getURN()
Date getCreationDate()
AnnotatedPluginDocument.getCreationDate()
instead as that will return either the date returned from
getCreationDate() or if that returned null,
AnnotatedPluginDocument.getCreationDate() will return the date the
document was first instantiated.MODIFIED_DATE_FIELDString getDescription()
String toHTML()
<html>