com.pixelmed.dicom

## Class AttributeTreeRecord

- java.lang.Object
- - com.pixelmed.dicom.AttributeTreeRecord

All Implemented Interfaces:
  java.lang.Comparable, javax.swing.tree.TreeNode

    public class AttributeTreeRecord
    extends java.lang.Object
    implements java.lang.Comparable, javax.swing.tree.TreeNode

Instances of the `AttributeTreeRecord` class represent nodes in a tree of the `AttributeTree` class, which in turn is used by the `AttributeTreeBrowser` class.

Each record represents a single attribute.

### Constructor Summary

Constructors
Constructor and Description
`AttributeTreeRecord(AttributeTreeRecord p, Attribute a, DicomDictionary d)` Construct a record for an attribute.
`AttributeTreeRecord(AttributeTreeRecord p, int ic)` Construct a record for an item of a sequence attribute.

### Method Summary

Methods
`void` `addChild(AttributeTreeRecord child)` Add a child node to the current node, keeping the children sorted.
`void` `addSibling(AttributeTreeRecord sibling)` Add a sibling to the current node, keeping the children sorted..
`java.util.Enumeration` `children()` Returns the children of this node as an `Enumeration`.
`int` `compareTo(java.lang.Object o)`
`boolean` `equals(java.lang.Object o)`
`boolean` `getAllowsChildren()` Always returns true, since children may always be added.
`Attribute` `getAttribute()` Get the attribute corresponding to this record.
`javax.swing.tree.TreeNode` `getChildAt(int index)` Returns the child at the specified index.
`int` `getChildCount()` Return the number of children that this node contains.
`int` `getIndex(javax.swing.tree.TreeNode child)` Returns the index of the specified child from amongst this node's children, if present.
`int` `getItemCount()` Get the number of items in a Sequence attribute record.
`javax.swing.tree.TreeNode` `getParent()` Returns the parent node of this node.
`boolean` `isLeaf()` Returns true if the receiver is a leaf (has no children).
`void` `removeAllChildren()` Remove all child nodes.
`void` `removeChild(AttributeTreeRecord child)`
`void` `setSortByName(boolean sortByName)` Set the sort order to be alphabetical by attribute name, or numerical by group and element tag.
`java.lang.String` `toString()` Dump the record as a string.

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

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

### Constructor Detail

#### AttributeTreeRecord

    public AttributeTreeRecord(AttributeTreeRecord p,
                       Attribute a,
                       DicomDictionary d)

Construct a record for an attribute.

Parameters:
  `p` - parent record
  `a` - attribute to add
  `d` - dictionary for looking up the name

#### AttributeTreeRecord

    public AttributeTreeRecord(AttributeTreeRecord p,
                       int ic)

Construct a record for an item of a sequence attribute.

Parameters:
  `p` - parent record
  `ic` - which item (numbered from 0)

### Method Detail

#### toString

    public java.lang.String toString()

Dump the record as a string.

Overrides:
  `toString` in class `java.lang.Object`
Returns:
  the attribute tag, name and value(s) as a string

#### compareTo

    public int compareTo(java.lang.Object o)

Specified by:
  `compareTo` in interface `java.lang.Comparable`
Parameters:
  `o` -

#### equals

    public boolean equals(java.lang.Object o)

Overrides:
  `equals` in class `java.lang.Object`
Parameters:
  `o` -

#### getParent

    public javax.swing.tree.TreeNode getParent()

Returns the parent node of this node.

Specified by:
  `getParent` in interface `javax.swing.tree.TreeNode`
Returns:
  the parent node, or null if the root

#### getChildAt

    public javax.swing.tree.TreeNode getChildAt(int index)

Returns the child at the specified index.

Specified by:
  `getChildAt` in interface `javax.swing.tree.TreeNode`
Parameters:
  `index` - the index of the child to be returned, numbered from 0
Returns:
  the child `TreeNode` at the specified index

#### getIndex

    public int getIndex(javax.swing.tree.TreeNode child)

Returns the index of the specified child from amongst this node's children, if present.

Specified by:
  `getIndex` in interface `javax.swing.tree.TreeNode`
Parameters:
  `child` - the child to search for amongst this node's children
Returns:
  the index of the child, or -1 if not present

#### getAllowsChildren

    public boolean getAllowsChildren()

Always returns true, since children may always be added.

Specified by:
  `getAllowsChildren` in interface `javax.swing.tree.TreeNode`
Returns:
  always true

#### isLeaf

    public boolean isLeaf()

Returns true if the receiver is a leaf (has no children).

Specified by:
  `isLeaf` in interface `javax.swing.tree.TreeNode`
Returns:
  true if the receiver is a leaf

#### getChildCount

    public int getChildCount()

Return the number of children that this node contains.

Specified by:
  `getChildCount` in interface `javax.swing.tree.TreeNode`
Returns:
  the number of children, 0 if none

#### children

    public java.util.Enumeration children()

Returns the children of this node as an `Enumeration`.

Specified by:
  `children` in interface `javax.swing.tree.TreeNode`
Returns:
  the children of this node

#### addChild

    public void addChild(AttributeTreeRecord child)

Add a child node to the current node, keeping the children sorted.

Parameters:
  `child` - the child to add

#### removeChild

    public void removeChild(AttributeTreeRecord child)

Parameters:
  `child` -

#### removeAllChildren

    public void removeAllChildren()

Remove all child nodes.

#### addSibling

    public void addSibling(AttributeTreeRecord sibling)
                    throws DicomException

Add a sibling to the current node, keeping the children sorted..

Parameters:
  `sibling` - the sibling to add
Throws:
  `DicomException`

#### getAttribute

    public Attribute getAttribute()

Get the attribute corresponding to this record.

Returns:
  the attribute

#### getItemCount

    public int getItemCount()

Get the number of items in a Sequence attribute record.

Returns:
  the number of items

#### setSortByName

    public void setSortByName(boolean sortByName)

Set the sort order to be alphabetical by attribute name, or numerical by group and element tag.

Parameters:
  `sortByName` - true if sort alphabetically by attribute name