Home / Development / Documentation / 2.0.44 / XTGWriter
TreeGraph 2
 


info.bioinfweb.treegraph.document.io.xtg
Class XTGWriter

java.lang.Object
  extended by info.bioinfweb.treegraph.document.io.AbstractDocumentWriter
      extended by info.bioinfweb.treegraph.document.io.xtg.XTGWriter
All Implemented Interfaces:
DocumentWriter, XTGConstants

public class XTGWriter
extends AbstractDocumentWriter
implements XTGConstants, DocumentWriter


Field Summary
static String STREAM_ENCODING
           
private  XMLStreamWriter writer
           
static String XML_ENCODING
           
static String XML_VERSION
           
 
Fields inherited from class info.bioinfweb.treegraph.document.io.AbstractDocumentWriter
DEFAULT_ADAPTER, document
 
Fields inherited from interface info.bioinfweb.treegraph.document.io.xtg.XTGConstants
ALIGN_LEFT, ALIGN_RIGHT, ALIGN_TREE_WIDTH, ATTR_ALIGN_TO_SUBTREE, ATTR_BG_COLOR, ATTR_BOTTOM, ATTR_BRANCH_LENGTH, ATTR_BRANCH_LENGTH_SCALE, ATTR_CONSTANT_WIDTH, ATTR_DECIMAL_FORMAT, ATTR_EDGE_RADIUS, ATTR_FONT_FAMILY, ATTR_HEIGHT, ATTR_ICON, ATTR_ICON_FILLED, ATTR_ICON_HEIGHT, ATTR_ICON_WIDTH, ATTR_ID, ATTR_LABEL_ABOVE, ATTR_LABEL_HEIGHT, ATTR_LABEL_SPACING, ATTR_LABEL_WIDTH, ATTR_LEFT, ATTR_LEGEND_POS, ATTR_LEGEND_SPACING, ATTR_LEGEND_STYLE, ATTR_LINE_COLOR, ATTR_LINE_NO, ATTR_LINE_POS, ATTR_LINE_WIDTH, ATTR_LOCALE_COUNTRY, ATTR_LOCALE_LANG, ATTR_LOCALE_VARIANT, ATTR_LONG_INTERVAL, ATTR_MIN_BRANCH_LENGTH, ATTR_MIN_SPACE_ABOVE, ATTR_MIN_SPACE_BELOW, ATTR_MIN_TREE_DISTANCE, ATTR_POSITION_LABELS_TO_LEFT, ATTR_RIGHT, ATTR_SCALE_BAR_ALIGN, ATTR_SCALE_BAR_DISTANCE, ATTR_SCALE_BAR_HEIGHT, ATTR_SCALE_BAR_INCREASE, ATTR_SCALE_BAR_START, ATTR_SCALE_BAR_WIDTH, ATTR_SHOW_INTERNAL_LINES, ATTR_SHOW_NULL_LINES, ATTR_SHOW_ROOTED, ATTR_SHOW_SCALE_BAR, ATTR_SMALL_INTERVAL, ATTR_TEXT, ATTR_TEXT_COLOR, ATTR_TEXT_HEIGHT, ATTR_TEXT_IS_DECIMAL, ATTR_TEXT_ORIENTATION, ATTR_TEXT_STYLE, ATTR_TOP, ATTR_UNIQUE_NAME, ATTR_WIDTH, BRANCH_LENGTH_UNITS, FULL_SCHEMA_LOCATION, MILLIMETERS, NAMESPACE_URI, ORIENT_DOWN, ORIENT_HORIZONTAL, ORIENT_UP, PRE_LEGEND_ANCHOR, STYLE_BOLD, STYLE_BRACE, STYLE_BRACKET, STYLE_ITALIC, STYLE_UNDERLINE, TAG_BRANCH, TAG_DOC_MARGIN, TAG_GLOBAL_FORMATS, TAG_HIDDEN_DATA, TAG_ICON_LABEL, TAG_LABEL_MARGIN, TAG_LEAF_MARGIN, TAG_LEGEND, TAG_LEGEND_MARGIN, TAG_NODE, TAG_PIE_CHART_ID, TAG_PIE_CHART_IDS, TAG_PIE_CHART_LABEL, TAG_ROOT, TAG_SCALE_BAR, TAG_TEXT_LABEL, TAG_TREE, VERSION
 
Constructor Summary
XTGWriter()
           
 
Method Summary
private  String formatColor(Color color)
           
private  String formatColorByte(int value)
           
private  String formatTextStyle(TextFormats f)
           
 void write(Document document, OutputStream stream)
           
 void write(Document document, OutputStream stream, NodeBranchDataAdapter internalAdapter, NodeBranchDataAdapter leafAdapter, NodeBranchDataAdapter branchLengthAdapter)
          A call of this method is identical with calling write(info.bioinfweb.treegraph.document.Document, java.io.OutputStream) because the XTG format supports writing any number of labels by default and there is no need to replace internal node names by label values.
private  void writeAnchor(LegendFormats f, int no)
           
private  void writeDistanceDimension(String name, DistanceDimension d)
           
private  void writeGlobalFormats(GlobalFormats f)
           
private  void writeHiddenDataMap(HiddenDataMap m)
           
private  void writeLabelBlock(Labels labels, boolean above)
           
private  void writeLabelDimensions(GraphicalLabelFormats f)
           
private  void writeLegends(Legends legends)
           
private  void writeLineAttr(LineFormats f)
           
private  void writeMargin(String name, Margin m)
           
private  void writeScaleBar(ScaleBar sb)
           
private  void writeScaleValue(String name, ScaleValue v)
           
private  void writeSubtree(Node root)
           
private  void writeTextElementData(TextElementData data)
           
private  void writeTextFormatsAttr(TextFormats f)
           
private  void writeTextFormatsAttr(TextFormats f, String prefix)
           
 
Methods inherited from class info.bioinfweb.treegraph.document.io.AbstractDocumentWriter
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface info.bioinfweb.treegraph.document.io.DocumentWriter
write, write
 

Field Detail

STREAM_ENCODING

public static final String STREAM_ENCODING
See Also:
Constant Field Values

XML_VERSION

public static String XML_VERSION

XML_ENCODING

public static String XML_ENCODING

writer

private XMLStreamWriter writer
Constructor Detail

XTGWriter

public XTGWriter()
Method Detail

formatColorByte

private String formatColorByte(int value)

formatColor

private String formatColor(Color color)

formatTextStyle

private String formatTextStyle(TextFormats f)

writeTextElementData

private void writeTextElementData(TextElementData data)
                           throws XMLStreamException
Throws:
XMLStreamException

writeDistanceDimension

private void writeDistanceDimension(String name,
                                    DistanceDimension d)
                             throws XMLStreamException
Throws:
XMLStreamException

writeMargin

private void writeMargin(String name,
                         Margin m)
                  throws XMLStreamException
Throws:
XMLStreamException

writeGlobalFormats

private void writeGlobalFormats(GlobalFormats f)
                         throws XMLStreamException
Throws:
XMLStreamException

writeTextFormatsAttr

private void writeTextFormatsAttr(TextFormats f)
                           throws XMLStreamException
Throws:
XMLStreamException

writeTextFormatsAttr

private void writeTextFormatsAttr(TextFormats f,
                                  String prefix)
                           throws XMLStreamException
Throws:
XMLStreamException

writeLineAttr

private void writeLineAttr(LineFormats f)
                    throws XMLStreamException
Throws:
XMLStreamException

writeLabelDimensions

private void writeLabelDimensions(GraphicalLabelFormats f)
                           throws XMLStreamException
Throws:
XMLStreamException

writeLabelBlock

private void writeLabelBlock(Labels labels,
                             boolean above)
                      throws XMLStreamException
Throws:
XMLStreamException

writeHiddenDataMap

private void writeHiddenDataMap(HiddenDataMap m)
                         throws XMLStreamException
Throws:
XMLStreamException

writeSubtree

private void writeSubtree(Node root)
                   throws XMLStreamException
Throws:
XMLStreamException

writeScaleValue

private void writeScaleValue(String name,
                             ScaleValue v)
                      throws XMLStreamException
Throws:
XMLStreamException

writeScaleBar

private void writeScaleBar(ScaleBar sb)
                    throws XMLStreamException
Throws:
XMLStreamException

writeAnchor

private void writeAnchor(LegendFormats f,
                         int no)
                  throws XMLStreamException
Throws:
XMLStreamException

writeLegends

private void writeLegends(Legends legends)
                   throws XMLStreamException
Throws:
XMLStreamException

write

public void write(Document document,
                  OutputStream stream)
           throws Exception
Specified by:
write in interface DocumentWriter
Throws:
Exception

write

public void write(Document document,
                  OutputStream stream,
                  NodeBranchDataAdapter internalAdapter,
                  NodeBranchDataAdapter leafAdapter,
                  NodeBranchDataAdapter branchLengthAdapter)
           throws Exception
A call of this method is identical with calling write(info.bioinfweb.treegraph.document.Document, java.io.OutputStream) because the XTG format supports writing any number of labels by default and there is no need to replace internal node names by label values.

Specified by:
write in interface DocumentWriter
Throws:
Exception
See Also:
info.bioinfweb.treegraph.document.io.DocumentWriter#write(info.bioinfweb.treegraph.document.Document, java.io.OutputStream, NodeBranchDataAdapter, NodeBranchDataAdapter)