org.openide.nodes.AbstractNode.getCookie()方法的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(36)

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

AbstractNode.getCookie介绍

[英]Get a cookie from the node. Uses the cookie set as determined by #getCookieSet.
[中]从节点获取cookie。使用由#getCookieSet确定的cookie集。

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-nodes

/** Get a cookie.
  * @param clazz representation class
  * @return the index implementation or children if these match the cookie class,
  * else using the superclass cookie lookup
  */
  public <T extends Node.Cookie> T getCookie(Class<T> clazz) {
    if (clazz.isInstance(indexImpl)) {
      // ok, Index implementor is enough
      return clazz.cast(indexImpl);
    }

    Children ch = getChildren();

    if (clazz.isInstance(ch)) {
      // ok, children are enough
      return clazz.cast(ch);
    }

    return super.getCookie(clazz);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-dataconnectivity

public Node.Cookie getCookie(Class clazz) {
  if ( clazz == ProjectDataSourceNode.class ) {
    return this ;
  }
  else return super.getCookie(clazz) ;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-designer

/** Get a cookie. Call super first, but if null, also check the
     * associated data object.
     */
    public <T extends Node.Cookie> T getCookie(Class<T> cl) {
      T cookie = super.getCookie(cl);

      if (cookie != null) {
        return cookie;
      }

//            if (dobj != null) {
//                return dobj.getCookie(cl);
//            }

      return null;
    }

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-j2eeserver

public org.openide.nodes.Node.Cookie getCookie(Class type) {
  if (ServerInstance.class.isAssignableFrom(type)) {
    return instance;
  }
  return super.getCookie(type);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-sun-appsrv81

public Node.Cookie getCookie (Class type) {
  if (ManagerNode.class.isAssignableFrom(type)) {
    return this;
  }
  if (SunDeploymentManagerInterface.class.isAssignableFrom(type)) {
    return this;
  }
  return super.getCookie (type);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mercurial

/**
 * Provide cookies to actions.
 * If a node represents primary file of a DataObject
 * it has respective DataObject cookies.
 */
@SuppressWarnings("unchecked") // Adding getCookie(Class<Cookie> klass) results in name clash
@Override
public Cookie getCookie(Class klass) {
  if (dobj == null) {
    return super.getCookie(klass);
  } else {
    return dobj.getCookie(klass);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Get a cookie.
  * @param clazz representation class
  * @return the index implementation or children if these match the cookie class,
  * else using the superclass cookie lookup
  */
  public Cookie getCookie (Class clazz) {
    if (clazz.isInstance(indexImpl)) {
      // ok, Index implementor is enough
      return (Cookie)indexImpl;
    }
    Children ch = getChildren ();
    if (clazz.isInstance(ch)) {
      // ok, children are enough
      return (Cookie)ch;
    }
    return super.getCookie (clazz);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide-loaders

/** Get a cookie.
 * First of all {@link DataObject#getCookie} is
* called. If it produces non-<code>null</code> result, that is returned.
* Otherwise the superclass is tried.
 * Subclassers overriding this method should consider the recommendations
 * in {@link DataObject#createNodeDelegate}.
*
* @return the cookie or <code>null</code>
*/
public Node.Cookie getCookie (Class cl) {
  Node.Cookie c = obj.getCookie (cl);
  if (c != null) {
    return c;
  } else {
    return super.getCookie (cl);
  }
}

代码示例来源:origin: nl.cloudfarming.client/geoviewer-data

/**
   * Returns a cookie. Overridden to add support for the IndexCookie, which is needed to keep track of the position of this node.
   * 
   * @param clazz The class for which the cookie should be returned
   * 
   * @return The cookie object, or null if no cookie was found for the specified class.
   */
  @Override
  @SuppressWarnings("unchecked")
  public Cookie getCookie(Class clazz) {
    Children ch = getChildren();

    if (clazz.isInstance(ch)) {
      return (Cookie) ch;
    }

    return super.getCookie(clazz);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Get a cookie.
  * @param clazz representation class
  * @return the index implementation or children if these match the cookie class,
  * else using the superclass cookie lookup
  */
  public Cookie getCookie (Class clazz) {
    if (clazz.isInstance(indexImpl)) {
      // ok, Index implementor is enough
      return (Cookie)indexImpl;
    }
    Children ch = getChildren ();
    if (clazz.isInstance(ch)) {
      // ok, children are enough
      return (Cookie)ch;
    }
    return super.getCookie (clazz);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-insync

/**
 * Get a cookie. Call super first, but if null, delegate to
 * the associated data object (if any). The delegated to data object
 * is generally the file representing the container for the bean.
 */
public Node.Cookie getCookie(Class cl) {
  Node.Cookie c = super.getCookie(cl);
  if (c != null)
    return c;
  
  // XXX Just a hack for the rare cases the dataObject was not available at the beginning.
  // Rather the (faces)model should fire changes about file changes (if there are any).
  if (dataObject == null) {
    setDataObject(retrieveJspDataObject(liveBean));
  }
  
  if (dataObject != null)
    return dataObject.getCookie(cl);
  
  return null;
}

相关文章

最新文章

更多