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

x33g5p2x  于2022-01-18 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(180)

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

Desktop.removeAttribute介绍

[英]Removes the specified custom attribute associated with the desktop.
[中]删除与桌面关联的指定自定义属性。

代码示例

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

/** Returns the result of an AU request representing the update result.
 */
public static Object getUpdateResult(AuRequest request) throws UiException {
  final String key = (String) request.getData().get("contentId");
  final Object result = request.getDesktop().removeAttribute(key);
  if (result == null)
    throw new UiException("Content not found: " + key);
  return result;
}

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

public Object removeAttribute(String name, boolean recurse) {
  if (recurse && !hasAttribute(name)) {
    if (_desktop != null) {
      if (_desktop.hasAttribute(name, true))
        return _desktop.removeAttribute(name, true);
    }
    return null;
  }
  return removeAttribute(name);
}

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

public Object removeAttribute(String name, boolean recurse) {
  if (recurse && !hasAttribute(name)) {
    Desktop desktop = getDesktop();
    if (desktop != null) {
      if (desktop.hasAttribute(name, true))
        return desktop.removeAttribute(name, true);
    }
    return null;
  }
  return removeAttribute(name);
}

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

private static void outDivTemplateEnd(Page page, Writer out) throws IOException {
  final Desktop dt;
  if (page != null && (dt = page.getDesktop()) != null) {
    if (dt.getAttribute(ATTR_DESKTOP_CLIENTINFO) != null) {
      dt.removeAttribute(ATTR_DESKTOP_CLIENTINFO);
      if (!"CE".equals(WebApps.getEdition()))
        out.write(
            "<script type=\"text/javascript\">if(zk.clientinfo === undefined)zk.clientinfo = true;</script>");
    }
    if (dt.getAttribute(ATTR_DESKTOP_VISIBILITYCHANGE) != null) {
      dt.removeAttribute(ATTR_DESKTOP_VISIBILITYCHANGE);
      out.write(
          "<script type=\"text/javascript\">if(zk.visibilitychange === undefined)zk.visibilitychange = true;</script>");
    }
    String resourceURL = (String) page.getAttribute(ATTR_PORTLET2_RESOURCEURL, Page.PAGE_SCOPE),
        namespace = (String) page.getAttribute(ATTR_PORTLET2_NAMESPACE, Page.PAGE_SCOPE);
    if (resourceURL != null) {
      page.removeAttribute(ATTR_PORTLET2_RESOURCEURL, Page.PAGE_SCOPE);
      page.removeAttribute(ATTR_PORTLET2_NAMESPACE, Page.PAGE_SCOPE);
      // B65-ZK-2210: store url and namespace per desktop.
      out.write("<script type=\"text/javascript\">if(!zk.portlet2Data) zk.portlet2Data = {};\n"
          + "zk.portlet2Data['" + dt.getId() + "'] = {" + "resourceURL: '" + resourceURL + "', "
          + "namespace: '" + namespace + "'};</script>");
    }
  }
  outSEOContent(page, out);
  out.write("</div>");
}

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

/**
 * Terminate a {@linkplain OperationThread} which is stored in desktop and clear it.
 * 
 * @param desktop the associated desktop
 */
public static void destroyWith(Desktop desktop) {
  if (desktop == null){
    throw new NullPointerException("desktop is null");
  }
  if(D.ON && log.debugable()){
    log.debug("destory a Operation Thread for desktop:"+desktop);
  }
  synchronized(desktop) {
    if (desktop.isAlive()) {// destroy desktop if it still alive.
      OperationThread t = (OperationThread) desktop
          .getAttribute(DESKTOP_KEY);
      desktop.removeAttribute(DESKTOP_KEY);
      if (t != null && t.isRunning()) {
        t.terminate();
      }
      
    }
  }
}

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

/**
   * Creates an instance of {@link UploadEvent} based on the event name and component,
   * the {@link UploadEvent} contains the latest upload media from user.
   * Internal Use Only.
   *
   * @param name event name
   * @param component component that triggers the upload event
   * @return upload event
   * @since 8.6.0
   */
  public static UploadEvent getLatestUploadEvent(String name, Component component) {
    Desktop desktop = component.getDesktop();
    String uuid = component.getUuid();
    final List<Media> result = cast((List) desktop.getAttribute(uuid));
    desktop.removeAttribute(uuid);
    return new UploadEvent(name, desktop.getComponentByUuid(uuid), UploadUtils.parseResult(result));
  }
}

相关文章