@ Override public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WSubMenu menu = ( WSubMenu ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; xml . appendTagOpen ( "ui:submenu" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . appendOptionalAttribute ( "class" , component . getHtmlClass ( ) ) ; xml . appendOptionalAttribute ( "track" , component . isTracking ( ) , "true" ) ; if ( isTree ( menu ) ) { xml . appendAttribute ( "open" , String . valueOf ( isOpen ( menu ) ) ) ; } xml . appendOptionalAttribute ( "disabled" , menu . isDisabled ( ) , "true" ) ; xml . appendOptionalAttribute ( "hidden" , menu . isHidden ( ) , "true" ) ; if ( menu . isTopLevelMenu ( ) ) { xml . appendOptionalAttribute ( "accessKey" , menu . getAccessKeyAsString ( ) ) ; } else { xml . appendAttribute ( "nested" , "true" ) ; } xml . appendOptionalAttribute ( "type" , getMenuType ( menu ) ) ; switch ( menu . getMode ( ) ) { case CLIENT : xml . appendAttribute ( "mode" , "client" ) ; break ; case LAZY : xml . appendAttribute ( "mode" , "lazy" ) ; break ; case EAGER : xml . appendAttribute ( "mode" , "eager" ) ; break ; case DYNAMIC : case SERVER : // mode server mapped to mode dynamic as per https://github.com/BorderTech/wcomponents/issues/687 xml . appendAttribute ( "mode" , "dynamic" ) ; break ; default : throw new SystemException ( "Unknown menu mode: " + menu . getMode ( ) ) ; } xml . appendClose ( ) ; // Paint label menu . getDecoratedLabel ( ) . paint ( renderContext ) ; MenuMode mode = menu . getMode ( ) ; // Paint submenu items xml . appendTagOpen ( "ui:content" ) ; xml . appendAttribute ( "id" , component . getId ( ) + "-content" ) ; xml . appendClose ( ) ; // Render content if not EAGER Mode or is EAGER and is the current AJAX request if ( mode != MenuMode . EAGER || AjaxHelper . isCurrentAjaxTrigger ( menu ) ) { // Visibility of content set in prepare paint menu . paintMenuItems ( renderContext ) ; } xml . appendEndTag ( "ui:content" ) ; xml . appendEndTag ( "ui:submenu" ) ; }
Paints the given WSubMenu .