Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## info.bioinfweb.treegraph.document
Class Document

    java.lang.Object
      info.webinsel.util.ChangeMonitor
          info.webinsel.util.io.AbstractSaver
              info.webinsel.util.swing.SwingSaver
                  info.bioinfweb.treegraph.document.Document

All Implemented Interfaces:
  info.webinsel.util.ChangeMonitorable, info.webinsel.util.io.Savable, info.webinsel.util.swing.SwingSavable

    public class Document

extends info.webinsel.util.swing.SwingSaver
implements info.webinsel.util.ChangeMonitorable, info.webinsel.util.io.Savable, info.webinsel.util.swing.SwingSavable

Instances of this class contain the data for a tree and its formats as well as position-information for all `TreePositioner`s used with this `Document`.
Furthermore instances of this class contain lists of `TreePositioner`s and `TreeView`s which want to be alerted if the content of this `Document` is modified. `Document` acts as the model in MVC- paradigm used in the user-interface of TreeGraph 2.

Author:
  Ben Stöver

Field Summary
`private TreeInternalFrame` | `frame`
`private EnumMap<PositionPaintType,Boolean>` | `painters`
`private EnumMap<PositionPaintType,Boolean>` | `positioners`
`private Tree` | `tree`
`private info.webinsel.util.swing.AccessibleUndoManager` | `undoManager`
`private info.webinsel.util.io.FormatVersion` | `version`
`private Vector<DocumentView>` | `views`
`private static int` | `VIEWS_CAPACITY`
`private static int` | `VIEWS_CAPACITY_INCREMENT`

Constructor Summary
`Document()` Creates a new Instance of `Document` with a default name.
`Document(boolean registerFileChooser)`
`Document(String name)` Creates a new Instance of `Document`.

Method Summary
`boolean` | `addView(DocumentView view)`
`private void` | `alertPositioners()` Alerts all registered positioners to reposition the tree elements becuase of made changes.
`void` | `executeEdit(DocumentEdit edit)`
`private void` | `fireChangeHappened()` Alerts all registered views to display made changes.
`TreeInternalFrame` | `getFrame()`
`Tree` | `getTree()`
`info.webinsel.util.swing.AccessibleUndoManager` | `getUndoManager()`
`info.webinsel.util.io.FormatVersion` | `getVersion()` Returns the version this document has been loaded from.
`private void` | `init(boolean registerFileChooser)`
`private void` | `initSets()`
`void` | `registerChange()`
`void` | `registerPositioner(PositionPaintType type)`
`boolean` | `removeView(DocumentView view)`
`void` | `reset()`
`protected void` | `saveDataToFile(File file)`
`void` | `setDefaultName(String name)`
`void` | `setFile(File file)`
`void` | `setFrame(TreeInternalFrame frame)`
`void` | `setTree(Tree tree)`
`void` | `setVersion(info.webinsel.util.io.FormatVersion version)`
`void` | `unregisterPositioner(PositionPaintType type)`
`private void` | `updateFrame()`

Methods inherited from class info.webinsel.util.swing.SwingSaver
`askToSave, askToSave, getFileChooser, saveAs, saveAs`

Methods inherited from class info.webinsel.util.io.AbstractSaver
`addFileExtension, endsWithDefaultExt, endsWithValidExt, getDefaultExtension, getDefaultName, getDefaultNameOrPath, getFile, getFileExtensions, hasFile, removeFileExtention, save, setDefaultExtension`

Methods inherited from class info.webinsel.util.ChangeMonitor
`hasChanged`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface info.webinsel.util.swing.SwingSavable
`askToSave, getFileChooser, saveAs`

Methods inherited from interface info.webinsel.util.io.Savable
`addFileExtension, askToSave, endsWithDefaultExt, endsWithValidExt, getDefaultExtension, getDefaultName, getDefaultNameOrPath, getFile, getFileExtensions, hasFile, removeFileExtention, save, saveAs, setDefaultExtension`

Methods inherited from interface info.webinsel.util.ChangeMonitorable
`hasChanged`

Field Detail

### VIEWS_CAPACITY

    private static final int VIEWS_CAPACITY

See Also:
  Constant Field Values

### VIEWS_CAPACITY_INCREMENT

    private static final int VIEWS_CAPACITY_INCREMENT

See Also:
  Constant Field Values

### version

    private info.webinsel.util.io.FormatVersion version

### undoManager

    private info.webinsel.util.swing.AccessibleUndoManager undoManager

### frame

    private TreeInternalFrame frame

### views

    private Vector<DocumentView> views

### tree

    private Tree tree

### positioners

    private EnumMap<PositionPaintType,Boolean> positioners

### painters

    private EnumMap<PositionPaintType,Boolean> painters

Constructor Detail

### Document

    public Document()

  Creates a new Instance of `Document` with a default name.

### Document

    public Document(String name)

  Creates a new Instance of `Document`.

  Parameters:
    `name` - the name prefix that should be used for the default name

### Document

    public Document(boolean registerFileChooser)

Method Detail

### init

    private void init(boolean registerFileChooser)

### initSets

    private void initSets()

### getVersion

    public info.webinsel.util.io.FormatVersion getVersion()

  Returns the version this document has been loaded from.

  Returns:
    the version or `null` if the document was not loaded from an XTG file or the version of the XTG file was unknown

### setVersion

    public void setVersion(info.webinsel.util.io.FormatVersion version)

### getUndoManager

    public info.webinsel.util.swing.AccessibleUndoManager getUndoManager()

### getFrame

    public TreeInternalFrame getFrame()

### setFrame

    public void setFrame(TreeInternalFrame frame)

### addView

    public boolean addView(DocumentView view)

### removeView

    public boolean removeView(DocumentView view)

### registerPositioner

    public void registerPositioner(PositionPaintType type)

### unregisterPositioner

    public void unregisterPositioner(PositionPaintType type)

### getTree

    public Tree getTree()

### setTree

    public void setTree(Tree tree)

### updateFrame

    private void updateFrame()

### setDefaultName

    public void setDefaultName(String name)

  Specified by:
    `setDefaultName` in interface `info.webinsel.util.io.Savable`
  Overrides:
    `setDefaultName` in class `info.webinsel.util.io.AbstractSaver`

### setFile

    public void setFile(File file)

  Specified by:
    `setFile` in interface `info.webinsel.util.io.Savable`
  Overrides:
    `setFile` in class `info.webinsel.util.io.AbstractSaver`

### executeEdit

    public void executeEdit(DocumentEdit edit)

### alertPositioners

    private void alertPositioners()

  Alerts all registered positioners to reposition the tree elements becuase of made changes.

### fireChangeHappened

    private void fireChangeHappened()

  Alerts all registered views to display made changes.

### registerChange

    public void registerChange()

  Specified by:
    `registerChange` in interface `info.webinsel.util.ChangeMonitorable`
  Overrides:
    `registerChange` in class `info.webinsel.util.ChangeMonitor`

### reset

    public void reset()

  Specified by:
    `reset` in interface `info.webinsel.util.ChangeMonitorable`
  Overrides:
    `reset` in class `info.webinsel.util.ChangeMonitor`

### saveDataToFile

    protected void saveDataToFile(File file)

  Specified by:
    `saveDataToFile` in class `info.webinsel.util.io.AbstractSaver`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD