@ Override public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WStyledText text = ( WStyledText ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; String textString = text . getText ( ) ; if ( textString != null && textString . length ( ) > 0 ) { xml . appendTagOpen ( "ui:text" ) ; xml . appendOptionalAttribute ( "class" , component . getHtmlClass ( ) ) ; switch ( text . getType ( ) ) { case EMPHASISED : xml . appendAttribute ( "type" , "emphasised" ) ; break ; case HIGH_PRIORITY : xml . appendAttribute ( "type" , "highPriority" ) ; break ; case LOW_PRIORITY : xml . appendAttribute ( "type" , "lowPriority" ) ; break ; case MEDIUM_PRIORITY : xml . appendAttribute ( "type" , "mediumPriority" ) ; break ; case ACTIVE_INDICATOR : xml . appendAttribute ( "type" , "activeIndicator" ) ; break ; case MATCH_INDICATOR : xml . appendAttribute ( "type" , "matchIndicator" ) ; break ; case INSERT : xml . appendAttribute ( "type" , "insert" ) ; break ; case DELETE : xml . appendAttribute ( "type" , "delete" ) ; break ; case MANDATORY_INDICATOR : xml . appendAttribute ( "type" , "mandatoryIndicator" ) ; break ; case PLAIN : default : xml . appendAttribute ( "type" , "plain" ) ; break ; } switch ( text . getWhitespaceMode ( ) ) { case PARAGRAPHS : xml . appendAttribute ( "space" , "paragraphs" ) ; break ; case PRESERVE : xml . appendAttribute ( "space" , "preserve" ) ; break ; case DEFAULT : break ; default : throw new IllegalArgumentException ( "Unknown white space mode: " + text . getWhitespaceMode ( ) ) ; } xml . appendClose ( ) ; if ( WStyledText . WhitespaceMode . PARAGRAPHS . equals ( text . getWhitespaceMode ( ) ) ) { textString = text . isEncodeText ( ) ? WebUtilities . encode ( textString ) : HtmlToXMLUtil . unescapeToXML ( textString ) ; writeParagraphs ( textString , xml ) ; } else { xml . append ( textString , text . isEncodeText ( ) ) ; } xml . appendEndTag ( "ui:text" ) ; } }
Paints the given WStyledText .