@ Override public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WCheckBoxSelect select = ( WCheckBoxSelect ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; int cols = select . getButtonColumns ( ) ; boolean readOnly = select . isReadOnly ( ) ; xml . appendTagOpen ( "ui:checkboxselect" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . appendOptionalAttribute ( "class" , component . getHtmlClass ( ) ) ; xml . appendOptionalAttribute ( "track" , component . isTracking ( ) , "true" ) ; xml . appendOptionalAttribute ( "hidden" , select . isHidden ( ) , "true" ) ; if ( readOnly ) { xml . appendAttribute ( "readOnly" , "true" ) ; } else { int min = select . getMinSelect ( ) ; int max = select . getMaxSelect ( ) ; xml . appendOptionalAttribute ( "disabled" , select . isDisabled ( ) , "true" ) ; xml . appendOptionalAttribute ( "required" , select . isMandatory ( ) , "true" ) ; xml . appendOptionalAttribute ( "submitOnChange" , select . isSubmitOnChange ( ) , "true" ) ; xml . appendOptionalAttribute ( "toolTip" , component . getToolTip ( ) ) ; xml . appendOptionalAttribute ( "accessibleText" , component . getAccessibleText ( ) ) ; xml . appendOptionalAttribute ( "min" , min > 0 , min ) ; xml . appendOptionalAttribute ( "max" , max > 0 , max ) ; } xml . appendOptionalAttribute ( "frameless" , select . isFrameless ( ) , "true" ) ; switch ( select . getButtonLayout ( ) ) { case COLUMNS : xml . appendAttribute ( "layout" , "column" ) ; xml . appendOptionalAttribute ( "layoutColumnCount" , cols > 0 , cols ) ; break ; case FLAT : xml . appendAttribute ( "layout" , "flat" ) ; break ; case STACKED : xml . appendAttribute ( "layout" , "stacked" ) ; break ; default : throw new SystemException ( "Unknown layout type: " + select . getButtonLayout ( ) ) ; } xml . appendClose ( ) ; // Options List < ? > options = select . getOptions ( ) ; boolean renderSelectionsOnly = readOnly ; if ( options != null ) { int optionIndex = 0 ; List < ? > selections = select . getSelected ( ) ; for ( Object option : options ) { if ( option instanceof OptionGroup ) { throw new SystemException ( "Option groups not supported in WCheckBoxSelect." ) ; } else { renderOption ( select , option , optionIndex ++ , xml , selections , renderSelectionsOnly ) ; } } } if ( ! readOnly ) { DiagnosticRenderUtil . renderDiagnostics ( select , renderContext ) ; } xml . appendEndTag ( "ui:checkboxselect" ) ; }
Paints the given WCheckBoxSelect .