public class DefaultSameTaxaTreesDocument extends Object implements EditableSameTaxaTreesDocument, ExportableDocument, XMLSerializable.OldVersionCompatible
PluginDocument.ReferencedDocumentsAlwaysLoaded, PluginDocument.ReferencedDocumentsNotLoaded, PluginDocument.SizeRequiredToLoadIntoMemoryProviderXMLSerializable.OldVersionCompatible, XMLSerializable.VersionSupportTypeExportableDocument.FormatFILE_DATA_ATTRIBUTE_NAME, MAXIMUM_HTML_LENGTH, MODIFIED_DATE_FIELDROOT_ELEMENT_NAME| Constructor and Description |
|---|
DefaultSameTaxaTreesDocument()
XML deserialization constructor.
|
DefaultSameTaxaTreesDocument(org.jdom.Element element)
XML deserialization constructor.
|
DefaultSameTaxaTreesDocument(List<? extends Tree> trees,
String treeName,
Date created)
Construct from explicit values
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canExport(ExportableDocument.Format format)
Check if a format is supported by document.
|
boolean |
export(ExportableDocument.Format format,
OutputStream to)
Export a document.
|
void |
fromXML(org.jdom.Element doc)
Restore the object from the JDOM Element returned by
XMLSerializable.toXML(). |
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.
|
List<? extends Tree> |
getTrees()
Get tree set.
|
URN |
getURN()
A Universal Resource Name.
|
Geneious.MajorVersion |
getVersionSupport(XMLSerializable.VersionSupportType versionType)
Gets either the latest version this class can serialize to via
XMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener)
or the most recent version in which the XML returned from XMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener) last changed. |
void |
setSource(String format,
String fileText,
int nexusBlockNumber)
Save original text used when tree was imported.
|
void |
setTrees(List<? extends Tree> newTrees)
Set some trees.
|
String |
toHTML()
Provide a textual view of document.
|
org.jdom.Element |
toXML()
Convert object to a JDOM element.
|
org.jdom.Element |
toXML(Geneious.MajorVersion majorVersion,
ProgressListener progressListener)
Serializes this class to XML format, potentially to a format readable by an earlier version of Geneious.
|
public DefaultSameTaxaTreesDocument()
XMLSerializablepublic DefaultSameTaxaTreesDocument(List<? extends Tree> trees, String treeName, Date created)
trees - all trees in settreeName - default document namecreated - date of creation (null for now)IllegalArgumentException - if not all trees have the same taxapublic DefaultSameTaxaTreesDocument(org.jdom.Element element)
throws XMLSerializationException
XMLSerializableelement - the previously serialized element returned from toXML().XMLSerializationException - if deserialization failspublic void setSource(String format, String fileText, int nexusBlockNumber)
format - format of textfileText - original textnexusBlockNumber - if in nexus format, starting block number inside nexus file.org.jdom.IllegalDataException - if fileText is not legal XML character data,
as determined by Verifier.checkCharacterData(String).public boolean canExport(ExportableDocument.Format format)
ExportableDocumentcanExport in interface ExportableDocumentformat - export formatpublic boolean export(ExportableDocument.Format format, OutputStream to) throws IOException
ExportableDocumentexport in interface ExportableDocumentformat - format to exportto - output document to this stream.IOException - if the OutputStream can't be written to for any reasonpublic org.jdom.Element toXML()
XMLSerializableXMLSerializable.fromXML(org.jdom.Element) can completely
restore the objects representation.
It is recommended that the returned element use XMLSerializable.ROOT_ELEMENT_NAME as its name,
in which case it must not define an attribute called "type". In this case,
fromXML, will be called with an element whose name may differ from the element
return from this function. This recommendation allows a more compact representation
of the XML can be stored.
This method generally should not be called directly. Instead, you should usually call
XMLSerializer.classToXML(String, XMLSerializable)
which calls this method internally.
PluginDocument implementations of this method may choose to throw an XMLSerializationException,
enclosed in a RuntimeException.toXML in interface XMLSerializablepublic Geneious.MajorVersion getVersionSupport(XMLSerializable.VersionSupportType versionType)
XMLSerializable.OldVersionCompatibleXMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener)
or the most recent version in which the XML returned from XMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener) last changed.getVersionSupport in interface XMLSerializable.OldVersionCompatibleversionType - specifies which version property to returnpublic org.jdom.Element toXML(Geneious.MajorVersion majorVersion, ProgressListener progressListener)
XMLSerializable.OldVersionCompatibleXMLSerializable.toXML() for a more
detailed description of what it means to serialize to XML.
All classes that implement this method must also implement XMLSerializable.toXML() and should delegate back to
this method using Geneious.getMajorVersion() and ProgressListener.EMPTY as parameters.toXML in interface XMLSerializable.OldVersionCompatiblemajorVersion - the major version of Geneious to serialize to XML for. For example "6.0" but not "6.0.0". This must be a version
returned greater or equal to a version returned from
getVersionSupport(VersionSupportType.OldestVersionSerializableTo)
and must never be greater than the current version (Geneious.getMajorVersion())progressListener - for reporting progress and cancellingpublic void fromXML(org.jdom.Element doc)
throws XMLSerializationException
XMLSerializableXMLSerializable.toXML().
This method generally should not be called directly. Instead, you should usually call
XMLSerializer.classFromXML(org.jdom.Element)
or XMLSerializer.classFromXML(org.jdom.Element, Class)
which calls this method internally.
It is optional to implement this method. Instead of implementing an empty constructor and implementing
this method properly, the implementation may instead
throw an UnsupportedOperationException and implement a constructor
that takes a single Element as a parameter.
This allows for cleaner code such as support for final fields in the XMLSerializable class.
The element parameter should not be modified since it may be reused. If you need a modified version of it,
take a copy with Element.clone().fromXML in interface XMLSerializabledoc - representation from a previous call to XMLSerializable.toXML()XMLSerializationException - if the Element can't be converted into this type of objectpublic List<DocumentField> getDisplayableFields()
PluginDocumentPluginDocument.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.getDisplayableFields in interface PluginDocumentpublic Object getFieldValue(String fieldCodeName)
PluginDocumentgetFieldValue in interface PluginDocumentfieldCodeName - field code. This should be the
code of one of the fields
returned from PluginDocument.getDisplayableFields().DocumentField.getValueType() (or a subclass) of the corresponding DocumentField returned from PluginDocument.getDisplayableFields().public String getName()
PluginDocumentAnnotatedPluginDocument 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.getName in interface PluginDocumentpublic URN getURN()
PluginDocumentgetURN in interface PluginDocumentpublic Date getCreationDate()
PluginDocumentAnnotatedPluginDocument.getCreationDate()
instead as that will return either the date returned from
PluginDocument.getCreationDate() or if that returned null,
AnnotatedPluginDocument.getCreationDate() will return the date the
document was first instantiated.getCreationDate in interface PluginDocumentPluginDocument.MODIFIED_DATE_FIELDpublic String getDescription()
PluginDocumentgetDescription in interface PluginDocumentpublic String toHTML()
PluginDocument<html>toHTML in interface PluginDocumentpublic List<? extends Tree> getTrees()
SameTaxaTreesDocumentgetTrees in interface SameTaxaTreesDocumentpublic void setTrees(List<? extends Tree> newTrees)
EditableSameTaxaTreesDocumentsetTrees in interface EditableSameTaxaTreesDocumentnewTrees - A list of new trees. A null entry means no change and the existing tree is taken.