public static < T > T getAncestorOfClass ( final Class < T > clazz , final WComponent comp ) { if ( comp == null || clazz == null ) { return null ; } WComponent parent = comp . getParent ( ) ; while ( parent != null ) { if ( clazz . isInstance ( parent ) ) { return ( T ) parent ; } parent = parent . getParent ( ) ; } return null ; }
Attempts to find a component which is an ancestor of the given component and that is assignable to the given class .