Class AttributeTreeRecord
- All Implemented Interfaces:
Comparable
,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
ConstructorsConstructorDescriptionAttributeTreeRecord
(AttributeTreeRecord p, int ic) Construct a record for an item of a sequence attribute.Construct a record for an attribute. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.children()
Returns the children of this node as anEnumeration
.int
boolean
boolean
Always returns true, since children may always be added.Get the attribute corresponding to this record.getChildAt
(int index) Returns the child at the specified index.int
Return the number of children that this node contains.int
Returns the index of the specified child from amongst this node's children, if present.int
Get the number of items in a Sequence attribute record.Returns the parent node of this node.boolean
isLeaf()
Returns true if the receiver is a leaf (has no children).void
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.toString()
Dump the record as a string.
-
Constructor Details
-
AttributeTreeRecord
Construct a record for an attribute.
- Parameters:
p
- parent recorda
- attribute to addd
- dictionary for looking up the name
-
AttributeTreeRecord
Construct a record for an item of a sequence attribute.
- Parameters:
p
- parent recordic
- which item (numbered from 0)
-
-
Method Details
-
toString
Dump the record as a string.
-
compareTo
- Specified by:
compareTo
in interfaceComparable
-
equals
-
getParent
Returns the parent node of this node.
-
getChildAt
Returns the child at the specified index.
- Specified by:
getChildAt
in interfaceTreeNode
- Parameters:
index
- the index of the child to be returned, numbered from 0- Returns:
- the child
TreeNode
at the specified index
-
getIndex
Returns the index of the specified child from amongst this node's children, if present.
-
getAllowsChildren
public boolean getAllowsChildren()Always returns true, since children may always be added.
- Specified by:
getAllowsChildren
in interfaceTreeNode
- Returns:
- always true
-
isLeaf
public boolean isLeaf()Returns true if the receiver is a leaf (has no children).
-
getChildCount
public int getChildCount()Return the number of children that this node contains.
- Specified by:
getChildCount
in interfaceTreeNode
- Returns:
- the number of children, 0 if none
-
children
Returns the children of this node as an
Enumeration
. -
addChild
Add a child node to the current node, keeping the children sorted.
- Parameters:
child
- the child to add
-
removeChild
- Parameters:
child
- the child to remove
-
removeAllChildren
public void removeAllChildren()Remove all child nodes.
-
addSibling
Add a sibling to the current node, keeping the children sorted.
- Parameters:
sibling
- the sibling to add- Throws:
DicomException
- if attempt to add sibling to node without parent
-
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
-