Search in sources :

Example 1 with RendererFactory

use of com.github.bordertech.wcomponents.RendererFactory in project wcomponents by BorderTech.

the class UIManager method findRendererFactory.

/**
 * Finds the renderer factory for the given package.
 *
 * @param packageName the package name to find the renderer factory for.
 * @return the RendererFactory for the given package, or null if not found.
 */
private synchronized RendererFactory findRendererFactory(final String packageName) {
    RendererFactory factory = factoriesByPackage.get(packageName);
    if (factory == null) {
        try {
            factory = (RendererFactory) Class.forName(packageName + ".RendererFactoryImpl").newInstance();
            factoriesByPackage.put(packageName, factory);
        } catch (Exception e) {
            throw new SystemException("Failed to create layout manager factory for " + packageName, e);
        }
    }
    return factory;
}
Also used : SystemException(com.github.bordertech.wcomponents.util.SystemException) RendererFactory(com.github.bordertech.wcomponents.RendererFactory) SystemException(com.github.bordertech.wcomponents.util.SystemException)

Example 2 with RendererFactory

use of com.github.bordertech.wcomponents.RendererFactory in project wcomponents by BorderTech.

the class UIManager method findTemplateRenderer.

/**
 * Retrieves the template renderer for the given package.
 *
 * @param packageName the package to retrieve the template renderer for.
 * @return the template renderer for the given package, or null if the package does not contain a template renderer.
 * @deprecated Use {@link WTemplate} instead.
 */
@Deprecated
private synchronized Renderer findTemplateRenderer(final String packageName) {
    RendererFactory factory = INSTANCE.findRendererFactory(packageName);
    Renderer renderer = factory.getTemplateRenderer();
    if (renderer == null) {
        templateRenderers.put(packageName, NULL_RENDERER);
    } else {
        templateRenderers.put(packageName, renderer);
    }
    return renderer;
}
Also used : RendererFactory(com.github.bordertech.wcomponents.RendererFactory) Renderer(com.github.bordertech.wcomponents.Renderer) VelocityRenderer(com.github.bordertech.wcomponents.render.webxml.VelocityRenderer)

Aggregations

RendererFactory (com.github.bordertech.wcomponents.RendererFactory)2 Renderer (com.github.bordertech.wcomponents.Renderer)1 VelocityRenderer (com.github.bordertech.wcomponents.render.webxml.VelocityRenderer)1 SystemException (com.github.bordertech.wcomponents.util.SystemException)1