/** * Imports the specified directives from the specified page definition. * * @param pgdef the page definition to import from. * @param directives an array of the directive names to import. If null, {"init", "component"} is * assumed, i.e., only the init directives and component definitions are imported.<br> * Importable directives include "component", "init", "meta", "taglib", "variable-resolver", * and "xel-method". If "*", all of them are imported. Note: "meta" implies "link". * @since 3.0.2 */ public void imports(PageDefinition pgdef, String[] directives) { 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) addHeaderInfo(hi, true); } if (pgdef._hdAftDefs != null && directives != null && contains(directives, "meta")) { for (HeaderInfo hi : pgdef._hdAftDefs) addHeaderInfo(hi, false); } if (pgdef._hdResDefs != null && directives != null && contains(directives, "header")) { for (ResponseHeaderInfo rhi : pgdef._hdResDefs) addResponseHeaderInfo(rhi); } }
/** * 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())); }