protected static void setSelected ( TreeElement node , String selected , ServletRequest request ) { assert ( node != null ) : "parameter 'node' must not be null" ; assert ( selected != null ) : "parameter 'selected' must not be null" ; assert ( request != null ) : "parameter 'requested' must not be null" ; if ( node . getName ( ) . equals ( selected ) ) { node . onSelect ( request ) ; node . setSelected ( true ) ; } else { if ( node . isSelected ( ) ) { node . onSelect ( request ) ; node . setSelected ( false ) ; } } TreeElement children [ ] = node . getChildren ( ) ; assert ( children != null ) ; for ( int i = 0 ; i < children . length ; i ++ ) { setSelected ( children [ i ] , selected , request ) ; } }
Recursive routine to set the selected node . This will set the selected node and clear the selection on all other nodes . It will walk the full tree .