@ Override public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WTree tree = ( WTree ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; // Check if rendering an open item request String openId = tree . getOpenRequestItemId ( ) ; if ( openId != null ) { handleOpenItemRequest ( tree , xml , openId ) ; return ; } // Check the tree has tree items (WCAG requirement) TreeItemModel model = tree . getTreeModel ( ) ; if ( model == null || model . getRowCount ( ) <= 0 ) { LOG . warn ( "Tree not rendered as it has no items." ) ; return ; } xml . appendTagOpen ( "ui:tree" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . appendOptionalAttribute ( "class" , component . getHtmlClass ( ) ) ; xml . appendOptionalAttribute ( "track" , component . isTracking ( ) , "true" ) ; xml . appendOptionalAttribute ( "htree" , WTree . Type . HORIZONTAL == tree . getType ( ) , "true" ) ; xml . appendOptionalAttribute ( "multiple" , WTree . SelectMode . MULTIPLE == tree . getSelectMode ( ) , "true" ) ; xml . appendOptionalAttribute ( "disabled" , tree . isDisabled ( ) , "true" ) ; xml . appendOptionalAttribute ( "hidden" , tree . isHidden ( ) , "true" ) ; xml . appendOptionalAttribute ( "required" , tree . isMandatory ( ) , "true" ) ; switch ( tree . getExpandMode ( ) ) { case CLIENT : xml . appendAttribute ( "mode" , "client" ) ; break ; case DYNAMIC : xml . appendAttribute ( "mode" , "dynamic" ) ; break ; case LAZY : xml . appendAttribute ( "mode" , "lazy" ) ; break ; default : throw new IllegalStateException ( "Invalid expand mode: " + tree . getType ( ) ) ; } xml . appendClose ( ) ; // Render margin MarginRendererUtil . renderMargin ( tree , renderContext ) ; if ( tree . getCustomTree ( ) == null ) { handlePaintItems ( tree , xml ) ; } else { handlePaintCustom ( tree , xml ) ; } DiagnosticRenderUtil . renderDiagnostics ( tree , renderContext ) ; xml . appendEndTag ( "ui:tree" ) ; }
Paints the given WTree .