本文整理了Java中org.zkoss.zk.ui.Execution.setAttribute()
方法的一些代码示例,展示了Execution.setAttribute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Execution.setAttribute()
方法的具体详情如下:
包路径:org.zkoss.zk.ui.Execution
类名称:Execution
方法名:setAttribute
[英]Sets the value of the specified request attribute.
[中]
代码示例来源:origin: org.zkoss.zk/zhtml
/**
* Ends and cleans up the rendering of a ZHTML tag.
*
* @param param
* the value returned by {@link #beforeRenderHtml}.
*/
public static void afterRenderTag(Execution exec, Object param) {
if (param != null)
exec.setAttribute(ATTR_RENDER_CONTEXT, null);
}
代码示例来源:origin: org.zkoss.zk/zuljsp
public void setAttribute(Execution exec, String name, Object value) {
exec.setAttribute(name, value);
}
public void removeAttribute(Execution exec, String name) {
代码示例来源:origin: org.zkoss.zk/zk
private static final void setRenderContext(Execution exec, RenderContext rc) {
exec.setAttribute(ATTR_RENDER_CONTEXT, rc);
}
代码示例来源:origin: org.zkoss.zk/zk
/** Sets whether a component can directly generate HTML tags
* to the output.
* @see #isDirectContent
*/
public static boolean setDirectContent(Execution exec, boolean direct) {
return (direct ? exec.setAttribute(ATTR_DIRECT_CONTENT, Boolean.TRUE)
: exec.removeAttribute(ATTR_DIRECT_CONTENT)) != null;
}
代码示例来源:origin: org.zkoss.zk/zul
private static void restoreDynams(Execution exec, Map<String, Object> old) {
if (old != null)
for (Map.Entry<String, Object> me : old.entrySet()) {
final String nm = me.getKey();
final Object val = me.getValue();
if (val != null)
exec.setAttribute(nm, val);
else
exec.removeAttribute(nm);
}
}
代码示例来源:origin: org.zkoss.zk/zk
public Object setAttribute(String name, Object value) {
return exec().setAttribute(name, value);
}
代码示例来源:origin: org.zkoss.zk/zk
public Object setAttribute(String name, Object value, boolean recurse) {
return exec().setAttribute(name, value, recurse);
}
代码示例来源:origin: org.zkoss.zk/zul
private Map<String, Object> setupDynams(Execution exec) {
if (_dynams == null || _dynams.isEmpty())
return null;
final Map<String, Object> old = new HashMap<String, Object>();
for (Map.Entry<String, Object> me : _dynams.entrySet()) {
final String nm = me.getKey();
final Object val = me.getValue();
old.put(nm, exec.getAttribute(nm));
if (val != null)
exec.setAttribute(nm, val);
else
exec.removeAttribute(nm);
}
return old;
}
代码示例来源:origin: org.zkoss.zk/zkplus
public void init(Execution exec, Execution parent) {
if (_enabled) {
if (parent == null) { //root execution
//always prepare a ThreadLocal SessionMap in Execution attribute
Map<Object, Object> map = getSessionMap();
if (map == null) {
map = new HashMap<Object, Object>();
setSessionMap(map); //copy to servlet thread's ThreadLocal
}
exec.setAttribute(HIBERNATE_SESSION_MAP, map); // store in Execution attribute
//20060912, henrichen: tricky. Stuff something into session map to
//prevent the map from being removed from context ThreadLocal by the
//ThreadLocalSessionContext#unbind() when it is empty.
map.put(SOMETHING, null);
}
}
}
代码示例来源: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/zhtml
/**
* Prepares for rendering a ZHTML tag. After rendering, the caller shall also invoke
* {@link #afterRenderTag}. Furthermore, the return value of this method shall be passed as the
* <code>param</code> argument of {@link #afterRenderTag}.
*
* @return the result of this invocation. It shall be passed to the <code>param</code> argument
* of {@link #afterRenderTag}.
* @see #afterRenderTag
*/
public static Object beforeRenderTag(Execution exec) {
TagRenderContext rc = getTagRenderContext(exec);
if (rc != null)
return null; // already been called
rc = new TagRenderContext();
exec.setAttribute(ATTR_RENDER_CONTEXT, rc);
return rc;
}
代码示例来源: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/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
/** 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/zhtml
public void render(Page page, Writer out) throws IOException {
final Execution exec = Executions.getCurrent();
final String ctl = ExecutionsCtrl.getPageRedrawControl(exec);
boolean au = exec.isAsyncUpdate(null);
if (!au && (page.isComplete() || "complete".equals(ctl))) {
renderComplete(exec, page, out);
return;
}
boolean pageOnly = au;
if (!pageOnly)
pageOnly = (exec.isIncluded() || "page".equals(ctl)) && !"desktop".equals(ctl);
if (pageOnly)
renderPage(exec, page, out, au);
else {
exec.setAttribute(Attributes.PAGE_REDRAW_CONTROL, "complete");
renderComplete(exec, page, out);
}
}
代码示例来源: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 <!DOCTYPE ...>.
*/
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 "";
}
内容来源于网络,如有侵权,请联系作者删除!