X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/7a654f8d43fdb43d78b63d90528bed6e86b608cc..3789b528d8dd8aad4558e38e22d775bcab1cbd36:/docs/source/NodeInterface.html diff --git a/docs/source/NodeInterface.html b/docs/source/NodeInterface.html index 55f38f77..3bb1f2b7 100644 --- a/docs/source/NodeInterface.html +++ b/docs/source/NodeInterface.html @@ -1,4 +1,21 @@ -Sencha Documentation Project
/**
+
+
+
+  
+  The source code
+  
+  
+  
+  
+
+
+  
/**
  * @class Ext.data.NodeInterface
  * This class is meant to be used as a set of methods that are applied to the prototype of a
  * Record to decorate it with a Node API. This means that models used in conjunction with a tree
@@ -9,7 +26,7 @@ Ext.define('Ext.data.NodeInterface', {
     requires: ['Ext.data.Field'],
     
     statics: {
-        /**
+        /**
          * This method allows you to decorate a Record's prototype to implement the NodeInterface.
          * This adds a set of methods, new events, new properties and new fields on every Record
          * with the same Model as the passed Record.
@@ -81,7 +98,7 @@ Ext.define('Ext.data.NodeInterface', {
             record.commit(true);
             
             record.enableBubble([
-                /**
+                /**
                  * @event append
                  * Fires when a new child node is appended
                  * @param {Node} this This node
@@ -90,7 +107,7 @@ Ext.define('Ext.data.NodeInterface', {
                  */
                 "append",
 
-                /**
+                /**
                  * @event remove
                  * Fires when a child node is removed
                  * @param {Node} this This node
@@ -98,7 +115,7 @@ Ext.define('Ext.data.NodeInterface', {
                  */
                 "remove",
 
-                /**
+                /**
                  * @event move
                  * Fires when this node is moved to a new location in the tree
                  * @param {Node} this This node
@@ -108,7 +125,7 @@ Ext.define('Ext.data.NodeInterface', {
                  */
                 "move",
 
-                /**
+                /**
                  * @event insert
                  * Fires when a new child node is inserted.
                  * @param {Node} this This node
@@ -117,7 +134,7 @@ Ext.define('Ext.data.NodeInterface', {
                  */
                 "insert",
 
-                /**
+                /**
                  * @event beforeappend
                  * Fires before a new child is appended, return false to cancel the append.
                  * @param {Node} this This node
@@ -125,7 +142,7 @@ Ext.define('Ext.data.NodeInterface', {
                  */
                 "beforeappend",
 
-                /**
+                /**
                  * @event beforeremove
                  * Fires before a child is removed, return false to cancel the remove.
                  * @param {Node} this This node
@@ -133,7 +150,7 @@ Ext.define('Ext.data.NodeInterface', {
                  */
                 "beforeremove",
 
-                /**
+                /**
                  * @event beforemove
                  * Fires before this node is moved to a new location in the tree. Return false to cancel the move.
                  * @param {Node} this This node
@@ -143,7 +160,7 @@ Ext.define('Ext.data.NodeInterface', {
                  */
                 "beforemove",
 
-                 /**
+                 /**
                   * @event beforeinsert
                   * Fires before a new child is inserted, return false to cancel the insert.
                   * @param {Node} this This node
@@ -152,35 +169,35 @@ Ext.define('Ext.data.NodeInterface', {
                   */
                 "beforeinsert",
                 
-                /**
+                /**
                  * @event expand
                  * Fires when this node is expanded.
                  * @param {Node} this The expanding node
                  */
                 "expand",
                 
-                /**
+                /**
                  * @event collapse
                  * Fires when this node is collapsed.
                  * @param {Node} this The collapsing node
                  */
                 "collapse",
                 
-                /**
+                /**
                  * @event beforeexpand
                  * Fires before this node is expanded.
                  * @param {Node} this The expanding node
                  */
                 "beforeexpand",
                 
-                /**
+                /**
                  * @event beforecollapse
                  * Fires before this node is collapsed.
                  * @param {Node} this The collapsing node
                  */
                 "beforecollapse",
                 
-                /**
+                /**
                  * @event beforecollapse
                  * Fires before this node is collapsed.
                  * @param {Node} this The collapsing node
@@ -216,7 +233,7 @@ Ext.define('Ext.data.NodeInterface', {
             return {
                 isNode: true,
 
-                /**
+                /**
                  * Ensures that the passed object is an instance of a Record with the NodeInterface applied
                  * @return {Boolean}
                  */
@@ -228,7 +245,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return Ext.data.NodeInterface.decorate(node);
                 },
                 
-                /**
+                /**
                  * Returns true if this node is a leaf
                  * @return {Boolean}
                  */
@@ -236,7 +253,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return this.get('leaf') === true;
                 },
 
-                /**
+                /**
                  * Sets the first child of this node
                  * @private
                  * @param {Ext.data.NodeInterface} node
@@ -245,7 +262,7 @@ Ext.define('Ext.data.NodeInterface', {
                     this.firstChild = node;
                 },
 
-                /**
+                /**
                  * Sets the last child of this node
                  * @private
                  * @param {Ext.data.NodeInterface} node
@@ -254,7 +271,7 @@ Ext.define('Ext.data.NodeInterface', {
                     this.lastChild = node;
                 },
 
-                /**
+                /**
                  * Updates general data of this node like isFirst, isLast, depth. This
                  * method is internally called after a node is moved. This shouldn't
                  * have to be called by the developer unless they are creating custom
@@ -296,7 +313,7 @@ Ext.define('Ext.data.NodeInterface', {
                     }
                 },
 
-                /**
+                /**
                  * Returns true if this node is the last child of its parent
                  * @return {Boolean}
                  */
@@ -304,7 +321,7 @@ Ext.define('Ext.data.NodeInterface', {
                    return this.get('isLast');
                 },
 
-                /**
+                /**
                  * Returns true if this node is the first child of its parent
                  * @return {Boolean}
                  */
@@ -312,7 +329,7 @@ Ext.define('Ext.data.NodeInterface', {
                    return this.get('isFirst');
                 },
 
-                /**
+                /**
                  * Returns true if this node has one or more child nodes, else false.
                  * @return {Boolean}
                  */
@@ -320,7 +337,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return !this.isLeaf() && this.childNodes.length > 0;
                 },
 
-                /**
+                /**
                  * Returns true if this node has one or more child nodes, or if the <tt>expandable</tt>
                  * node attribute is explicitly specified as true (see {@link #attributes}), otherwise returns false.
                  * @return {Boolean}
@@ -329,7 +346,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return this.get('expandable') || this.hasChildNodes();
                 },
 
-                /**
+                /**
                  * <p>Insert node(s) as the last child node of this node.</p>
                  * <p>If the node was previously a child node of another parent node, it will be removed from that node first.</p>
                  * @param {Node/Array} node The node or Array of nodes to append
@@ -409,7 +426,7 @@ Ext.define('Ext.data.NodeInterface', {
                     }
                 },
                 
-                /**
+                /**
                  * Returns the bubble target for this node
                  * @private
                  * @return {Object} The bubble target
@@ -418,7 +435,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return this.parentNode;
                 },
 
-                /**
+                /**
                  * Removes a child node from this node.
                  * @param {Node} node The node to remove
                  * @param {Boolean} destroy <tt>true</tt> to destroy the node upon removal. Defaults to <tt>false</tt>.
@@ -472,7 +489,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return node;
                 },
 
-                /**
+                /**
                  * Creates a copy (clone) of this Node.
                  * @param {String} id (optional) A new id, defaults to this Node's id. See <code>{@link #id}</code>.
                  * @param {Boolean} deep (optional) <p>If passed as <code>true</code>, all child Nodes are recursively copied into the new Node.</p>
@@ -494,7 +511,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return result;
                 },
 
-                /**
+                /**
                  * Clear the node.
                  * @private
                  * @param {Boolean} destroy True to destroy the node.
@@ -509,7 +526,7 @@ Ext.define('Ext.data.NodeInterface', {
                     }
                 },
 
-                /**
+                /**
                  * Destroys the node.
                  */
                 destroy : function(silent) {
@@ -519,7 +536,8 @@ Ext.define('Ext.data.NodeInterface', {
                      * 2) When destroy on the tree is called
                      * 3) For destroying child nodes on a node
                      */
-                    var me = this;
+                    var me = this,
+                        options = me.destroyOptions;
                     
                     if (silent === true) {
                         me.clear(true);
@@ -527,14 +545,16 @@ Ext.define('Ext.data.NodeInterface', {
                             n.destroy(true);
                         });
                         me.childNodes = null;
+                        delete me.destroyOptions;
+                        me.callOverridden([options]);
                     } else {
+                        me.destroyOptions = silent;
+                        // overridden method will be called, since remove will end up calling destroy(true);
                         me.remove(true);
                     }
-
-                    me.callOverridden();
                 },
 
-                /**
+                /**
                  * Inserts the first node before the second node in this nodes childNodes collection.
                  * @param {Node} node The node to insert
                  * @param {Node} refNode The node to insert before (if null the node is appended)
@@ -616,7 +636,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return node;
                 },
                 
-                /**
+                /**
                  * Insert a node into this node
                  * @param {Number} index The zero-based index to insert the node at
                  * @param {Ext.data.Model} node The node to insert
@@ -632,7 +652,7 @@ Ext.define('Ext.data.NodeInterface', {
                     }
                 },
 
-                /**
+                /**
                  * Removes this node from its parent
                  * @param {Boolean} destroy <tt>true</tt> to destroy the node upon removal. Defaults to <tt>false</tt>.
                  * @return {Node} this
@@ -646,7 +666,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return this;
                 },
 
-                /**
+                /**
                  * Removes all child nodes from this node.
                  * @param {Boolean} destroy <tt>true</tt> to destroy the node upon removal. Defaults to <tt>false</tt>.
                  * @return {Node} this
@@ -661,7 +681,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return this;
                 },
 
-                /**
+                /**
                  * Returns the child node at the specified index.
                  * @param {Number} index
                  * @return {Node}
@@ -670,7 +690,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return this.childNodes[index];
                 },
 
-                /**
+                /**
                  * Replaces one child node in this node with another.
                  * @param {Node} newChild The replacement node
                  * @param {Node} oldChild The node to replace
@@ -684,7 +704,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return oldChild;
                 },
 
-                /**
+                /**
                  * Returns the index of a child node
                  * @param {Node} node
                  * @return {Number} The index of the node or -1 if it was not found
@@ -693,7 +713,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return Ext.Array.indexOf(this.childNodes, child);
                 },
 
-                /**
+                /**
                  * Returns depth of this node (the root node has a depth of 0)
                  * @return {Number}
                  */
@@ -701,7 +721,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return this.get('depth');
                 },
 
-                /**
+                /**
                  * Bubbles up the tree from this node, calling the specified function with each node. The arguments to the function
                  * will be the args provided or the current node. If the function returns false at any point,
                  * the bubble is stopped.
@@ -728,7 +748,7 @@ Ext.define('Ext.data.NodeInterface', {
                 },
                 //</deprecated>
 
-                /**
+                /**
                  * Cascades down the tree from this node, calling the specified function with each node. The arguments to the function
                  * will be the args provided or the current node. If the function returns false at any point,
                  * the cascade is stopped on that branch.
@@ -748,7 +768,7 @@ Ext.define('Ext.data.NodeInterface', {
                     }
                 },
 
-                /**
+                /**
                  * Interates the child nodes of this node, calling the specified function with each node. The arguments to the function
                  * will be the args provided or the current node. If the function returns false at any point,
                  * the iteration stops.
@@ -768,7 +788,7 @@ Ext.define('Ext.data.NodeInterface', {
                     }
                 },
 
-                /**
+                /**
                  * Finds the first child that has the attribute with the specified value.
                  * @param {String} attribute The attribute name
                  * @param {Mixed} value The value to search for
@@ -781,7 +801,7 @@ Ext.define('Ext.data.NodeInterface', {
                     }, null, deep);
                 },
 
-                /**
+                /**
                  * Finds the first child by a custom function. The child matches if the function passed returns <code>true</code>.
                  * @param {Function} fn A function which must return <code>true</code> if the passed Node is the required Node.
                  * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the Node being tested.
@@ -809,7 +829,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return null;
                 },
 
-                /**
+                /**
                  * Returns true if this node is an ancestor (at any point) of the passed node.
                  * @param {Node} node
                  * @return {Boolean}
@@ -818,7 +838,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return node.isAncestor(this);
                 },
 
-                /**
+                /**
                  * Returns true if the passed node is an ancestor (at any point) of this node.
                  * @param {Node} node
                  * @return {Boolean}
@@ -834,7 +854,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return false;
                 },
 
-                /**
+                /**
                  * Sorts this nodes children using the supplied sort function.
                  * @param {Function} fn A function which, when passed two Nodes, returns -1, 0 or 1 depending upon required sort order.
                  * @param {Boolean} recursive Whether or not to apply this sort recursively
@@ -871,7 +891,7 @@ Ext.define('Ext.data.NodeInterface', {
                     }
                 },
                         
-                /**
+                /**
                  * Returns true if this node is expaned
                  * @return {Boolean}
                  */        
@@ -879,7 +899,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return this.get('expanded');
                 },
                 
-                /**
+                /**
                  * Returns true if this node is loaded
                  * @return {Boolean}
                  */ 
@@ -887,7 +907,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return this.get('loaded');
                 },
 
-                /**
+                /**
                  * Returns true if this node is loading
                  * @return {Boolean}
                  */ 
@@ -895,7 +915,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return this.get('loading');
                 },
                                 
-                /**
+                /**
                  * Returns true if this node is the root node
                  * @return {Boolean}
                  */ 
@@ -903,7 +923,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return !this.parentNode;
                 },
                 
-                /**
+                /**
                  * Returns true if this node is visible
                  * @return {Boolean}
                  */ 
@@ -918,7 +938,7 @@ Ext.define('Ext.data.NodeInterface', {
                     return true;
                 },
                 
-                /**
+                /**
                  * Expand this node.
                  * @param {Function} recursive (Optional) True to recursively expand all the children
                  * @param {Function} callback (Optional) The function to execute once the expand completes
@@ -969,7 +989,7 @@ Ext.define('Ext.data.NodeInterface', {
                     }
                 },
                 
-                /**
+                /**
                  * Expand all the children of this node.
                  * @param {Function} recursive (Optional) True to recursively expand all the children
                  * @param {Function} callback (Optional) The function to execute once all the children are expanded
@@ -990,18 +1010,17 @@ Ext.define('Ext.data.NodeInterface', {
                             nodes[i].expand(recursive, function () {
                                 expanding--;
                                 if (callback && !expanding) {
-                                    Ext.callback(callback, scope || me, me.childNodes); 
+                                    Ext.callback(callback, scope || me, [me.childNodes]); 
                                 }
                             });                            
                         }
                     }
                     
                     if (!expanding && callback) {
-                        Ext.callback(callback, scope || me, me.childNodes);
-                    }
+                        Ext.callback(callback, scope || me, [me.childNodes]);                    }
                 },
 
-                /**
+                /**
                  * Collapse this node.
                  * @param {Function} recursive (Optional) True to recursively collapse all the children
                  * @param {Function} callback (Optional) The function to execute once the collapse completes
@@ -1034,11 +1053,11 @@ Ext.define('Ext.data.NodeInterface', {
                     }
                     // If it's not then we fire the callback right away
                     else {
-                        Ext.callback(callback, scope || me, me.childNodes); 
+                        Ext.callback(callback, scope || me, [me.childNodes]); 
                     }
                 },
                 
-                /**
+                /**
                  * Collapse all the children of this node.
                  * @param {Function} recursive (Optional) True to recursively collapse all the children
                  * @param {Function} callback (Optional) The function to execute once all the children are collapsed
@@ -1059,17 +1078,19 @@ Ext.define('Ext.data.NodeInterface', {
                             nodes[i].collapse(recursive, function () {
                                 collapsing--;
                                 if (callback && !collapsing) {
-                                    Ext.callback(callback, scope || me, me.childNodes); 
+                                    Ext.callback(callback, scope || me, [me.childNodes]); 
                                 }
                             });                            
                         }
                     }
                     
                     if (!collapsing && callback) {
-                        Ext.callback(callback, scope || me, me.childNodes);
+                        Ext.callback(callback, scope || me, [me.childNodes]);
                     }
                 }
             };
         }
     }
-});
\ No newline at end of file +});
+ +