Search in sources :

Example 6 with Renderer

use of com.github.bordertech.wcomponents.Renderer 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)

Example 7 with Renderer

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

the class UIManager method getTemplateRenderer.

/**
 * Retrieves a renderer which can renderer templates for the given context.
 *
 * @param context the render context.
 * @return an appropriate renderer for the component and context, or null if a suitable renderer could not be found.
 * @deprecated Use {@link WTemplate} instead.
 */
@Deprecated
public static Renderer getTemplateRenderer(final RenderContext context) {
    String packageName = context.getRenderPackage();
    Renderer renderer = INSTANCE.templateRenderers.get(packageName);
    if (renderer == null) {
        renderer = INSTANCE.findTemplateRenderer(packageName);
    } else if (renderer == NULL_RENDERER) {
        return null;
    }
    return renderer;
}
Also used : Renderer(com.github.bordertech.wcomponents.Renderer) VelocityRenderer(com.github.bordertech.wcomponents.render.webxml.VelocityRenderer)

Example 8 with Renderer

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

the class WPanelRenderer method renderChildren.

/**
 * Paints the children contained within the panel. This defers rendering to a layout renderer (if available).
 *
 * @param panel the panel to paint.
 * @param renderContext the RenderContext to paint to.
 */
private void renderChildren(final WPanel panel, final WebXmlRenderContext renderContext) {
    LayoutManager layout = panel.getLayout();
    Renderer layoutRenderer = null;
    if (layout != null) {
        layoutRenderer = new RendererFactoryImpl().getRenderer(layout.getClass());
    }
    if (layoutRenderer == null) {
        renderContext.getWriter().appendTag("ui:content");
        paintChildren(panel, renderContext);
        renderContext.getWriter().appendEndTag("ui:content");
    } else {
        layoutRenderer.render(panel, renderContext);
    }
}
Also used : LayoutManager(com.github.bordertech.wcomponents.layout.LayoutManager) Renderer(com.github.bordertech.wcomponents.Renderer)

Aggregations

Renderer (com.github.bordertech.wcomponents.Renderer)8 VelocityRenderer (com.github.bordertech.wcomponents.render.webxml.VelocityRenderer)6 SystemException (com.github.bordertech.wcomponents.util.SystemException)2 RendererFactory (com.github.bordertech.wcomponents.RendererFactory)1 LayoutManager (com.github.bordertech.wcomponents.layout.LayoutManager)1 Duplet (com.github.bordertech.wcomponents.util.Duplet)1