📄 bitreedatamodel.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><!--Generated using api.website.xsl version 2003-07-17--><head><META http-equiv="Content-Type" content="text/html; charset=utf-8"><title>BiTreeDataModel</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link type="text/css" rel="stylesheet" href="api.css"><script type="text/javascript"> function showDerivedClasses() { var ul = document.getElementById("api-derived-classes"); var lis = ul.childNodes; var l = lis.length; for (var i = 1; i < l; i++) lis[i].style.display = ""; lis[0].style.display = "none"; } </script></head><body><h1 id="BiTreeDataModel">BiTreeDataModel</h1><p>This data model takes a a tree consisting of<code><a href="BiTreeNode2.html">BiTreeNode2</a></code> nodes and exposes the interface needed by the<code><a href="BiTreeView.html">BiTreeView</a></code>. The internal tree does not have to be a<code><a href="BiTreeNode2.html">BiTreeNode2</a></code> as long as getNodeChildren, getNodeHashCode, getCellText and getSortFunction (if sorting is needed) are overridden. The default implementation assumes that the data in the<code><a href="BiTreeNode2.html">BiTreeNode2</a></code> objects are arrays containing the cell data.</p><p>This class extends <code><a href="BiTreeViewDataModel.html">BiTreeViewDataModel</a></code> and therefore all methods and fields available for <code><a href="BiTreeViewDataModel.html">BiTreeViewDataModel</a></code> are also available for <code>BiTreeDataModel</code>.</p><ul class="partial-class-tree"><li><code><a href="BiObject.html">BiObject</a></code><ul><li><code><a href="BiEventTarget.html">BiEventTarget</a></code><ul><li><code><a href="BiTreeViewDataModel.html">BiTreeViewDataModel</a></code><ul><li><code>BiTreeDataModel</code><ul id="api-derived-classes"><li><code><a href="BiTree2DataModel.html">BiTree2DataModel</a></code></li></ul></li></ul></li></ul></li></ul></li></ul><h2>Constructor</h2><p><code> new BiTreeDataModel([<span class="methodArgument">oRootNode</span>])</code></p><h3>Parameters</h3><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>oRootNode</code></td><td><code class="type"> <code><a href="BiTreeNode2.html">BiTreeNode2</a></code> </code></td><td class="optional-column"><img src="check.png" alt="checked"></td><td></td><td>The optional node to act as the root for the data</td></tr></tbody></table><h2>Properties</h2><table><thead><tr><td>Name</td><td>Type</td><td class="get-header">get</td><td class="set-header">set</td><td>Descripton</td></tr></thead><tbody><tr><td><a name="rootNode"></a><code>rootNode</code></td><td><code class="type"> <code><a href="BiTreeNode2.html">BiTreeNode2</a></code> </code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"><img src="check.png" alt="checked"></td><td>The tree node that is the root of the data</td></tr></tbody></table><h2>Methods</h2><table><thead><tr><td>Name</td><td>Description</td></tr></thead><tbody><tr><td><code><a href="#getNodeAt">getNodeAt</a></code></td><td>This returns the node at the given row</td></tr><tr><td><code><a href="#getNodeChildren">getNodeChildren</a></code></td><td>This returns the children of the tree node that is the root of the data. This should be overridden if your nodes are not instances of<code><a href="BiTreeNode2.html">BiTreeNode2</a></code> </td></tr><tr><td><code><a href="#getNodeHashCode">getNodeHashCode</a></code></td><td>Returns a hash code for the node. It is useful to override this if you are building your own custom tree model that does not use<code><a href="BiTreeNode2.html">BiTreeNode2</a></code> as your tree nodes</td></tr><tr><td><code><a href="#insertRowAt">insertRowAt</a></code></td><td>inserts a new object into the tree rows</td></tr><tr><td><code><a href="#rebuildSubtree">rebuildSubtree</a></code></td><td>This removes all the nodes in the subtree and readds them, basically refreshing the tree. This also fires a rowcountchanged event so that the view is refreshed</td></tr><tr><td><code><a href="#removeRowAt">removeRowAt</a></code></td><td>Removes the row at the given row. This also removes any possible subtree of the node</td></tr></tbody></table><h2>Events</h2><table><thead><tr><td>Name</td><td>Type</td><td class="bubbles-header">Bubbles</td><td>Descripton</td></tr></thead><tbody><tr><td><a name="beforecollapse"></a><code>beforecollapse</code></td><td><code class="type"> <code><a href="BiTreeViewDataModelEvent.html">BiTreeViewDataModelEvent</a></code> </code></td><td class="bubbles-column"></td><td>This event is fired before a row is collapsed</td></tr><tr><td><a name="beforeexpand"></a><code>beforeexpand</code></td><td><code class="type"> <code><a href="BiTreeViewDataModelEvent.html">BiTreeViewDataModelEvent</a></code> </code></td><td class="bubbles-column"></td><td>This event is fired before a row is expanded</td></tr><tr><td><a name="collapse"></a><code>collapse</code></td><td><code class="type"> <code><a href="BiTreeViewDataModelEvent.html">BiTreeViewDataModelEvent</a></code> </code></td><td class="bubbles-column"></td><td>This event is fired when a row has collapsed</td></tr><tr><td><a name="datachanged"></a><code>datachanged</code></td><td><code class="type"> <code><a href="BiTreeViewDataModelEvent.html">BiTreeViewDataModelEvent</a></code> </code></td><td class="bubbles-column"></td><td>This event is fired when the data changes.</td></tr><tr><td><a name="expand"></a><code>expand</code></td><td><code class="type"> <code><a href="BiTreeViewDataModelEvent.html">BiTreeViewDataModelEvent</a></code> </code></td><td class="bubbles-column"></td><td>This event is fired when a row has expanded</td></tr><tr><td><a name="rowcountchanged"></a><code>rowcountchanged</code></td><td><code class="type"> <code><a href="BiTreeViewDataModelEvent.html">BiTreeViewDataModelEvent</a></code> </code></td><td class="bubbles-column"></td><td>This event is fired when the row count changes. The rowIndex and the rowCount properties on the event object are available for this event</td></tr></tbody></table><h2>Static Methods</h2><p>None.</p><h2>Static Fields</h2><p>None.</p><h2>Remarks</h2><p> </p><h2>Method Details</h2><h3><a name="getNodeAt"></a>getNodeAt</h3><p>This returns the node at the given row</p><h4>Syntax</h4><pre class="method-syntax">object.getNodeAt(<span class="methodArgument">y</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>y</code></td><td><code class="type">Number</code></td><td class="optional-column"></td><td></td><td>The index of the row</td></tr></tbody></table><h4>Return Type</h4><p><code class="type"> <code><a href="BiTreeNode2.html">BiTreeNode2</a></code> </code></p><h3><a name="getNodeChildren"></a>getNodeChildren</h3><p>This returns the children of the tree node that is the root of the data. This should be overridden if your nodes are not instances of<code><a href="BiTreeNode2.html">BiTreeNode2</a></code> </p><h4>Syntax</h4><pre class="method-syntax">object.getNodeChildren(<span class="methodArgument">oNode</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>oNode</code></td><td><code class="type"> <code><a href="BiTreeNode2.html">BiTreeNode2</a></code> </code></td><td class="optional-column"></td><td></td><td>The object that acts as the root node</td></tr></tbody></table><h4>Return Type</h4><p><code class="type"> <code><a href="BiTreeNode2.html">BiTreeNode2[]</a></code> </code></p><h3><a name="getNodeHashCode"></a>getNodeHashCode</h3><p>Returns a hash code for the node. It is useful to override this if you are building your own custom tree model that does not use<code><a href="BiTreeNode2.html">BiTreeNode2</a></code> as your tree nodes</p><h4>Syntax</h4><pre class="method-syntax">object.getNodeHashCode(<span class="methodArgument">oNode</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>oNode</code></td><td><code class="type"> <code><a href="BiTreeNode2.html">BiTreeNode2</a></code> </code></td><td class="optional-column"></td><td></td><td>The node to get the hash code for</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">String</code></p><h3><a name="insertRowAt"></a>insertRowAt</h3><p>inserts a new object into the tree rows</p><h4>Syntax</h4><pre class="method-syntax">object.insertRowAt(<span class="methodArgument">obj</span> [, <span class="methodArgument">nParentRowIndex</span> [, <span class="methodArgument">nChildIndex</span>]])</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>obj</code></td><td><code class="type"> <code><a href="BiTreeNode2.html">BiTreeNode2</a></code> </code></td><td class="optional-column"></td><td></td><td>The object describing the data</td></tr><tr><td><code>nParentRowIndex</code></td><td><code class="type">Number</code></td><td class="optional-column"><img src="check.png" alt="checked"></td><td></td><td>The index of the parent row. If this is null or -1 then the row is added to the implicit root.</td></tr><tr><td><code>nChildIndex</code></td><td><code class="type">Number</code></td><td class="optional-column"><img src="check.png" alt="checked"></td><td></td><td>The position of the new child. If left out then the new node is appended at the end.</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">void</code></p><h3><a name="rebuildSubtree"></a>rebuildSubtree</h3><p>This removes all the nodes in the subtree and readds them, basically refreshing the tree. This also fires a rowcountchanged event so that the view is refreshed</p><h4>Syntax</h4><pre class="method-syntax">object.rebuildSubtree(<span class="methodArgument">nIndex</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>nIndex</code></td><td><code class="type">Number</code></td><td class="optional-column"></td><td></td><td>The index of the node to refresh the subtree for</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">void</code></p><h3><a name="removeRowAt"></a>removeRowAt</h3><p>Removes the row at the given row. This also removes any possible subtree of the node</p><h4>Syntax</h4><pre class="method-syntax">object.removeRowAt(<span class="methodArgument">y</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>y</code></td><td><code class="type">Number</code></td><td class="optional-column"></td><td></td><td>the row to remove</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">void</code></p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -