Search in sources :

Example 1 with ToHTMLRenderer

use of it.vige.rubia.format.render.bbcodehtml.ToHTMLRenderer in project rubia-forums by flashboss.

the class ForumUtil method getToHTMLRenderer.

/**
 * @param req
 *            the request that maybe contains the format object
 * @return the renderer for the requested request
 */
private static ToHTMLRenderer getToHTMLRenderer(Object req) {
    ToHTMLRenderer renderer = null;
    // TODO: GETTING RENDERER FROM APPLICATION SCOPE ATTRIBUTE
    if (renderer == null) {
        // Getting ResourceBundle with current Locale
        FacesContext ctx = getCurrentInstance();
        UIViewRoot uiRoot = ctx.getViewRoot();
        Locale locale = uiRoot.getLocale();
        ClassLoader ldr = currentThread().getContextClassLoader();
        ResourceBundle bundle = getBundle("ResourceJSF", locale, ldr);
        // Create the HTMLRenderer for BBCode
        ToHTMLConfig config = new ToHTMLConfig();
        renderer = new ToHTMLRenderer(config, bundle);
    }
    return renderer;
}
Also used : Locale(java.util.Locale) ToHTMLConfig(it.vige.rubia.format.render.bbcodehtml.ToHTMLConfig) FacesContext(javax.faces.context.FacesContext) ToHTMLRenderer(it.vige.rubia.format.render.bbcodehtml.ToHTMLRenderer) ResourceBundle(java.util.ResourceBundle) UIViewRoot(javax.faces.component.UIViewRoot)

Aggregations

ToHTMLConfig (it.vige.rubia.format.render.bbcodehtml.ToHTMLConfig)1 ToHTMLRenderer (it.vige.rubia.format.render.bbcodehtml.ToHTMLRenderer)1 Locale (java.util.Locale)1 ResourceBundle (java.util.ResourceBundle)1 UIViewRoot (javax.faces.component.UIViewRoot)1 FacesContext (javax.faces.context.FacesContext)1