@ SuppressWarnings ( "unchecked" ) public static < T > T getController ( BaseComponent comp , Class < T > type ) { while ( comp != null ) { Object controller = getController ( comp ) ; if ( type . isInstance ( controller ) ) { return ( T ) controller ; } comp = comp . getParent ( ) ; } return null ; }
Locates and returns a controller of the given type by searching up the component tree starting at the specified component .