/** Shows notification at given coordinate */ public AuNotification(String msg, String type, Page page, Component ref, int x, int y, int duration, boolean closable) { super("showNotification", new Object[] { msg, type, page.getUuid(), ref, null, new int[] { x, y }, duration, closable }); }
/** Shows notification at predefined position. */ public AuNotification(String msg, String type, Page page, Component ref, String position, int duration, boolean closable) { super("showNotification", new Object[] { msg, type, page.getUuid(), ref, position, null, duration, closable }); }
public String getUuid() { return page.getUuid(); }
public AuRemove(Page page) { this(page.getUuid()); }
/** * @param contents a collection of contents (in String objects). * Each content is the output of a component or a page. * @since 5.0.7 */ public AuAppendChild(Page page, Collection<String> contents) { super("addChd", page, toArray(page.getUuid(), contents)); }
public AuOuter(Page page, String content) { super("outer", page, new Object[] { page.getUuid(), new JavaScriptValue(content) }); } }
public void patchRender(RequestInfo reqInfo, Page page, Writer result, Writer out) throws IOException { final String extid = page.getUuid() + "-ext"; String[] html = processHtml(((StringWriter) result).toString()); //we have to process CSS and append it to HEAD out.write(html[0]); out.write("<div id=\""); out.write(extid); out.write("\"></div><script>setTimeout(function(){\njQuery('#"); out.write(extid); out.write("').append('"); //we have to use append() since it is evaluated synchronously //while replaceWith() is not out.write(Strings.escape(html[1], Strings.ESCAPE_JAVASCRIPT)); out.write("');},"); out.write("" + getBrowserDelay()); out.write(");</script>"); }
private String getUuid(AuRequest request) { final Component comp = request.getComponent(); if (comp != null) return comp.getUuid(); final Page page = request.getPage(); if (page != null) return page.getUuid(); return null; } }
public Page getPageIfAny(String pageId) { //Spec: we allow user to access this method concurrently, so //synchronized is required Page page = null; synchronized (_pages) { for (Page pg : _pages) { if (Objects.equals(pageId, pg.getId())) return pg; if (Objects.equals(pageId, pg.getUuid())) page = pg; } } return page; }
public void render(Page page, Writer out) throws IOException { out.write(HtmlPageRenders.outLangStyleSheets(_exec, null, null)); out.write(HtmlPageRenders.outLangJavaScripts(_exec, null, null)); if (_pageDOM) { HtmlPageRenders.outPageContent(_exec, page, out, false); return; } final Desktop desktop = _exec.getDesktop(); out.write("<script class=\"z-runonce\" type=\"text/javascript\">zkpb('"); out.write(page.getUuid()); out.write("','"); out.write(desktop.getId()); out.write("','"); out.write(getContextURI()); out.write("','"); out.write(desktop.getUpdateURI(null)); out.write("','"); out.write(desktop.getRequestPath()); out.write('\''); String style = page.getStyle(); if (style != null && style.length() > 0) { out.write(",{style:'"); out.write(style); out.write("'}"); } out.write(");zkpe();</script>\n"); for (Component root = page.getFirstRoot(); root != null; root = root.getNextSibling()) { HtmlPageRenders.outStandalone(_exec, root, out); } }
out.write(page.getUuid()); out.write("','"); out.write(desktop.getId());
/** Returns the content of the specified condition * that will be placed inside the header element of the specified page, * or null if it was generated before. * For HTML, the header element is the HEAD element. * * <p>Notice that this method ignores the following invocations * against the same page in the same execution. In other words, * it is safe to invoke this method multiple times. * * @param before whether to return the headers that shall be shown * before ZK's CSS/JS headers. * If true, only the headers that shall be shown before (such as meta) * are returned. * If true, only the headers that shall be shown after (such as link) * are returned. */ public static final String outHeaders(Execution exec, Page page, boolean before) { if (page == null) return ""; String attr = "zkHeaderGened" + page.getUuid(); if (before) attr += "Bf"; if (exec.getAttribute(attr) != null) return null; exec.setAttribute(attr, Boolean.TRUE); //generated only once return before ? ((PageCtrl) page).getBeforeHeadTags() : ((PageCtrl) page).getAfterHeadTags(); }