if (directives == null || contains(directives, "import")) _clsresolver.addAll(pgdef._clsresolver); if (pgdef._initdefs != null && (directives == null || contains(directives, "init"))) for (InitiatorInfo ii : pgdef._initdefs) addInitiatorInfo(ii); if (directives == null || contains(directives, "component")) { for (Iterator it = pgdef._compdefs.getNames().iterator(); it.hasNext();) addComponentDefinition(pgdef._compdefs.get((String) it.next())); if (pgdef._taglibs != null && directives != null && contains(directives, "taglib")) for (Taglib tl : pgdef._taglibs) addTaglib(tl); if (pgdef._resolvdefs != null && directives != null && contains(directives, "variable-resolver")) { for (VariableResolverInfo vri : pgdef._resolvdefs) addVariableResolverInfo(vri); if (pgdef._mapperdefs != null && directives != null && contains(directives, "function-mapper")) { for (FunctionMapperInfo fmi : pgdef._mapperdefs) addFunctionMapperInfo(fmi); if (pgdef._xelfuncs != null && directives != null && contains(directives, "xel-method")) for (FunctionDefinition xfi : pgdef._xelfuncs) addXelMethod(xfi.prefix, xfi.name, xfi.function); if (pgdef._hdBfrDefs != null && directives != null && contains(directives, "meta")) { for (HeaderInfo hi : pgdef._hdBfrDefs)
if (clsnm != null && clsnm.length() > 0) { noELnorEmpty("class", clsnm, pi); pgdef.setExpressionFactoryClass(pgdef.getImportedClassResolver().resolveClass(clsnm)); } else { //name has the lower priority final String nm = params.remove("name"); if (nm != null) pgdef.setExpressionFactoryClass(Evaluators.getEvaluatorClass(nm)); nm = j >= 0 ? cn.substring(j + 1) : cn; pgdef.addExpressionImport(nm, Classes.forNameByThread(cn));
pgdef.addVariableResolverInfo(new VariableResolverInfo(clsnm, args)); else pgdef.addFunctionMapperInfo(new FunctionMapperInfo(clsnm, args)); } else if ("component".equals(target)) { //declare a component parseComponentDirective(pgdef, pi, params); pgdef.addTaglib(new Taglib(prefix, toAbsoluteURI(uri))); } else if ("evaluator".equals(target)) { parseEvaluatorDirective(pgdef, pi, params); } else if ("link".equals(target) || "meta".equals(target) || "script".equals(target) || "style".equals(target)) { //declare a header element pgdef.addHeaderInfo(new HeaderInfo(target, params, ConditionImpl.getInstance(params.remove("if"), params.remove("unless")))); } else if ("header".equals(target)) { //declare a response header pgdef.addResponseHeaderInfo(new ResponseHeaderInfo(params.remove("name"), params.remove("value"), params.remove("append"), ConditionImpl.getInstance(params.remove("if"), params.remove("unless")))); } else if ("root-attributes".equals(target)) { for (Map.Entry<String, String> stringStringEntry : pi.parseData().entrySet()) { final Map.Entry me = (Map.Entry) stringStringEntry; pgdef.setRootAttribute((String) me.getKey(), (String) me.getValue()); log.warn(message("Ignored unknown attributes: " + params.keySet(), pi)); noEmpty("uri", uri, pi); pgdef.addForwardInfo(new ForwardInfo(uri, ConditionImpl.getInstance(ifc, unless))); } else if ("import".equals(target)) { //import throw new UiException(message("The import directive can be used only at the top level", pi)); final String src = params.remove("src");
final String lang = params.remove("language"); final LanguageDefinition langdef = lang != null ? LanguageDefinition.lookup(lang) : pgdef.getLanguageDefinition(); ComponentDefinition compdef; String templateURI = params.remove("templateURI"); } else { try { final Class cls = pgdef.getImportedClassResolver().resolveClass(clsnm); if (lang != null) { ref = langdef.getComponentDefinition(cls); ref = pgdef.getComponentDefinition(cls, true); if (ref == null) //return null if not found ref = Components.getDefinitionByDeviceType(langdef.getDeviceType(), cls); compdef.setDefaultWidgetClass(wgtnm); pgdef.addComponentDefinition(compdef);
/** 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)); } }
final PageDefinition pgdef = new PageDefinition(langdef, getLocator()); if (pd == null) throw new UiException("The imported page not found: " + path); pgdef.imports(pd, parseToArray(dirs)); } catch (PotentialDeadLockException ex) { throw new UiException("Recursive import not allowed: " + path, ex); pgdef.addImportedClass(impcls);
/** Adds a header definition ({@link HeaderInfo}). * It places the meta headers before ZK's CSS/JS headers, * and others after ZK's CSS/JS headers. */ public void addHeaderInfo(HeaderInfo header) { addHeaderInfo(header, "meta".equals(header.getName())); }