@ Override public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WMultiDropdown dropdown = ( WMultiDropdown ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; String dataKey = dropdown . getListCacheKey ( ) ; boolean readOnly = dropdown . isReadOnly ( ) ; xml . appendTagOpen ( "ui:multidropdown" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . appendOptionalAttribute ( "class" , component . getHtmlClass ( ) ) ; xml . appendOptionalAttribute ( "track" , component . isTracking ( ) , "true" ) ; xml . appendOptionalAttribute ( "hidden" , dropdown . isHidden ( ) , "true" ) ; if ( readOnly ) { xml . appendAttribute ( "readOnly" , "true" ) ; } else { xml . appendOptionalAttribute ( "data" , dataKey != null && ! readOnly , dataKey ) ; xml . appendOptionalAttribute ( "disabled" , dropdown . isDisabled ( ) , "true" ) ; xml . appendOptionalAttribute ( "required" , dropdown . isMandatory ( ) , "true" ) ; xml . appendOptionalAttribute ( "submitOnChange" , dropdown . isSubmitOnChange ( ) , "true" ) ; xml . appendOptionalAttribute ( "toolTip" , component . getToolTip ( ) ) ; xml . appendOptionalAttribute ( "accessibleText" , component . getAccessibleText ( ) ) ; int min = dropdown . getMinSelect ( ) ; int max = dropdown . getMaxSelect ( ) ; xml . appendOptionalAttribute ( "min" , min > 0 , min ) ; xml . appendOptionalAttribute ( "max" , max > 0 , max ) ; xml . appendOptionalAttribute ( "title" , I18nUtilities . format ( null , InternalMessages . DEFAULT_MULTIDROPDOWN_TIP ) ) ; } xml . appendClose ( ) ; // Options List < ? > options = dropdown . getOptions ( ) ; boolean renderSelectionsOnly = dropdown . isReadOnly ( ) || dataKey != null ; if ( options != null ) { int optionIndex = 0 ; List < ? > selections = dropdown . getSelected ( ) ; for ( Object option : options ) { if ( option instanceof OptionGroup ) { xml . appendTagOpen ( "ui:optgroup" ) ; xml . appendAttribute ( "label" , ( ( OptionGroup ) option ) . getDesc ( ) ) ; xml . appendClose ( ) ; for ( Object nestedOption : ( ( OptionGroup ) option ) . getOptions ( ) ) { renderOption ( dropdown , nestedOption , optionIndex ++ , xml , selections , renderSelectionsOnly ) ; } xml . appendEndTag ( "ui:optgroup" ) ; } else { renderOption ( dropdown , option , optionIndex ++ , xml , selections , renderSelectionsOnly ) ; } } } if ( ! readOnly ) { DiagnosticRenderUtil . renderDiagnostics ( dropdown , renderContext ) ; } // End tag xml . appendEndTag ( "ui:multidropdown" ) ; }
Paints the given WMultiDropdown .