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 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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public AttributeTreeRecord(AttributeTreeRecord p, Attribute a, DicomDictionary d)
Construct a record for an attribute.
p
- parent recorda
- attribute to addd
- dictionary for looking up the namepublic AttributeTreeRecord(AttributeTreeRecord p, int ic)
Construct a record for an item of a sequence attribute.
p
- parent recordic
- which item (numbered from 0)public void addChild(AttributeTreeRecord child)
Add a child node to the current node, keeping the children sorted.
child
- the child to addpublic void addSibling(AttributeTreeRecord sibling) throws DicomException
Add a sibling to the current node, keeping the children sorted.
sibling
- the sibling to addDicomException
- if attempt to add sibling to node without parentpublic java.util.Enumeration children()
Returns the children of this node as an Enumeration
.
children
in interface javax.swing.tree.TreeNode
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public boolean getAllowsChildren()
Always returns true, since children may always be added.
getAllowsChildren
in interface javax.swing.tree.TreeNode
public Attribute getAttribute()
Get the attribute corresponding to this record.
public javax.swing.tree.TreeNode getChildAt(int index)
Returns the child at the specified index.
getChildAt
in interface javax.swing.tree.TreeNode
index
- the index of the child to be returned, numbered from 0TreeNode
at the specified indexpublic int getChildCount()
Return the number of children that this node contains.
getChildCount
in interface javax.swing.tree.TreeNode
public int getIndex(javax.swing.tree.TreeNode child)
Returns the index of the specified child from amongst this node's children, if present.
getIndex
in interface javax.swing.tree.TreeNode
child
- the child to search for amongst this node's childrenpublic int getItemCount()
Get the number of items in a Sequence attribute record.
public javax.swing.tree.TreeNode getParent()
Returns the parent node of this node.
getParent
in interface javax.swing.tree.TreeNode
public boolean isLeaf()
Returns true if the receiver is a leaf (has no children).
isLeaf
in interface javax.swing.tree.TreeNode
public void removeAllChildren()
Remove all child nodes.
public void removeChild(AttributeTreeRecord child)
child
- the child to removepublic void setSortByName(boolean sortByName)
Set the sort order to be alphabetical by attribute name, or numerical by group and element tag.
sortByName
- true if sort alphabetically by attribute namepublic java.lang.String toString()
Dump the record as a string.
toString
in class java.lang.Object