rendererContext, rendererFactory,
new DefaultMenuModule(rendererContext, rendererFactory));
MenuRendererSelector selector = module.getMenuRendererSelector();
// Create the menu.
MenuModelBuilder builder = new ConcreteMenuModelBuilder();
builder.startMenu();
// Set up style properties to use OpenWave menu renderer.
builder.setElementDetails("menu", null,
StylesBuilder.getCompleteStyles(
"mcs-menu-link-style: numeric-shortcut"));
// Target it at a specific pane.
DOMOutputBuffer buffer;
builder.setPane(MENU_PANE);
// Create the first menu item explicitly targeted at a different pane.
builder.startMenuItem();
// Set the style.
builder.setElementDetails("menuitem", null,
StylesBuilder.getInitialValueStyles());
// Set the href.
builder.setHref(new LiteralLinkAssetReference("href1.xml"));
// Set the pane.
builder.setPane(ITEM1_PANE);
// Create a plain text label.
builder.startLabel();
builder.startText();
// Set the text.
buffer = new TestDOMOutputBuffer();
buffer.writeText("item 1");
builder.setText(buffer);
builder.endText();
builder.endLabel();
builder.endMenuItem();
// Create the second menu item explicitly targeted at a different pane.
builder.startMenuItem();
// Set the style.
builder.setElementDetails("menuitem", null,
StylesBuilder.getInitialValueStyles());
// Set the href.
builder.setHref(new LiteralLinkAssetReference("href2.xml"));
// Set the pane.
builder.setPane(ITEM2_PANE);
// Create a plain text label.
builder.startLabel();
builder.startText();
// Set the text.
buffer = new TestDOMOutputBuffer();
buffer.writeText("item 2");
builder.setText(buffer);
builder.endText();
builder.endLabel();
builder.endMenuItem();
builder.endMenu();
Menu menu = builder.getCompletedMenuModel();
// Select the renderer to use for this menu.
MenuRenderer renderer = selector.selectMenuRenderer(menu);
// Make sure that it is of the appropriate type.