Documentation
This pages gives a short description on how TreeGraph 2 is implemented. A detailed description of all packages and classes can be found in the Javadoc.
Contents |
The package structure of TreeGraph 2
All classes of TreeGraph 2 are contained in the info.bioinfweb.treegraph package, which also contains its main class (info.bioinfweb.treegraph.Main). The application is divided into the following main subpackages:
-
Document
(info.bioinfweb.treegraph.document): Contains the classes that represent the data structure of TreeGraph 2
(document elements and formats) as well as all edit operations
in the
undo
-package to manipulate the data structure and classes to read and write a document from and to different formats (io
-subpackage). - Graphical user interface (info.bioinfweb.treegraph.gui): Contains all classes related to the TreeGraph 2 GUI including its main frame, document windows, dialogs and actions.
- Graphics (info.bioinfweb.treegraph.graphics): This package contains classes that deal with the graphical representation of TreeGraph 2 documents. It contains one subpackage which deals with positioning and painting of document elements (package description) and one that handles the export of trees to different graphic formats (package description).
- Command line (info.bioinfweb.treegraph.cmd): Smaller package that contains classes that process the command line arguments for TreeGraph 2.
The document elements
Data structure
A TreeGraph 2 document is represented by the Document class which acts as the model in the MVC paradigm used in the implementation. Each instance of Document owns a Tree objects which owns and manages the actual classes representing the single document elements.
A Tree objects contains the paintStart pointer which points at a Node object representing the root node of the document. (Unrooted documents are also represented rooted internally but the afferent branch of the root node is not painted. See here for details.) Each Node object can be linked to several subnodes with a composition, which represents the topology of a tree document. Branches that link nodes are modeled as objects owned by the Node object they lead to. The branches on the other hand own a list of labels. Both nodes and branches own a HiddenDataMap object that stores the hidden node or branch data.
Besides the root node and its subelements the Tree object also own a list of legends and the scale bar of the document (no matter if it currently visible or not).
Class and interface hierarchy
All document elements (which are painted with Graphics2D to represent the tree) implement PaintableElement. Depending on their character they additionally implement...
- TextElement if they display textual data.
- LineElement if they have to draw lines.
- CornerRadiusElement if have an adjustable corner radius.
- TreeElement if they are part of the actual tree (which is true for all elements except legends and the scale bar).
Note that some elements (e.g. legends) can be both text and line elements.