protected void checkActiveState ( Widget child ) { // Check if this widget has a valid href String href = child . getElement ( ) . getAttribute ( "href" ) ; String url = Window . Location . getHref ( ) ; int pos = url . indexOf ( "#" ) ; String location = pos >= 0 ? url . substring ( pos , url . length ( ) ) : "" ; if ( ! href . isEmpty ( ) && location . startsWith ( href ) ) { ListItem li = findListItemParent ( child ) ; if ( li != null ) { makeActive ( li ) ; } } else if ( child instanceof HasWidgets ) { // Recursive check for ( Widget w : ( HasWidgets ) child ) { checkActiveState ( w ) ; } } }
Checks if this child holds the current active state . If the child is or contains the active state it is applied .