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.TreeNodeInstances of the
AttributeTreeRecordclass represent nodes in a tree of theAttributeTreeclass, which in turn is used by theAttributeTreeBrowserclass.Each record represents a single attribute.
-
-
Constructor Summary
Constructors Constructor Description AttributeTreeRecord(AttributeTreeRecord p, int ic)Construct a record for an item of a sequence attribute.AttributeTreeRecord(AttributeTreeRecord p, Attribute a, DicomDictionary d)Construct a record for an attribute.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChild(AttributeTreeRecord child)Add a child node to the current node, keeping the children sorted.voidaddSibling(AttributeTreeRecord sibling)Add a sibling to the current node, keeping the children sorted.java.util.Enumerationchildren()Returns the children of this node as anEnumeration.intcompareTo(java.lang.Object o)booleanequals(java.lang.Object o)booleangetAllowsChildren()Always returns true, since children may always be added.AttributegetAttribute()Get the attribute corresponding to this record.javax.swing.tree.TreeNodegetChildAt(int index)Returns the child at the specified index.intgetChildCount()Return the number of children that this node contains.intgetIndex(javax.swing.tree.TreeNode child)Returns the index of the specified child from amongst this node's children, if present.intgetItemCount()Get the number of items in a Sequence attribute record.javax.swing.tree.TreeNodegetParent()Returns the parent node of this node.booleanisLeaf()Returns true if the receiver is a leaf (has no children).voidremoveAllChildren()Remove all child nodes.voidremoveChild(AttributeTreeRecord child)voidsetSortByName(boolean sortByName)Set the sort order to be alphabetical by attribute name, or numerical by group and element tag.java.lang.StringtoString()Dump the record as a string.
-
-
-
Constructor Detail
-
AttributeTreeRecord
public AttributeTreeRecord(AttributeTreeRecord p, Attribute a, DicomDictionary d)
Construct a record for an attribute.
- Parameters:
p- parent recorda- attribute to addd- 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 recordic- which item (numbered from 0)
-
-
Method Detail
-
toString
public java.lang.String toString()
Dump the record as a string.
- Overrides:
toStringin classjava.lang.Object- Returns:
- the attribute tag, name and value(s) as a string
-
compareTo
public int compareTo(java.lang.Object o)
- Specified by:
compareToin interfacejava.lang.Comparable
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
getParent
public javax.swing.tree.TreeNode getParent()
Returns the parent node of this node.
- Specified by:
getParentin interfacejavax.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:
getChildAtin interfacejavax.swing.tree.TreeNode- Parameters:
index- the index of the child to be returned, numbered from 0- Returns:
- the child
TreeNodeat 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:
getIndexin interfacejavax.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:
getAllowsChildrenin interfacejavax.swing.tree.TreeNode- Returns:
- always true
-
isLeaf
public boolean isLeaf()
Returns true if the receiver is a leaf (has no children).
- Specified by:
isLeafin interfacejavax.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:
getChildCountin interfacejavax.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:
childrenin interfacejavax.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- the child to remove
-
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- if attempt to add sibling to node without parent
-
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
-
-