// javadoc inherited protected void writeMenuItem(DOMOutputBuffer outputBuffer, MenuItem menuItem) throws ProtocolException { InternalDevice device = pageContext.getDevice(); boolean isAccesskeyPrefixKeyNeeded = !device.getBooleanPolicyValue( DevicePolicyConstants.SUPPORTS_WML_ACCESSKEY_AUTOMAGIC_NUMBER_DISPLAY); // Extract the href from the menu item. LinkAssetReference reference = menuItem.getHref(); String href = reference.getURL(); // Extract the text from the menu item. String text = menuItem.getText(); // Add the dummy access key prefix to the text if necessary. if (isAccesskeyPrefixKeyNeeded) { text = AccesskeyConstants.DUMMY_ACCESSKEY_VALUE_STRING + " " + text; } // Report what we are about to do for debugging. if (logger.isDebugEnabled()) { logger.debug("writing numeric shortcut menu item with href=" + href + ", text=" + text); } // Open the annotation element. // @todo 2005060816 annotate child with style information if it's not inherited from the parent Element annotator = outputBuffer.openStyledElement(AccesskeyConstants.ACCESSKEY_ANNOTATION_ELEMENT, menuItem); // Open the anchor element. Element anchor = outputBuffer.openElement("a"); // Copy attributes into the anchor element. menuRendererContext.writeTitleAttribute(anchor, menuItem); anchor.setAttribute("href", href); // Add the dummy accesskey attribute as well. anchor.setAttribute("accesskey", AccesskeyConstants.DUMMY_ACCESSKEY_VALUE_STRING); // Write out the menu text as the content of the link. outputBuffer.appendEncoded(text); // Close the anchor element. outputBuffer.closeElement(anchor); // Close the annotation element. outputBuffer.closeElement(annotator); // Add BR to force hardcoded vertical alignment. // This is compatible with actual Openwave numeric shortcut rendering // which is always vertical. // NOTE: This means that the mariner-menu-orientation style is ignored. outputBuffer.addStyledElement("br", menuItem); }