@Override
	public void paint(final RenderContext renderContext) {

		UIContext uic = UIContextHolder.getCurrent();

		// Generate the HTML
		StringWriter outputBuffer = new StringWriter();
		PrintWriter outputWriter = new PrintWriter(outputBuffer);
		WebXmlRenderContext outputContext = new WebXmlRenderContext(outputWriter, uic.getLocale());
		super.paint(outputContext);

		String html = outputBuffer.toString();

		// Only process TEMPLATE if has I18N brackets
		if (html.contains("{{#i18n")) {
			// Create a new instance of factory to avoid caching the page.
			// https://github.com/spullara/mustache.java/issues/117
			final MustacheFactory mf = new DefaultMustacheFactory();
			Mustache mustache = mf.compile(new StringReader(html), UUID.randomUUID().toString());
			StringWriter templateWriter = new StringWriter();
			mustache.execute(templateWriter, new I18NContext(getResourceBundle()));
			html = templateWriter.toString();
		}

		// Get the OUTPUT writer
		WebXmlRenderContext webRenderContext = (WebXmlRenderContext) renderContext;
		PrintWriter writer = webRenderContext.getWriter();
		writer.print(html);
	}
@ Override public void paint ( final RenderContext renderContext ) { UIContext uic = UIContextHolder . getCurrent ( ) ; StringWriter outputBuffer = new StringWriter ( ) ; PrintWriter outputWriter = new PrintWriter ( outputBuffer ) ; WebXmlRenderContext outputContext = new WebXmlRenderContext ( outputWriter , uic . getLocale ( ) ) ; super . paint ( outputContext ) ; String html = outputBuffer . toString ( ) ; if ( html . contains ( "{{#i18n" ) ) { final MustacheFactory mf = new DefaultMustacheFactory ( ) ; Mustache mustache = mf . compile ( new StringReader ( html ) , UUID . randomUUID ( ) . toString ( ) ) ; StringWriter templateWriter = new StringWriter ( ) ; mustache . execute ( templateWriter , new I18NContext ( getResourceBundle ( ) ) ) ; html = templateWriter . toString ( ) ; } WebXmlRenderContext webRenderContext = ( WebXmlRenderContext ) renderContext ; PrintWriter writer = webRenderContext . getWriter ( ) ; writer . print ( html ) ; }
{@inheritDoc}