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

x33g5p2x  于2022-02-03 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(91)

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

WebApp.getAttribute介绍

[英]Returns the value of the specified custom attribute.
[中]返回指定的自定义属性的值。

代码示例

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

public Object getAttribute(String name, boolean recurse) {
  Object val = getAttribute(name);
  return val != null || !recurse || _wapp == null ? val : _wapp.getAttribute(name, true);
}

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

/**
 * Returns the edition whether valid or invalid.
 * @since 6.5.5
 */
public static boolean isEditionValid() {
  WebApp current = WebApps.getCurrent();
  return !("CE".equals(getEdition()) || current == null
      || current.getAttribute("org.zkoss.zk.ui.notice") == null);
}

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

public void stop(WebApp wapp) {
    DesktopCache dc = (DesktopCache) wapp.getAttribute(ATTR_CACHE);
    if (dc != null) {
      wapp.removeAttribute(ATTR_CACHE);
      dc.stop();
    }
  }
}

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

@SuppressWarnings("unchecked")
private static Map<String, EntityManagerFactory> getEmfMap() {
  Map map = (Map) getWebApp().getAttribute(JPA_EMF_MAP);
  if (map == null) {
    map = new HashMap();
    getWebApp().setAttribute(JPA_EMF_MAP, map);
  }
  return map;
}

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

public DesktopCache getDesktopCache(Session sess) {
  final WebApp wapp = sess.getWebApp();
  DesktopCache dc = (DesktopCache) wapp.getAttribute(ATTR_CACHE);
  if (dc == null) {
    synchronized (this) {
      dc = (DesktopCache) wapp.getAttribute(ATTR_CACHE);
      if (dc == null) {
        dc = new SimpleDesktopCache(sess.getWebApp().getConfiguration());
        wapp.setAttribute(ATTR_CACHE, dc);
      }
    }
  }
  return dc;
}

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

/** Returns the AU extension that is associated the specified prefix.
 * @since 5.0.0
 */
public static final AuExtension getAuExtension(WebApp wapp, String prefix) {
  DHtmlUpdateServlet upsv = DHtmlUpdateServlet.getUpdateServlet(wapp);
  if (upsv == null) {
    synchronized (DHtmlUpdateServlet.class) {
      upsv = DHtmlUpdateServlet.getUpdateServlet(wapp);
      if (upsv == null) {
        Map aues = (Map) wapp.getAttribute(ATTR_AU_PROCESSORS);
        return aues != null ? (AuExtension) aues.get(prefix) : null;
      }
    }
  }
  return upsv.getAuExtension(prefix);
}

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

public Object getAttribute(String name, boolean recurse) {
  Object val = getAttribute(name);
  if (val != null || !recurse || hasAttribute(name))
    return val;
  if (_sess != null)
    return _sess.getAttribute(name, true);
  if (_wapp != null)
    return _wapp.getAttribute(name, true);
  return null;
}

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

Object notice = webApp.getAttribute("org.zkoss.zk.ui.client.notice");
if (notice instanceof String) {
  rcs += '\n' + ((String) notice);
Object notice = webApp.getAttribute("org.zkoss.zk.ui.client.notice");
if (notice instanceof String) {
  out.write((String) notice);

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

public ThreadLocalListener() {
  final WebApp app = Executions.getCurrent().getDesktop().getWebApp();
  _fieldsMap = cast((Map) app.getAttribute("zkplus.util.ThreadLocalListener.fieldsMap"));
  _enabled = app.getConfiguration().isEventThreadEnabled();
  if (_fieldsMap == null) {
    _fieldsMap = new HashMap<String, String[]>(8);
    final String PREF = "zkplus.util.ThreadLocalListener.fieldsMap";
    app.setAttribute(PREF, _fieldsMap);
    //read preference
    String val = app.getConfiguration().getPreference("ThreadLocal", null);
    if (val == null)
      val = Library.getProperty(PREF);
    if (val != null) {
      final Collection klassSets = CollectionsX.parse(null, val, ';');
      for (Iterator its = klassSets.iterator(); its.hasNext();) {
        final String klassSetStr = (String) its.next();
        final Collection klassSet = CollectionsX.parse(null, klassSetStr, '=');
        final Iterator itz = klassSet.iterator();
        final String klass = (String) itz.next();
        final String fieldsStr = (String) itz.next();
        final Collection<String> fields = CollectionsX.parse(null, fieldsStr, ',');
        _fieldsMap.put(klass, fields.toArray(new String[fields.size()]));
      }
    }
  }
  _threadLocalsMap = new HashMap<String, Object[]>(_fieldsMap.size());
}

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

@SuppressWarnings("unchecked")
private static final ResourceCache<PageDefinition> getCache(WebApp wapp) {
  ResourceCache<PageDefinition> cache = (ResourceCache<PageDefinition>) wapp.getAttribute(ATTR_PAGE_CACHE);
  if (cache == null) {
    synchronized (PageDefinitions.class) {
      cache = (ResourceCache) wapp.getAttribute(ATTR_PAGE_CACHE);
      if (cache == null) {
        ResourceLoader<PageDefinition> loader = null;

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

/** Adds an AU extension and associates it with the specified prefix,
 * even before {@link DHtmlUpdateServlet} is started.
 * <p>Unlike {@link #addAuExtension(String, AuExtension)}, it can be called
 * even if the update servlet is not loaded yet ({@link #getUpdateServlet}
 * returns null).
 *
 * <p>If there was an AU extension associated with the same name, the
 * the old AU extension will be replaced.
 * @since 5.0.0
 */
public static final AuExtension addAuExtension(WebApp wapp, String prefix, AuExtension extension)
    throws ServletException {
  DHtmlUpdateServlet upsv = DHtmlUpdateServlet.getUpdateServlet(wapp);
  if (upsv == null) {
    synchronized (DHtmlUpdateServlet.class) {
      upsv = DHtmlUpdateServlet.getUpdateServlet(wapp);
      if (upsv == null) {
        checkAuExtension(prefix, extension);
        Map<String, AuExtension> aues = cast((Map) wapp.getAttribute(ATTR_AU_PROCESSORS));
        if (aues == null)
          wapp.setAttribute(ATTR_AU_PROCESSORS, aues = new HashMap<String, AuExtension>(4));
        return aues.put(prefix, extension);
      }
    }
  }
  return upsv.addAuExtension(prefix, extension);
}

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

WebApp wapp = desktop.getWebApp();
if (wapp == null || "CE".equals(WebApps.getEdition())
    || wapp.getAttribute("org.zkoss.zk.ui.notice") != null) {
  final PI pi = (PI) sess.getAttribute(ATTR_PI);
  boolean show = pi == null;

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

final Map aues = (Map) wapp.getAttribute(ATTR_AU_PROCESSORS);
if (aues != null) {
  for (Iterator it = aues.entrySet().iterator(); it.hasNext();) {

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

sb.append(" PE");
sb.append(' ').append(wapp.getBuild());
Object o = wapp.getAttribute("org.zkoss.zk.ui.notice");
if (o != null)
  sb.append(o);

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

Object notice = webApp.getAttribute("org.zkoss.zk.ui.client.notice");
if (notice instanceof String) {
  out.write((String) notice);

相关文章