A Patch for indenting DwtTreeItem nodes

Have a great idea for extending Zimbra? Share ideas, ask questions, contribute, and get feedback.
jpenguin
Posts: 5
Joined: Fri Sep 12, 2014 10:00 pm

A Patch for indenting DwtTreeItem nodes

Postby jpenguin » Tue Nov 15, 2005 6:55 pm

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
+ nodeCell = this._row.insertCell(i++);

+ nodeCell.style.width = nodeCell.style.height = DwtTreeItem._NODECELL_DIM;

+ nodeCell.align = "center";

+ nodeCell.noWrap = true;

+ }

this._nodeCell = nodeCell;


4338Chouser
Posts: 6
Joined: Fri Sep 12, 2014 9:56 pm

A Patch for indenting DwtTreeItem nodes

Postby 4338Chouser » Thu Nov 17, 2005 11:29 am

I had a similar problem, but I think adding this to my CSS will be sufficient:
.DwtTreeItemLevel1ChildDiv, .DwtTreeItemChildDiv {

margin-left: 1em;

}


--Chouser
jpenguin
Posts: 5
Joined: Fri Sep 12, 2014 10:00 pm

A Patch for indenting DwtTreeItem nodes

Postby jpenguin » Thu Nov 17, 2005 12:25 pm

[quote user="4338Chouser"]I had a similar problem, but I think adding this to my CSS will be sufficient:
.DwtTreeItemLevel1ChildDiv, .DwtTreeItemChildDiv {

margin-left: 1em;

}


--Chouser[/QUOTE]
Thanks. It worked for me too.
Heladito
Posts: 37
Joined: Fri Sep 12, 2014 9:59 pm

A Patch for indenting DwtTreeItem nodes

Postby Heladito » Fri Nov 18, 2005 4:56 am

What about some dots to clearly visually link a child node to its parent with a dotted line ?
Has anyone got something like that ?

Return to “Developers”

Who is online

Users browsing this forum: No registered users and 3 guests