Hi,

I wanted the children nodes to be indented with respect to their parents. So I inserted n blank NodeCells to the left of the node icon. Here n is tree node's depth. Here is the diff:

--- spc/server/web/docroot/js/ajax/dwt/widgets/DwtTreeItem.js (revision 304)
+++ spc/server/web/docroot/js/ajax/dwt/widgets/DwtTreeItem.js (working copy)
@@ -26,10 +26,14 @@
// NOTE: Where you see the word "deferred", think "uninitialized"
function DwtTreeItem(parent, index, text, imageInfo, deferred, className, posStyle) {

- if (parent instanceof DwtTree)
+ if (parent instanceof DwtTree) {
this._tree = parent;
- else if (parent instanceof DwtTreeItem)
+ this._depth = 1;
+ }
+ else if (parent instanceof DwtTreeItem) {
this._tree = parent._tree;
+ this._depth = parent._depth + 1;
+ }
else
throw new DwtException("DwtTreeItem parent must be a DwtTree or DwtTreeItem", DwtException.INVALIDPARENT, "DwtTreeItem");

@@ -277,10 +281,13 @@

this._row = this._table.insertRow(0);
var i = 0;
- nodeCell = this._row.insertCell(i++);
- nodeCell.style.width = nodeCell.style.height = DwtTreeItem._NODECELL_DIM;
- nodeCell.align = "center";
- nodeCell.noWrap = true;
+ // indent the tree item according to its nesting level
+ for (var pad = 0; pad < this._depth; pad++) {
+ nodeCell = this._row.insertCell(i++);
+ nodeCell.style.width = nodeCell.style.height = DwtTreeItem._NODECELL_DIM;
+ nodeCell.align = "center";
+ nodeCell.noWrap = true;
+ }
this._nodeCell = nodeCell;