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

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

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

Execution.getAttribute介绍

[英]Returns the value of the specified request attribute.
[中]返回指定请求属性的值。

代码示例

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

/** Returns if the ZK specific HTML tags are generated.
 * @since 5.0.3
 */
public static boolean isZkTagsGenerated(Execution exec) {
  return exec.getAttribute(ATTR_ZK_TAGS_GENERATED) != null;
}

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

public Object getAttribute(Execution exec, String name) {
  return exec.getAttribute(name);
}
public void setAttribute(Execution exec, String name, Object value) {

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

/** Returns the page redraw control.
   * It first check if a request attribute called
   * {@link Attributes#PAGE_REDRAW_CONTROL} is defined.
   * If not, it checks a request parameter called <code>zk.redrawCtrl</code>
   * is defined. If none of them is defined, null is returned.
   * @since 5.0.0
   */
  public static final String getPageRedrawControl(Execution exec) {
    String ctl = (String) exec.getAttribute(Attributes.PAGE_REDRAW_CONTROL);
    return ctl != null ? ctl : exec.getParameter("zk.redrawCtrl");
  }
}

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

/** Returns the render context, or null if not available.
 * It is used to render the content that will appear before the content
 * generated by {@link ContentRenderer}, such as crawlable content.
 *
 * @param exec the execution. If null, {@link Executions#getCurrent}
 * is assumed.
 */
public static final RenderContext getRenderContext(Execution exec) {
  if (exec == null)
    exec = Executions.getCurrent();
  return exec != null ? (RenderContext) exec.getAttribute(ATTR_RENDER_CONTEXT) : null;
}

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

/** Returns whether a component can directly generate HTML tags
 * to the output.
 * This flag is used by components that can generate the content
 * directly, such as {@link org.zkoss.zk.ui.HtmlNativeComponent}
 * @see #setDirectContent
 */
public static boolean isDirectContent(Execution exec) {
  if (exec == null)
    exec = Executions.getCurrent();
  return exec != null && exec.getAttribute(ATTR_DIRECT_CONTENT) != null;
}

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

/**
 * Returns the render context, or null if not available. The render context is available only if
 * the ZHTML page is rendered directly (rather than via inclusion).
 * 
 * @param exec
 *            the execution. If null, Executions.getCurrent() is assumed.
 */
public static TagRenderContext getTagRenderContext(Execution exec) {
  if (exec == null)
    exec = Executions.getCurrent();
  return exec != null ? (TagRenderContext) exec.getAttribute(ATTR_RENDER_CONTEXT) : null;
}

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

public Object getAttribute(String name, boolean recurse) {
  return exec().getAttribute(name, recurse);
}

代码示例来源: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/zkbind

public Object resolveParameter(Annotation anno, Class<?> returnType) {
    Object val = _execution.getAttribute(((ExecutionParam) anno).value());
    return val == null ? null : Classes.coerce(returnType, val);
  }
});

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

private static Map<Component, ShadowInfo> getShadowInfos(boolean autoCreate) {
  Execution exec = Executions.getCurrent();
  if (exec == null)
    return null;
  Map<Component, ShadowInfo> result = cast((Map) exec.getAttribute(COMPONENT_INFO));
  if (result == null && autoCreate) {
    result = new HashMap<Component, ShadowInfo>();
    exec.setAttribute(COMPONENT_INFO, result);
  }
  return result;
}

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

private static Map<Component, ComponentInfo> getComponentInfos(boolean autoCreate) {
  Execution exec = Executions.getCurrent();
  if (exec == null)
    return null;
  Map<Component, ComponentInfo> result = cast((Map) exec.getAttribute(COMPONENT_INFO));
  if (result == null && autoCreate) {
    result = new HashMap<Component, ComponentInfo>();
    exec.setAttribute(COMPONENT_INFO, result);
  }
  return result;
}

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

@SuppressWarnings("unchecked")
private static Map<String, EntityManager> getEmMap() {
  Execution current = Executions.getCurrent();
  Map map = (Map) current.getAttribute(JPA_EM_MAP);
  if (map == null) {
    map = new HashMap();
    Executions.getCurrent().setAttribute(JPA_EM_MAP, map);
  }
  return map;
}

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

public boolean init(Component comp, Event evt) {
  if (_enabled) {
    //Copy SessionMap stored in Execution attribute into event's ThreadLocal
    Map<Object, Object> map = cast((Map) Executions.getCurrent().getAttribute(HIBERNATE_SESSION_MAP));
    setSessionMap(map); //copy to event thread's ThreadLocal
  }
  return true;
}

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

public void afterResume(Component comp, Event evt) {
  if (_enabled) {
    //always keep the prepared SessionMap in event's ThreadLocal
    Map<Object, Object> map = cast((Map) Executions.getCurrent().getAttribute(HIBERNATE_SESSION_MAP));
    setSessionMap(map); //copy to event thread's ThreadLocal
  }
}

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

public BindingExecutionInfoCollector getExecutionInfoCollector() {
  Execution exec = Executions.getCurrent();
  if (exec == null)
    return null;
  BindingExecutionInfoCollector collector = (BindingExecutionInfoCollector) exec.getAttribute(COLLECTOR_KEY);
  if (collector == null) {
    collector = createBindingExecutionInfoCollector();
    exec.setAttribute(COLLECTOR_KEY, collector);
  }
  return collector;
}

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

public BindingAnnotationInfoChecker getAnnotationInfoChecker() {
  Execution exec = Executions.getCurrent();
  if (exec == null)
    return null;
  BindingAnnotationInfoChecker checker = (BindingAnnotationInfoChecker) exec.getAttribute(CHECKER_KEY);
  if (checker == null) {
    checker = createDefaultAnnotationInfoChecker();
    exec.setAttribute(CHECKER_KEY, checker);
  }
  return checker;
}

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

private void handleFailedModal(int oldmode, boolean oldvisi) {
  try {
    if (Executions.getCurrent().getAttribute("javax.servlet.error.exception") != null) {
      //handle it specially if it is used for displaying err
      setMode(HIGHLIGHTED);
    } else {
      setMode(oldmode); //restore
      setVisible(oldvisi);
    }
  } catch (Throwable ex) {
    log.error("Causing another error", ex);
  }
}

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

/** Returns the first line to be generated to the output,
 * or null if no special first line.
 */
public static final String outFirstLine(Execution exec, Page page) {
  if (exec.getAttribute(FIRST_LINE_GENED) == null && !exec.isAsyncUpdate(null)) {
    exec.setAttribute(FIRST_LINE_GENED, Boolean.TRUE);
    return trimAndLF(((PageCtrl) page).getFirstLine());
  }
  return "";
}

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

/** Generates the unavailable message in HTML tags, if any.
 * @param exec the execution (never null)
 */
public static String outUnavailable(Execution exec) {
  if (exec.getAttribute(ATTR_UNAVAILABLE_GENED) == null && !exec.isAsyncUpdate(null)) {
    exec.setAttribute(ATTR_UNAVAILABLE_GENED, Boolean.TRUE);
    final Device device = exec.getDesktop().getDevice();
    String s = device.getUnavailableMessage();
    return s != null ? "<noscript>\n" + s + "\n</noscript>" : "";
  }
  return ""; //nothing to generate
}

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

/** Returns the doc type, or null if not available.
 * It is null or &lt;!DOCTYPE ...&gt;.
 */
public static final String outDocType(Execution exec, Page page) {
  if (exec.getAttribute(DOCTYPE_GENED) == null && !exec.isAsyncUpdate(null)) {
    exec.setAttribute(DOCTYPE_GENED, Boolean.TRUE);
    final String docType = ((PageCtrl) page).getDocType();
    return trimAndLF(docType != null ? docType : page.getDesktop().getDevice().getDocType());
  }
  return "";
}

相关文章