/** Redraw the specified component into a string. */ private static String redraw(Component comp) throws IOException { final StringWriter out = new StringWriter(1024 * 8); ((ComponentCtrl) comp).redraw(out); return out.toString(); }
protected void redrawChildren(Writer out) throws IOException { if (getAttribute(Attributes.SHALL_RENDER_ITEM) == null) { for (Iterator it = new VisibleChildrenIterator(); it.hasNext();) ((ComponentCtrl) it.next()).redraw(out); } }
/** An utilities to create an array of JavaScript objects * ({@link JavaScriptValue}) that can be used * to mount the specified widget at the clients. * * @since 5.0.0 */ public static final Collection<JavaScriptValue> redraw(Collection<? extends Component> comps) { try { final StringWriter out = new StringWriter(1024 * 8); final List<JavaScriptValue> js = new LinkedList<JavaScriptValue>(); for (Component comp : comps) { ((ComponentCtrl) comp).redraw(out); final StringBuffer sb = out.getBuffer(); js.add(new JavaScriptValue(sb.toString())); sb.setLength(0); } return js; } catch (java.io.IOException ex) { throw new InternalError(); } }
/** * Renders the page if {@link Page#isComplete} is true. In other words, the page content * contains HTML/BODY tags. */ protected void renderComplete(Execution exec, Page page, Writer out) throws IOException { final Object ret = beforeRenderHtml(exec, page, out); for (Iterator it = page.getRoots().iterator(); it.hasNext();) ((ComponentCtrl) it.next()).redraw(out); afterRenderHtml(exec, page, out, ret); }
/** Redraws children (and then recursively descendants). * <p>Default: it invokes {@link #redraw} for all its children. * <p>If a derived class renders only a subset of its children * (such as paging/cropping), it could override {@link #redrawChildren}. * @since 5.0.0 * @see #redraw */ protected void redrawChildren(Writer out) throws IOException { final Object xc = getExtraCtrl(); if (xc instanceof Cropper) { final Set<? extends Component> crop = ((Cropper) xc).getAvailableAtClient(); if (crop != null) { for (Component c : crop) if (c.getParent() == this) ((ComponentCtrl) c).redraw(out); //Note: getAvialableAtClient might return all level //of children in the same crop scope return; } } for (Component child = getFirstChild(); child != null;) { Component next = child.getNextSibling(); ((ComponentCtrl) child).redraw(out); child = next; } }
((ComponentCtrl)comp).redraw(out);
((ComponentCtrl) comp).redraw(out); else out.write("null"); //no component at all
protected void redrawChildren(Writer out) throws IOException { Tree tree = getTree(); if (!tree.inPagingMold()) { super.redrawChildren(out); } else if (isRealVisible() && shallVisitTree(tree, this)) { if (shallRenderTree(tree)) { ComponentCtrl child = getTreerow(); if (child != null) child.redraw(out); } boolean close = !isOpen(); ComponentCtrl child = getTreechildren(); if (child != null) { if (close) ((Component) child).setAttribute(Attributes.SHALL_RENDER_ITEM, Boolean.TRUE); child.redraw(out); if (close) ((Component) child).removeAttribute(Attributes.SHALL_RENDER_ITEM); } } }
Component next = child.getNextSibling(); if (child instanceof Native || ((ComponentCtrl) child).getExtraCtrl() instanceof DirectContent) { ((ComponentCtrl) child).redraw(out); } else { HtmlPageRenders.setDirectContent(exec, false);
((ComponentCtrl) root).redraw(out);
/** Renders the page if {@link Page#isComplete} is true. * In other words, the page content contains HTML/BODY tags. */ protected void renderComplete(Execution exec, Page page, Writer out) throws IOException { write(out, HtmlPageRenders.outFirstLine(exec, page)); //might null write(out, HtmlPageRenders.outDocType(exec, page)); //might null HtmlPageRenders.setContentType(exec, page); for (Component root = page.getFirstRoot(); root != null; root = root.getNextSibling()) ((ComponentCtrl) root).redraw(out); write(out, HtmlPageRenders.outHeaderZkTags(exec, page)); writeln(out, HtmlPageRenders.outUnavailable(exec)); } }
/** * Renders the children directly to the given output. Notice it is called only if * {@link #redraw} is going to render the content (HTML tags) directly. If it is about to * generate the JavaScript code {@link #redrawChildren} will be called instead. * <p> * You have to override this method if the deriving class has additional information to render. * * @since 5.0.7 */ protected void redrawChildrenDirectly(TagRenderContext rc, Execution exec, java.io.Writer out) throws java.io.IOException { for (Component child = getFirstChild(); child != null;) { Component next = child.getNextSibling(); if (((ComponentCtrl) child).getExtraCtrl() instanceof DirectContent) { ((ComponentCtrl) child).redraw(out); } else { HtmlPageRenders.setDirectContent(exec, false); rc.renderBegin(child, null, getSpecialRendererOutput(child), true); HtmlPageRenders.outStandalone(exec, child, out); rc.renderEnd(child); HtmlPageRenders.setDirectContent(exec, true); } child = next; } }