com.pixelmed.query

## Class QueryTreeModel

- java.lang.Object
- - com.pixelmed.query.QueryTreeModel

All Implemented Interfaces:
  javax.swing.tree.TreeModel

    public class QueryTreeModel
    extends java.lang.Object
    implements javax.swing.tree.TreeModel

The `QueryTreeModel` class implements a `TreeModel` to abstract the contents of a query response as a tree in order to provide support for a `QueryTreeBrowser`.

See Also:
  `TreeModel`

### Constructor Summary

Constructors
Constructor and Description
`QueryTreeModel(QueryInformationModel q, AttributeList filter, int debugLevel)` Construct a tree model with a root node on top.

### Method Summary

Methods
`void` `addTreeModelListener(javax.swing.event.TreeModelListener tml)`
`java.lang.Object` `getChild(java.lang.Object node, int index)`
`int` `getChildCount(java.lang.Object parent)`
`int` `getIndexOfChild(java.lang.Object parent, java.lang.Object child)`
`java.lang.Object` `getRoot()`
`boolean` `isLeaf(java.lang.Object node)`
`void` `removeTreeModelListener(javax.swing.event.TreeModelListener tml)`
`java.lang.String` `toString()` Dump the entire tree to a string.
`void` `valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)`

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

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

### Constructor Detail

#### QueryTreeModel

    public QueryTreeModel(QueryInformationModel q,
                  AttributeList filter,
                  int debugLevel)
                   throws DicomException

Construct a tree model with a root node on top.

The root node is the name of the called AET in the query information model.

The contents are added as required by actually performing queries as nodes are expanded.

Parameters:
  `q` - the query information model to build the tree from
  `filter` - the query request identifier as a list of DICOM attributes
  `debugLevel` - 0 is no debugging (silent), > 0 more verbose levels of debugging
Throws:
  `DicomException` - thrown if there are problems building the tree

### Method Detail

#### getChild

    public java.lang.Object getChild(java.lang.Object node,
                            int index)

Specified by:
  `getChild` in interface `javax.swing.tree.TreeModel`
Parameters:
  `node` -
  `index` -

#### getIndexOfChild

    public int getIndexOfChild(java.lang.Object parent,
                      java.lang.Object child)

Specified by:
  `getIndexOfChild` in interface `javax.swing.tree.TreeModel`
Parameters:
  `parent` -
  `child` -

#### getRoot

    public java.lang.Object getRoot()

Specified by:
  `getRoot` in interface `javax.swing.tree.TreeModel`

#### getChildCount

    public int getChildCount(java.lang.Object parent)

Specified by:
  `getChildCount` in interface `javax.swing.tree.TreeModel`
Parameters:
  `parent` -

#### isLeaf

    public boolean isLeaf(java.lang.Object node)

Specified by:
  `isLeaf` in interface `javax.swing.tree.TreeModel`
Parameters:
  `node` -

#### valueForPathChanged

    public void valueForPathChanged(javax.swing.tree.TreePath path,
                           java.lang.Object newValue)

Specified by:
  `valueForPathChanged` in interface `javax.swing.tree.TreeModel`
Parameters:
  `path` -
  `newValue` -

#### addTreeModelListener

    public void addTreeModelListener(javax.swing.event.TreeModelListener tml)

Specified by:
  `addTreeModelListener` in interface `javax.swing.tree.TreeModel`
Parameters:
  `tml` -

#### removeTreeModelListener

    public void removeTreeModelListener(javax.swing.event.TreeModelListener tml)

Specified by:
  `removeTreeModelListener` in interface `javax.swing.tree.TreeModel`
Parameters:
  `tml` -

#### toString

    public java.lang.String toString()

Dump the entire tree to a string.

Performs a top-down traversal.

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