/** * Prepares a single row for painting. * * @param request the request being responded to. * @param rowIndex the row index. */ protected void prepareRow(final Request request, final int rowIndex) { WComponent row = getRepeatedComponent(); row.preparePaint(request); }
/** * {@inheritDoc} */ @Override protected void preparePaintComponent(final Request request) { long start = new Date().getTime(); content.preparePaint(request); long finish = new Date().getTime(); long elapse = finish - start; getOrCreateComponentModel().setAttribute("elapse_prep", elapse); }
/** * Since none of the children are visible to standard processing, preparePaintComponent has been overridden so that * the visible card is prepared. * * @param request the request being responded to. */ @Override protected void preparePaintComponent(final Request request) { super.preparePaintComponent(request); WComponent visibleDialog = getVisible(); if (visibleDialog != null) { visibleDialog.preparePaint(request); } }
/** * <p> * The preparePaintComponent method has been overridden to ensure that expanded row renderers have been correctly * initialised. * </p> * <p> * Expanded row renderers are lazily instantiated and added to the shared structure as needed. This means for the * first use of a renderer, it will not have been part of the WComponent tree, and would not have had its * preparePaintComponent called. We therefore add the renderer to the tree here, and manually call its preparePaint. * </p> * * @param request the Request being responded to. */ @Override protected void preparePaintComponent(final Request request) { super.preparePaintComponent(request); Class<? extends WComponent> rowRendererClass = getRowRendererClass(); if (rowRendererClass != null && !expandedRenderers.containsKey(rowRendererClass)) { getExpandedTreeNodeRenderer(rowRendererClass).preparePaint(request); } }
/** * <p> * The preparePaintComponent method has been overridden to ensure that expanded row renderers have been correctly * initialised.</p> * * <p> * Expanded row renderers are lazily instantiated and added to the shared structure as needed. This means for the * first use of a renderer, it will not have been part of the WComponent tree, and would not have had its * preparePaintComponent called. We therefore add the renderer to the tree here, and manually call its * preparePaint.</p> * * @param request the Request being responded to. */ @Override protected void preparePaintComponent(final Request request) { super.preparePaintComponent(request); Class<? extends WComponent> rowRendererClass = getRowRendererClass(); if (rowRendererClass != null && !expandedRenderers.containsKey(rowRendererClass)) { getExpandedTreeNodeRenderer(rowRendererClass).preparePaint(request); } }
children.get(i).preparePaint(request);
/** * Renders the given WComponent to a String outside of the context of a Servlet. This is good for getting hold of * the XML for debugging, unit testing etc. Also it is good for using the WComponent framework as a more generic * templating framework. * * @param request the request being responded to. * @param component the root WComponent to render. * @return the rendered output as a String. */ public static String render(final Request request, final WComponent component) { boolean needsContext = UIContextHolder.getCurrent() == null; if (needsContext) { UIContextHolder.pushContext(new UIContextImpl()); } try { StringWriter buffer = new StringWriter(); component.preparePaint(request); try (PrintWriter writer = new PrintWriter(buffer)) { component.paint(new WebXmlRenderContext(writer)); } return buffer.toString(); } finally { if (needsContext) { UIContextHolder.popContext(); } } }
/** * <p> * Override preparePaintComponent to provide some protection against bad code when examples are being developed, * resulting in invalid XML.</p> * * <p> * Real applications should not emit HTML directly.</p> * * @param request the request being responded to. */ @Override protected void preparePaintComponent(final Request request) { if (getAttribute(ERROR_KEY) == null) { try { for (int i = 0; i < shim.getChildCount(); i++) { shim.getChildAt(i).preparePaint(request); } } catch (final Exception e) { if (isAjaxOrTargetedRequest(request)) { throw new SystemException(e.getMessage(), e); } else { setAttribute(ERROR_KEY, e); } } } }