org.zkoss.zk.ui.Execution.createComponents()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中org.zkoss.zk.ui.Execution.createComponents()方法的一些代码示例,展示了Execution.createComponents()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Execution.createComponents()方法的具体详情如下:
包路径:org.zkoss.zk.ui.Execution
类名称:Execution
方法名:createComponents

Execution.createComponents介绍

[英]Creates components that don't belong to any page from a page file specified by an URI.

It loads the page definition from the specified URI (by use #getPageDefinition ), and then invokes #createComponents(PageDefinition,Map)to create components.
[中]从URI指定的页面文件创建不属于任何页面的组件。
它从指定的URI加载页面定义(通过使用#getPageDefinition),然后调用#createComponents(PageDefinition,Map)来创建组件。

代码示例

代码示例来源:origin: org.zkoss.zk/zk

public Component[] createComponents(String uri, Component parent, Component insertBefore,
    VariableResolver resolver, Map<?, ?> arg) {
  return exec().createComponents(uri, parent, insertBefore, resolver, arg);
}

代码示例来源:origin: org.zkoss.zk/zk

public Component createComponents(PageDefinition pagedef, Component parent, Component insertBefore,
    VariableResolver resolver) {
  return exec().createComponents(pagedef, parent, insertBefore, resolver);
}

代码示例来源:origin: org.zkoss.zk/zk

public Component createComponents(PageDefinition pagedef, Component parent, Map<?, ?> arg) {
  return exec().createComponents(pagedef, parent, arg);
}

代码示例来源:origin: org.zkoss.zk/zk

public Component createComponents(String uri, Component parent, Component insertBefore,
    VariableResolver resolver) {
  return exec().createComponents(uri, parent, insertBefore, resolver);
}

代码示例来源:origin: org.zkoss.zk/zk

public Component[] createComponents(String uri, Map<?, ?> arg) {
  return exec().createComponents(uri, arg);
}

代码示例来源:origin: org.zkoss.zk/zk

public Component createComponents(String uri, Component parent, Map<?, ?> arg) {
  return exec().createComponents(uri, parent, arg);
}

代码示例来源:origin: org.zkoss.zk/zk

public Component[] createComponents(PageDefinition pagedef, Map<?, ?> arg) {
  return exec().createComponents(pagedef, arg);
}

代码示例来源:origin: org.zkoss.zk/zk

public Component[] createComponents(String uri, Page page, VariableResolver resolver, Map<?, ?> arg) {
  return exec().createComponents(uri, page, resolver, arg);
}

代码示例来源:origin: org.zkoss.zk/zk

/** Creates components from a page file specified by an URI.
 * Shortcut to {@link Execution#createComponents(String, Component, Map)}.
 *
 * @param parent the parent component, or null if you want it to be
 * a root component. If parent is null, the page is assumed to be
 * the current page, which is determined by the execution context.
 * In other words, the new component will be the root component
 * of the current page if parent is null.
 * @param arg a map of parameters that is accessible by the arg variable
 * in EL, or by {@link Execution#getArg}.
 * Ignored if null.
 * @return the first component being created.
 * @see #createComponents(PageDefinition, Component, Map)
 */
public static final Component createComponents(String uri, Component parent, Map<?, ?> arg) {
  return getCurrent().createComponents(uri, parent, arg);
}

代码示例来源:origin: org.zkoss.zk/zk

/** Creates components based on the specified page definition.
 * Shortcut to {@link Execution#createComponents(PageDefinition, Component, Map)}.
 *
 * @param pagedef the page definition to use. It cannot be null.
 * @param parent the parent component, or null if you want it to be
 * a root component. If parent is null, the page is assumed to be
 * the current page, which is determined by the execution context.
 * In other words, the new component will be the root component
 * of the current page if parent is null.
 * @param arg a map of parameters that is accessible by the arg variable
 * in EL, or by {@link Execution#getArg}.
 * Ignored if null.
 * @return the first component being created.
 * @see #createComponents(String, Component, Map)
 */
public static final Component createComponents(PageDefinition pagedef, Component parent, Map<?, ?> arg) {
  return getCurrent().createComponents(pagedef, parent, arg);
}

代码示例来源:origin: org.zkoss.zk/zk

/** Creates components that belong to the given page
 * from a page file specified by an URI.
 *
 * @param page the page, or null if you want it to attach the created components.
 * @param resolver the variable resolver used to resolve variables.
 * Ignored if null.
 * @param arg a map of parameters that is accessible by the arg variable
 * in EL, or by {@link Execution#getArg}.
 * Ignored if null.
 * @return all top-level components being created.
 * @see #createComponents(WebApp, PageDefinition, Map)
 * @see #createComponentsDirectly(WebApp, String, String, Map)
 * @see #createComponentsDirectly(WebApp, Document, String, Map)
 * @see #createComponentsDirectly(WebApp, Reader, String, Map)
 * @since 8.0.1
 */
public static Component[] createComponents(String uri, Page page, VariableResolver resolver, Map<?, ?> arg) {
  return getCurrent().createComponents(uri, page, resolver, arg);
}

代码示例来源:origin: org.zkoss.zk/zk

public void doInit(Page page, Map<String, Object> args) throws Exception {
  //first called doInit, last called doAfterCompose
  final Execution exec = Executions.getCurrent();
  if (exec.getAttribute(RESOLVE_COMPOSITION) == null) {
    exec.setAttribute(RESOLVE_COMPOSITION, this);
  }
  final Component parent = (Component) exec.getAttribute(PARENT);
  for (Object arg : args.values())
    exec.createComponents((String) arg, parent, null);
}

代码示例来源:origin: org.zkoss.zk/zk

/** Creates components that don't belong to any page
 * from the specified page definition.
 *
 * <p>Unlike {@link #createComponents(PageDefinition,Component,Map)},
 * this method can be invoked without the current execution, such as
 * a working thread. In this case, the wapp argument must be specified.
 *
 * @param wapp the Web application. It is optional and used only if
 * no current execution (e.g., in a working thread).
 * The instance of {@link WebApp} can be retrieved by use of {@link org.zkoss.zk.ui.http.WebManager#getWebApp},
 * while the instance of {@link org.zkoss.zk.ui.http.WebManager} can be retrieved
 * by {@link org.zkoss.zk.ui.http.WebManager#getWebManager}
 * @param pagedef the page definition to use. It cannot be null.
 * @param arg a map of parameters that is accessible by the arg variable
 * in EL, or by {@link Execution#getArg}.
 * Ignored if null.
 * @return all top-level components being created.
 * @see #createComponents(WebApp, String, Map)
 * @since 3.6.2
 */
public static Component[] createComponents(WebApp wapp, PageDefinition pagedef, Map<?, ?> arg) {
  final CCInfo cci = beforeCC(wapp);
  try {
    return cci.exec.createComponents(pagedef, arg);
  } finally {
    afterCC(cci);
  }
}

代码示例来源:origin: org.zkoss.zk/zk

final CCInfo cci = beforeCC(wapp);
try {
  return cci.exec.createComponents(uri, arg);
} finally {
  afterCC(cci);

代码示例来源:origin: org.zkoss.zk/zk

String.class);
if (fulfillURI != null) {
  cs = merge(cs, ci.exec.createComponents(fulfillURI, parent, insertBefore, null));

代码示例来源:origin: org.zkoss.zk/zkplus

private void doModal(Page page, String url) {
  final Execution exec = Executions.getCurrent();
  final Object[] urls = parseUrl(url);
  final Component modalwin = exec.createComponents((String) urls[0], null, (Map) urls[1]);
  if (!(modalwin instanceof Window)) {
    throw new UiException("The page must enclosed with a Window component. Check url definition: " + url);
  }
  modalwin.setPage(page);
  ((Window) modalwin).doModal();
}

代码示例来源:origin: org.zkoss.zk/zk

private static Component[] execCreateChild(CreateInfo ci, Component parent, ComponentInfo childInfo,
    ReplaceableText replaceableText, Component insertBefore) {
  final ComponentDefinition childdef = childInfo.getComponentDefinition();
  if (childdef.isInlineMacro()) {
    if (insertBefore != null)
      throw new UnsupportedOperationException("The inline macro doesn't support template");
    final Map<String, Object> props = new HashMap<String, Object>();
    props.put("includer", parent);
    childInfo.evalProperties(props, ci.page, parent, true);
    return new Component[] { ci.exec.createComponents(childdef.getMacroURI(), parent, props) };
  } else {
    String rt = null;
    if (replaceableText != null) {
      // ZK-3549 should ignore blank but was not able to do so in Parser, e.g. applying template
      if (parent == null || parent.getDefinition().isBlankPreserved()) {
        rt = replaceableText.text;
      }
      replaceableText.text = childInfo.getReplaceableText();
      if (replaceableText.text != null)
        return new Component[0];
      //Note: replaceableText is one-shot only
      //So, replaceable text might not be generated
      //and it is ok since it is only blank string
    }
    Component child = execCreateChild0(ci, parent, childInfo, rt, insertBefore);
    return child != null ? new Component[] { child } : new Component[0];
  }
}

代码示例来源:origin: org.zkoss.zk/zul

"Root element <html> and DOCTYPE are not allowed in included file: [" + _src + "]");
exec.createComponents(pdef, this, _dynams);
if (j >= 0)
  log.warn("Query string is not allowed in instant mode: [" + _src + "]");

代码示例来源:origin: org.zkoss.zk/zk

return; //don't do twice
_inlines = exec.createComponents(_uri != null ? _uri : getDefinition().getMacroURI(), _props);
  return; //don't do twice (silently)
exec.createComponents(_uri != null ? _uri : getDefinition().getMacroURI(), this, _props);

代码示例来源:origin: org.zkoss.zk/zk

public void onEvent(Event evt) throws Exception {
  for (int j = _targets.length; --j >= 0;)
    _targets[j].removeEventListener(_evtnms[j], this); //one shot only
  final Execution exec = Executions.getCurrent();
  execCreate0(
      new CreateInfo(((WebAppCtrl) exec.getDesktop().getWebApp()).getUiFactory(), exec, _comp.getPage(),
          null), //technically sys composer can be used but we don't (to simplify it)
      _compInfo, _comp, null);
  if (_uri != null) {
    final String uri = (String) Evaluators.evaluate(_compInfo.getEvaluator(), _comp, _uri, String.class);
    if (uri != null)
      exec.createComponents(uri, _comp, null);
  }
  Events.sendEvent(new FulfillEvent(Events.ON_FULFILL, _comp, evt));
  //Use sendEvent so onFulfill will be processed before
  //the event triggers the fulfill (i.e., evt)
}

相关文章