summaryrefslogtreecommitdiff
path: root/webapps/qooxdoo-0.6.5-sdk/frontend/framework
diff options
context:
space:
mode:
authorDerrell Lipman <derrell@samba.org>2007-02-13 20:35:48 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:48:10 -0500
commitad2f5649ddc5c172cb4c1670563ac1c8adfee00d (patch)
treecadb565d30e46816be22a2733f909c24c2923a34 /webapps/qooxdoo-0.6.5-sdk/frontend/framework
parent1f2b94b7b7e46a9e17ab4519dfa0140c88248c36 (diff)
downloadsamba-ad2f5649ddc5c172cb4c1670563ac1c8adfee00d.tar.gz
samba-ad2f5649ddc5c172cb4c1670563ac1c8adfee00d.tar.bz2
samba-ad2f5649ddc5c172cb4c1670563ac1c8adfee00d.zip
r21321: - Allow pruning all of the children of a node without removing the node
itself. - By default, create only one meta column if only the tree is displayed. If additional columns are displayed, then put all of them in a separate meta column, and the tree in the first meta column by itself. (This used to be commit 6c86cd416b64e97071f6bbd2d63f33a950a28ec0)
Diffstat (limited to 'webapps/qooxdoo-0.6.5-sdk/frontend/framework')
-rw-r--r--webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/treevirtual/SimpleTreeDataModel.js39
-rw-r--r--webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/treevirtual/TreeVirtual.js2
2 files changed, 24 insertions, 17 deletions
diff --git a/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/treevirtual/SimpleTreeDataModel.js b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/treevirtual/SimpleTreeDataModel.js
index f9ff3a9758..875eeea6ec 100644
--- a/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/treevirtual/SimpleTreeDataModel.js
+++ b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/treevirtual/SimpleTreeDataModel.js
@@ -405,35 +405,42 @@ qx.Proto.addLeaf = function(parentNodeId,
/**
- * Prune the tree by removing the specified node, and, if the node has
- * children, recursively all of its children.
+ * Prune the tree by removing, recursively, all of a node's children. If
+ * requested, also remove the node itself.
*
* @param nodeId {Integer}
* The node id, previously returned by {@link #addLeaf} or {@link
* #addBranch}, of the node (and its children) to be pruned from the tree.
+ *
+ * @param bSelfAlso {Boolean}
+ * If <i>true</i> then remove the node identified by <i>nodeId</i> as well
+ * as all of the children.
*/
-qx.Proto.prune = function(nodeId)
+qx.Proto.prune = function(nodeId, bSelfAlso)
{
// First, recursively remove all children
for (var i = 0; i < this._nodeArr[nodeId].children.length; i++)
{
- this.prune(this._nodeArr[nodeId].children[i]);
+ this.prune(this._nodeArr[nodeId].children[i], true);
}
- // Delete ourself from our parent's children list
- var node = this._nodeArr[nodeId];
- qx.lang.Array.remove(this._nodeArr[node.parentNodeId].children, nodeId);
-
- // Delete ourself from the selections list, if we're in it.
- if (this._selections[nodeId])
+ if (bSelfAlso)
{
- delete this._selections[nodeId];
- }
+ // Delete ourself from our parent's children list
+ var node = this._nodeArr[nodeId];
+ qx.lang.Array.remove(this._nodeArr[node.parentNodeId].children, nodeId);
- // We can't splice the node itself out, because that would muck up the
- // nodeId == index correspondence. Instead, just replace the node with
- // null so its index just becomes unused.
- this._nodeArr[nodeId] = null;
+ // Delete ourself from the selections list, if we're in it.
+ if (this._selections[nodeId])
+ {
+ delete this._selections[nodeId];
+ }
+
+ // We can't splice the node itself out, because that would muck up the
+ // nodeId == index correspondence. Instead, just replace the node with
+ // null so its index just becomes unused.
+ this._nodeArr[nodeId] = null;
+ }
};
diff --git a/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/treevirtual/TreeVirtual.js b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/treevirtual/TreeVirtual.js
index c32cb15f25..3b7df7d4ca 100644
--- a/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/treevirtual/TreeVirtual.js
+++ b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/treevirtual/TreeVirtual.js
@@ -71,7 +71,7 @@ function(headings)
// Set sizes
this.setRowHeight(16);
- this.setMetaColumnCounts([1, -1]);
+ this.setMetaColumnCounts(headings.length > 1 ? [ 1, -1 ] : [ 1 ]);
// Set the data cell render. We use the SimpleTreeDataCellRenderer for the
// tree column, and our DefaultDataCellRenderer for all other columns.