if ( !authzManager.authorize( item, identity ) ) {
return null;
}
if ( item instanceof MenuItemCommand ) {
final MenuItemCommand cmdItem = (MenuItemCommand) item;
final Widget gwtItem;
if ( isRoot ) {
gwtItem = new Button( cmdItem.getCaption() ) {{
setSize( MINI );
setEnabled( item.isEnabled() );
addClickHandler( new ClickHandler() {
@Override
public void onClick( final ClickEvent event ) {
cmdItem.getCommand().execute();
}
} );
}};
item.addEnabledStateChangeListener( new EnabledStateChangeListener() {
@Override
public void enabledStateChanged( final boolean enabled ) {
( (Button) gwtItem ).setEnabled( enabled );
}
} );
} else {
gwtItem = new NavLink( cmdItem.getCaption() ) {{
setDisabled( !item.isEnabled() );
addClickHandler( new ClickHandler() {
@Override
public void onClick( final ClickEvent event ) {
cmdItem.getCommand().execute();
}
} );
}};
item.addEnabledStateChangeListener( new EnabledStateChangeListener() {
@Override