private void init(LanguageDefinition langdef, PageDefinition pgdef, String name, Object cls) { if (name == null) throw new IllegalArgumentException(); if (langdef != null && pgdef != null) throw new IllegalArgumentException("langdef and pgdef cannot both null or both non-null"); _langdef = langdef; _pgdef = pgdef; _name = name; _implcls = cls; _evalr = _langdef != null ? _langdef.getEvaluatorRef() : _pgdef != null ? _pgdef.getEvaluatorRef() : null; }
public void appendChild(NodeInfo child) { NodeInfo oldp = child.getParent(); if (oldp != null) oldp.removeChild(child); _children.add(child); ((LeafInfo) child).setParentDirectly(this); //except root, all are LeafInfo BranchInfo.fixEvaluatorRefDown(child, getEvaluatorRef()); //Use getEvaluatorRef() to force _evalr being assigned }
/** Process the init directive. */ private void parseInitDirective(PageDefinition pgdef, ProcessingInstruction pi, Map<String, String> params) throws Exception { final String clsnm = params.remove("class"); final String zsrc = params.remove("zscript"); final Map<String, String> args = new LinkedHashMap<String, String>(params); if (clsnm == null) { if (zsrc == null) throw new UiException(message("Either the class or zscript attribute must be specified", pi)); checkZScriptEnabled(pi.getLocator()); ZScript zs = null; final String zslang = pgdef.getZScriptLanguage(); if (!zsrc.contains("${")) { final URL url = getLocator().getResource(zsrc); if (url != null) zs = new ZScript(zslang, url); //Bug 2929887: defer the error message since it might not be required } if (zs == null) zs = new ZScript(pgdef.getEvaluatorRef(), zslang, zsrc, getLocator()); pgdef.addInitiatorInfo(new InitiatorInfo(new ZScriptInitiator(zs), args)); } else { if (zsrc != null) throw new UiException(message("You cannot specify both class and zscript", pi)); pgdef.addInitiatorInfo(new InitiatorInfo(clsnm, args)); } }