int iconIndex = 0;
for( int i = 0; i < count; i++ )
{
boolean active = true;
// final String fix = name + "." + i;
final MenuItemDef itemDef = (MenuItemDef) items.elementAt( i );
if( itemDef.getOnlyIf() != null )
{
active = ViewFactory.hasFlag( itemDef.getOnlyIf() );
}
else if( itemDef.getUnless() != null )
{
active = !ViewFactory.hasFlag( itemDef.getUnless() );
}
final int icon = iconIndex++;
final int selectedIcon = iconIndex++;
if( active )
{
menu.addItem(
itemDef.getTitle(),
itemDef.getIconIndex() != null ?
itemDef.getIconIndex().intValue() :
icon,
itemDef.getSelectedIconIndex() != null ?
itemDef.getSelectedIconIndex().intValue() :
selectedIcon,
itemDef.getAction(),
itemDef.getHelp(),
itemDef.getView()
);
}
}
menuView.helpId = menuDef.getHelpId();
return menuView;