throws RendererException {
// Select a renderer to render the contents of each option.
// This can be text and/or image depending on the style of the menu
// and or content of the menu item.
final MenuItemRenderer renderer =
selector.selectMenuItemRenderer(menu);
if (renderer == null) {
// We can't find a renderer for menu items, so there's not much
// point rendering the menu. This will happen in the pathological
// case where both the image and text styles are set to 'none'.
return;
}
// Construct a visitor which renders the menu.
// @todo model could use Composite, External and/or Internal Iterator
RendererMenuModelVisitor visitor = new RendererMenuModelVisitor() {
public void rendererVisit(MenuItem item)
throws RendererException {
// Use the menu item renderer which we previously selected
// to render each menu item in a similar fashion.
renderer.render(locator, item);
}
public void rendererVisit(MenuItemGroup group)
throws RendererException {
// For groups of menu items, we ignore the group itself