/** Returns the content of zscript. * If URL is specified, this method loads the content from it. * If URL is an EL expression, it will be evaluated first. * * <p>Note: before evaluating the returned script, you have to invoke * {@link #isEffective(Component)} or {@link #isEffective(Page)} first. * * @param page the page when this zscript is interpreted. * Used only if this object is constructed with {@link #ZScriptInfo(NodeInfo, String, String, Locator, ConditionImpl)}. * @param comp the component when this zscript is interpreted. * Used only if this object is constructed with {@link #ZScriptInfo(NodeInfo, String, String, Locator, ConditionImpl)}. * @exception org.zkoss.zk.ui.UiException if failed to load the content */ public String getContent(Page page, Component comp) { _zs.setEvaluatorRef(_evalr); //in case that this info has been moved return _zs.getContent(page, comp); }
/** Evaluates the deferred zscript. * It is called when the interpreter is loaded */ private void evalDeferredZScripts(Interpreter ip, String zslang) { if (_zsDeferred != null) { for (Iterator<Object[]> it = _zsDeferred.iterator(); it.hasNext();) { final Object[] zsInfo = it.next(); final ZScript zscript = (ZScript) zsInfo[1]; String targetlang = zscript.getLanguage(); if (targetlang == null) targetlang = _zslang; //use default if (targetlang.equalsIgnoreCase(zslang)) { //case insensitive it.remove(); //done final Component parent = (Component) zsInfo[0]; if (parent == null || parent.getPage() == this) { final Scope scope = Scopes.beforeInterpret(parent != null ? (Scope) parent : this); try { ip.interpret(zscript.getContent(this, parent), scope); } finally { Scopes.afterInterpret(); } } } } if (_zsDeferred.isEmpty()) _zsDeferred = null; } }
public void interpret(Page page, Component comp, ZScript zs) { final Scope scope = Scopes.beforeInterpret(comp != null ? (Scope)comp: page); try { page.interpret(zs.getLanguage(), zs.getContent(page, comp), scope); } finally { Scopes.afterInterpret(); } } public void setPageOnly(Execution exec) {
public void doInit(Page page, Map<String, Object> args) throws Exception { final Scope scope = Scopes.beforeInterpret(page); try { page.interpret(_zscript.getLanguage(), _zscript.getContent(page, null), scope); } finally { Scopes.afterInterpret(); } } }
/** @deprecated */ public void interpret(Page page, Component comp, ZScript zs) { final Map backup = new HashMap(); final org.zkoss.zk.scripting.Namespace ns = comp != null ? org.zkoss.zk.scripting.Namespaces.beforeInterpret(backup, comp, false): org.zkoss.zk.scripting.Namespaces.beforeInterpret(backup, page, false); try { page.interpret(zs.getLanguage(), zs.getContent(page, comp), ns); } finally { org.zkoss.zk.scripting.Namespaces.afterInterpret(backup, ns, false); } } /** @deprecated */
if (zscript != null) { execinf.update(null, null, zscript); page.interpret(zscript.getLanguage(), zscript.getContent(page, this), scope); if (!event.isPropagatable()) return; //done