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

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

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

FilterNode.isDefault介绍

[英]Check method whether the node has default behaviour or if it is either subclass of uses different children.
[中]检查该节点是否具有默认行为,或者它是否是的子类或使用不同的子类。

代码示例

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

private static Node getRepresentation(Node n) {
  while (n instanceof FilterNode) {
    FilterNode fn = (FilterNode) n;
    if (!fn.isDefault()) {
      return n;
    }
    n = fn.original;
  }
  return n; // either node or nondefault FilterNode
}

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

/** Create new filter node for the original.
* Subclasses do not have to override this, but if they do not,
* the default implementation will filter the subclass filter, which is not
* very efficient.
* @return copy of this node
*/
public Node cloneNode() {
  if (isDefault()) {
    // this is realy filter node without changed behaviour
    // with the normal children => use normal constructor for the
    // original node
    return new FilterNode(original);
  } else {
    // create filter node for this node to reflect changed
    // behaviour
    return new FilterNode(this);
  }
}

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

/** If this is FilterNode without any changes (subclassed, changed children)
* and the original provides handle, stores them and
* returns a new handle for the proxy.
* <p>Subclasses <strong>must</strong> override this if they wish for their nodes to be
* properly serializable.
*
* @return the handle, or <code>null</code> if this node is subclassed or
*    uses changed children
*/
public Node.Handle getHandle() {
  if (!isDefault()) {
    // subclasses has to implement the method by its own
    return null;
  }
  Node.Handle original = this.original.getHandle();
  if (original == null) {
    // no original handle => no handle here
    return null;
  }
  return new FilterHandle(original);
}

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

/** Hash by original nodes.
* Note that for subclasses of <code>FilterNode</code>, or filter nodes with non-default children,
* the hash reverts to the identity hash code.
* @return the delegated hash code
*/
@Override
public int hashCode() {
  try {
    assert hashCodeLogging(true) : ""; // NOI18N
    int result = isDefault() ? original.hashCode() : System.identityHashCode(this);
    assert hashCodeLogging(false) : ""; // NOI18N
    return result;
  } catch (StackError err) {
    err.add(this);
    throw err;
  }
}

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

/**
 * This method is used to change the Children from Children.LEAF to Children
 * typically used to when there is a setChildren() on the original node
 * setChildren will fire the appropriate events
 */
@Override
final void updateChildren() {
  if (isDefault()) {
    org.openide.nodes.Children newChildren = null;
    try {
      Children.PR.enterReadAccess();
      if ((original.hierarchy == Children.LEAF) && (hierarchy != Children.LEAF)) {
        newChildren = Children.LEAF;
      } else if ((original.hierarchy != Children.LEAF) && (hierarchy == Children.LEAF)) {
        newChildren = new Children(original);
      }
    } finally {
      Children.PR.exitReadAccess();
    }
    if (newChildren != null) {
      setChildren(newChildren);
    }
  } else {
    super.updateChildren();
  }
}

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

private static Node getRepresentation(Node n) {
  while (n instanceof FilterNode) {
    FilterNode fn = (FilterNode)n;
    if ( ! fn.isDefault() ) return n;
    n = fn.original;
  }
  return n; // either node or nondefault FilterNode
}

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

private static Node getRepresentation(Node n) {
  while (n instanceof FilterNode) {
    FilterNode fn = (FilterNode)n;
    if ( ! fn.isDefault() ) return n;
    n = fn.original;
  }
  return n; // either node or nondefault FilterNode
}

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

/** Create new filter node for the original.
* Subclasses do not have to override this, but if they do not,
* the default implementation will filter the subclass filter, which is not
* very efficient.
* @return copy of this node
*/
public Node cloneNode () {
  if (isDefault ()) {
    // this is realy filter node without changed behaviour
    // with the normal children => use normal constructor for the
    // original node
    return new FilterNode (original);
  } else {
    // create filter node for this node to reflect changed
    // behaviour
    return new FilterNode (this);
  }
}

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

/** Hash by original nodes.
* Note that for subclasses of <code>FilterNode</code>, or filter nodes with non-default children,
* the hash reverts to the identity hash code.
* @return the delegated hash code
*/
public int hashCode () {
  try {
    assert hashCodeLogging (true) : ""; // NOI18N
    // [pnejedly] identityHashCode used as workaround of JDK bug
    // see issue #46993
    int result = isDefault () ? original.hashCode () : System.identityHashCode(this);
    assert hashCodeLogging (false) : ""; // NOI18N
    return result;
  } catch (StackError err) {
    err.add (this);
    throw err;
  }
}

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

/** Hash by original nodes.
* Note that for subclasses of <code>FilterNode</code>, or filter nodes with non-default children,
* the hash reverts to the identity hash code.
* @return the delegated hash code
*/
public int hashCode () {
  try {
    assert hashCodeLogging (true) : ""; // NOI18N
    // [pnejedly] identityHashCode used as workaround of JDK bug
    // see issue #46993
    int result = isDefault () ? original.hashCode () : System.identityHashCode(this);
    assert hashCodeLogging (false) : ""; // NOI18N
    return result;
  } catch (StackError err) {
    err.add (this);
    throw err;
  }
}

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

/** Create new filter node for the original.
* Subclasses do not have to override this, but if they do not,
* the default implementation will filter the subclass filter, which is not
* very efficient.
* @return copy of this node
*/
public Node cloneNode () {
  if (isDefault ()) {
    // this is realy filter node without changed behaviour
    // with the normal children => use normal constructor for the
    // original node
    return new FilterNode (original);
  } else {
    // create filter node for this node to reflect changed
    // behaviour
    return new FilterNode (this);
  }
}

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

/** If this is FilterNode without any changes (subclassed, changed children)
* and the original provides handle, stores them and
* returns a new handle for the proxy.
* <p>Subclasses <strong>must</strong> override this if they wish for their nodes to be
* properly serializable.
*
* @return the handle, or <code>null</code> if this node is subclassed or
*    uses changed children
*/
public Node.Handle getHandle () {
  if (!isDefault ()) {
    // subclasses has to implement the method by its own
    return null;
  }
  Node.Handle original = this.original.getHandle ();
  if (original == null) {
    // no original handle => no handle here
    return null;
  }
  return new FilterHandle (original);
}

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

/** If this is FilterNode without any changes (subclassed, changed children)
* and the original provides handle, stores them and
* returns a new handle for the proxy.
* <p>Subclasses <strong>must</strong> override this if they wish for their nodes to be
* properly serializable.
*
* @return the handle, or <code>null</code> if this node is subclassed or
*    uses changed children
*/
public Node.Handle getHandle () {
  if (!isDefault ()) {
    // subclasses has to implement the method by its own
    return null;
  }
  Node.Handle original = this.original.getHandle ();
  if (original == null) {
    // no original handle => no handle here
    return null;
  }
  return new FilterHandle (original);
}

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

if (isDefault ()) {
  org.openide.nodes.Children newChildren = null;
  try {

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

if (isDefault ()) {
  org.openide.nodes.Children newChildren = null;
  try {

相关文章

微信公众号

最新文章

更多