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 }
/** 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); } }
/** 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); }
/** 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; } }
/** * 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(); } }
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 }
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 }
/** 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); } }
/** 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; } }
/** 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; } }
/** 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); } }
/** 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); }
/** 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); }
if (isDefault ()) { org.openide.nodes.Children newChildren = null; try {
if (isDefault ()) { org.openide.nodes.Children newChildren = null; try {