Class QueryTreeRecord
- java.lang.Object
-
- com.pixelmed.query.QueryTreeRecord
-
- All Implemented Interfaces:
java.lang.Comparable
,javax.swing.tree.TreeNode
public class QueryTreeRecord extends java.lang.Object implements java.lang.Comparable, javax.swing.tree.TreeNode
Instances of the
QueryTreeRecord
class represent nodes in a tree of theQueryTreeModel
class, which in turn is used by theQueryTreeBrowser
class.This class is publically visible primarily so that selection change listeners can be constructed for
QueryTreeBrowser
, since the user's selection is returned as a path ofQueryTreeRecord
instances, which need to be cast accordingly.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
QueryTreeRecord.OurResponseIdentifierHandler
-
Field Summary
Fields Modifier and Type Field Description protected AttributeList
allAttributesReturnedInIdentifier
protected java.util.List
children
protected boolean
childrenPopulated
protected AttributeList
filter
protected InformationEntity
ie
protected int
numberOfChildren
protected QueryTreeRecord
parent
protected QueryInformationModel
q
protected Attribute
uniqueKey
protected AttributeList
uniqueKeys
protected java.lang.String
value
-
Constructor Summary
Constructors Constructor Description QueryTreeRecord(QueryInformationModel q, AttributeList filter, QueryTreeRecord parent, java.lang.String value, InformationEntity ie, Attribute uniqueKey, AttributeList allAttributesReturnedInIdentifier)
Make a new node in a tree.QueryTreeRecord(QueryInformationModel q, AttributeList filter, QueryTreeRecord parent, java.lang.String value, InformationEntity ie, Attribute uniqueKey, AttributeList allAttributesReturnedInIdentifier, int debugLevel)
Make a new node in a tree.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChild(QueryTreeRecord child)
Add a child to this nodes sorted collection of children.void
addSibling(QueryTreeRecord sibling)
Add a sibling to this node, that is add a child to this node's parent's sorted collection of children.java.util.Enumeration
children()
Returns the children of this node as anEnumeration
.int
compareTo(java.lang.Object o)
Compare nodes based on the lexicographic order of their string values.boolean
equals(java.lang.Object o)
AttributeList
getAllAttributesReturnedInIdentifier()
Get the list of all the DICOM attributes from the query response for this level of the query.boolean
getAllowsChildren()
Always returns true, since children may always be added.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.InformationEntity
getInformationEntity()
Get the information entity that this node represents.javax.swing.tree.TreeNode
getParent()
Returns the parent node of this node.protected InformationEntity
getQueryLevelToPopulateChildren()
Attribute
getUniqueKey()
Get the DICOM attribute that is the unique key at the level of this record.AttributeList
getUniqueKeys()
Get the list of DICOM attributes, one for each unique key of each parent of this level as well as this level itself.java.lang.String
getValue()
Get the string value of the node which is used for sorting and human-readable rendering.boolean
isLeaf()
Returns true if the receiver is a leaf (has no children).protected void
populateChildren()
protected void
populateChildrenIfRequired()
java.lang.String
toString()
Dump the string value of the node.
-
-
-
Field Detail
-
q
protected QueryInformationModel q
-
filter
protected AttributeList filter
-
parent
protected QueryTreeRecord parent
-
children
protected java.util.List children
-
ie
protected InformationEntity ie
-
uniqueKey
protected Attribute uniqueKey
-
uniqueKeys
protected AttributeList uniqueKeys
-
allAttributesReturnedInIdentifier
protected AttributeList allAttributesReturnedInIdentifier
-
value
protected java.lang.String value
-
childrenPopulated
protected boolean childrenPopulated
-
numberOfChildren
protected int numberOfChildren
-
-
Constructor Detail
-
QueryTreeRecord
public QueryTreeRecord(QueryInformationModel q, AttributeList filter, QueryTreeRecord parent, java.lang.String value, InformationEntity ie, Attribute uniqueKey, AttributeList allAttributesReturnedInIdentifier, int debugLevel)
Make a new node in a tree.
- Parameters:
q
- the query information model to build the tree fromfilter
- the query request identifier as a list of DICOM attributesparent
- the parent of this nodevalue
- a string value which is used primarily to sort siblings into lexicographic orderie
- the entity in the DICOM information model that the constructed node is an instance ofuniqueKey
- the DICOM attribute which is the unique key at the level of this recordallAttributesReturnedInIdentifier
- a list of all the DICOM attributes from the query response for this level of a querydebugLevel
- unused
-
QueryTreeRecord
public QueryTreeRecord(QueryInformationModel q, AttributeList filter, QueryTreeRecord parent, java.lang.String value, InformationEntity ie, Attribute uniqueKey, AttributeList allAttributesReturnedInIdentifier)
Make a new node in a tree.
- Parameters:
q
- the query information model to build the tree fromfilter
- the query request identifier as a list of DICOM attributesparent
- the parent of this nodevalue
- a string value which is used primarily to sort siblings into lexicographic orderie
- the entity in the DICOM information model that the constructed node is an instance ofuniqueKey
- the DICOM attribute which is the unique key at the level of this recordallAttributesReturnedInIdentifier
- a list of all the DICOM attributes from the query response for this level of a query
-
-
Method Detail
-
toString
public java.lang.String toString()
Dump the string value of the node.
- Overrides:
toString
in classjava.lang.Object
- Returns:
- the string value of this node
-
compareTo
public int compareTo(java.lang.Object o)
Compare nodes based on the lexicographic order of their string values.
Note that the comparison is more complex than a simple lexicographic comparison of strings (as described in the definition of
java.lang.String.compareTo(String)
but rather accounts for embedded non-zero padded integers. Seecom.pixelmed.utils.compareStringsWithEmbeddedNonZeroPaddedIntegers(String,String)
If the string values are equal but they do not have the same unique key, then an arbitrary but consistent order is return.
- Specified by:
compareTo
in interfacejava.lang.Comparable
- Parameters:
o
- theQueryTreeRecord
to compare thisQueryTreeRecord
against- Returns:
- the value 0 if the argument is equal to this object; a value less than 0 if this object is lexicographically less than the argument; and a value greater than 0 if this object is lexicographically greater than the argument
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
-
-
getParent
public javax.swing.tree.TreeNode getParent()
Returns the parent node of this node.
- Specified by:
getParent
in 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:
getChildAt
in interfacejavax.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 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:
getAllowsChildren
in interfacejavax.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 interfacejavax.swing.tree.TreeNode
- Returns:
- true if the receiver is a leaf
-
populateChildrenIfRequired
protected void populateChildrenIfRequired()
-
getChildCount
public int getChildCount()
Return the number of children that this node contains.
- Specified by:
getChildCount
in 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:
children
in interfacejavax.swing.tree.TreeNode
- Returns:
- the children of this node
-
getQueryLevelToPopulateChildren
protected InformationEntity getQueryLevelToPopulateChildren()
-
populateChildren
protected void populateChildren()
-
addChild
public void addChild(QueryTreeRecord child)
Add a child to this nodes sorted collection of children.
- Parameters:
child
- the child node to be added
-
addSibling
public void addSibling(QueryTreeRecord sibling) throws DicomException
Add a sibling to this node, that is add a child to this node's parent's sorted collection of children.
- Parameters:
sibling
- the sibling node to be added- Throws:
DicomException
- thrown if this node has no parent
-
getValue
public java.lang.String getValue()
Get the string value of the node which is used for sorting and human-readable rendering.
- Returns:
- the string value of this node
-
getInformationEntity
public InformationEntity getInformationEntity()
Get the information entity that this node represents.
- Returns:
- information entity that this node represents
-
getUniqueKeys
public AttributeList getUniqueKeys()
Get the list of DICOM attributes, one for each unique key of each parent of this level as well as this level itself.
- Returns:
- the list of unique keys
-
getUniqueKey
public Attribute getUniqueKey()
Get the DICOM attribute that is the unique key at the level of this record.
- Returns:
- the unique key
-
getAllAttributesReturnedInIdentifier
public AttributeList getAllAttributesReturnedInIdentifier()
Get the list of all the DICOM attributes from the query response for this level of the query.
- Returns:
- the list of all response attributes for this level
-
-