Package com.pixelmed.database

# Class DatabaseTreeModel

java.lang.Object
com.pixelmed.database.DatabaseTreeModel

All Implemented Interfaces:
  `TreeModel`

public class DatabaseTreeModel extends Object implements TreeModel

The `DatabaseTreeModel` class implements a `TreeModel` to abstract the contents of a database as a tree in order to provide support for a `DatabaseTreeBrowser`.

For details of some of the methods implemented here see `javax.swing.tree.TreeModel`.

## Constructor Summary

Constructors
Constructor
Description
`DatabaseTreeModel(DatabaseInformationModel d)`
Construct a tree model of the supplied database.

## Method Summary

Modifier and Type
Method
Description
`void`
`addTreeModelListener(TreeModelListener tml)`
`Object`
`getChild(Object node, int index)`
`int`
`getChildCount(Object parent)`
`int`
`getIndexOfChild(Object parent, Object child)`
`Object`
`getRoot()`
`boolean`
`isLeaf(Object node)`
`void`
`removeTreeModelListener(TreeModelListener tml)`
`String`
`toString()`
Dump the entire tree to a string.
`void`
`valueForPathChanged(TreePath path, Object newValue)`

### Methods inherited from class java.lang.Object

`clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### DatabaseTreeModel

public DatabaseTreeModel(DatabaseInformationModel d) throws DicomException

Construct a tree model of the supplied database.

Parameters:
  `d` - the database information model to build the tree from
Throws:
  `DicomException` - thrown if there are problems accessing the database

## Method Details

### getChild

public Object getChild(Object node, int index)

Specified by:
  `getChild` in interface `TreeModel`
Parameters:
  `node` -
  `index` -

### getIndexOfChild

public int getIndexOfChild(Object parent, Object child)

Specified by:
  `getIndexOfChild` in interface `TreeModel`
Parameters:
  `parent` -
  `child` -

### getRoot

public Object getRoot()

Specified by:
  `getRoot` in interface `TreeModel`

### getChildCount

public int getChildCount(Object parent)

Specified by:
  `getChildCount` in interface `TreeModel`
Parameters:
  `parent` -

### isLeaf

public boolean isLeaf(Object node)

Specified by:
  `isLeaf` in interface `TreeModel`
Parameters:
  `node` -

### valueForPathChanged

public void valueForPathChanged(TreePath path, Object newValue)

Specified by:
  `valueForPathChanged` in interface `TreeModel`
Parameters:
  `path` -
  `newValue` -

### addTreeModelListener

public void addTreeModelListener(TreeModelListener tml)

Specified by:
  `addTreeModelListener` in interface `TreeModel`
Parameters:
  `tml` -

### removeTreeModelListener

public void removeTreeModelListener(TreeModelListener tml)

Specified by:
  `removeTreeModelListener` in interface `TreeModel`
Parameters:
  `tml` -

### toString

public String toString()

Dump the entire tree to a string.

Performs a top-down traversal.

Overrides:
  `toString` in class `Object`
Returns:
  a multiline string with one line per node in the tree
See Also:
  - `DatabaseTreeRecord.toString()`