public TreeElement getNode ( String element ) { TreeElement node = null ; Enumeration < TreeNode > elements = root . children ( ) ; while ( elements . hasMoreElements ( ) ) { TreeElement currentNode = ( TreeElement ) elements . nextElement ( ) ; if ( currentNode instanceof QueryGroupTreeElement ) { QueryGroupTreeElement groupTElement = ( QueryGroupTreeElement ) currentNode ; if ( groupTElement . getID ( ) . equals ( element ) ) { node = groupTElement ; break ; } } if ( currentNode instanceof QueryTreeElement ) { QueryTreeElement queryTreeElement = ( QueryTreeElement ) currentNode ; if ( queryTreeElement . getID ( ) . equals ( element ) ) { node = queryTreeElement ; break ; } } } return node ; }
Search a TreeElement node group or query and returns the object else returns null .