|
From: <bor...@li...> - 2006-02-01 16:30:31
|
Author: gst...@bo...
Date: 2006-02-01 17:30:13 +0100 (Wed, 01 Feb 2006)
New Revision: 382
Modified:
trunk/Web/Controls/client_scripts/TreeView/TreeNode.js
Log:
* treeview: another few optimizations: update calls only applied where necessary
Modified: trunk/Web/Controls/client_scripts/TreeView/TreeNode.js
===================================================================
--- trunk/Web/Controls/client_scripts/TreeView/TreeNode.js 2006-02-01 14:30:22 UTC (rev 381)
+++ trunk/Web/Controls/client_scripts/TreeView/TreeNode.js 2006-02-01 16:30:13 UTC (rev 382)
@@ -183,7 +183,7 @@
* Render the node and if open all subnodes
*/
this.Render = function() {
-
+
var allContainer = self.GetContainer();
GetParentContainer().appendChild( allContainer );
@@ -203,17 +203,17 @@
// append: indentContainer to nodecontainer
var indentsContainer = GetIndentsContainer();
nodeContainer.appendChild( indentsContainer );
- FillIndentsContainer();
+ FillIndentsContainer( indentsContainer );
// append: fork to nodecontainer
var forkImageContainer = GetForkImageContainer();
nodeContainer.appendChild( forkImageContainer );
- FillForkImageContainer();
+ FillForkImageContainer( forkImageContainer );
// append: content to nodecontainer
var contentContainer = GetContentContainer();
nodeContainer.appendChild( contentContainer );
- FillContentContainer();
+ FillContentContainer( contentContainer );
if ( self.IsRootFolder() && ! self.GetTreeView().GetDisplayRootFolder() ) {
nodeContainer.style.display = "none";
@@ -410,19 +410,19 @@
if ( prog == null ) {
_origCaption = self.GetCaption();
self.SetCaption("Loading ...");
- self.UpdateNode();
+ UpdateForkIcon();
window.setTimeout( DynLoadSubnodes, 0 ); // Use settiomeout to allow gui update e.g. showing Loading... message
return;
} else {
self.SetOpen( false );
- self.UpdateNode();
+ UpdateForkIcon();
}
} else {
CreateChildNodes();
self.SetOpen( true );
self.GetSubNodesContainer().style.display = "block";
- self.UpdateNode();
+ UpdateForkIcon();
}
}
@@ -585,16 +585,14 @@
return contentContainer;
}
- function FillContentContainer() {
+ function FillContentContainer( contentContainer ) {
- var contentContainer = GetContentContainer();
-
if ( self.GetIconFile() != null ) {
contentContainer.appendChild( GetImageElement() );
}
var textSpan = GetTextSpan();
- FillTextSpan();
+ FillTextSpan( textSpan );
contentContainer.appendChild( textSpan );
}
@@ -639,13 +637,15 @@
return textSpan;
}
- function FillTextSpan() {
- var textSpan = GetTextSpan();
+ function FillTextSpan( textSpan ) {
+ var caption = self.GetCaption();
- if ( self.GetCaption() != null ) {
+ if ( caption != null ) {
textSpan.appendChild( document.createTextNode( self.GetCaption() ) );
+ //textSpan.textContent = self.GetCaption();
} else {
- textSpan.appendChild( document.createTextNode( "" ) );
+ textSpan.appendChild( document.createTextNode( self.GetCaption() ) );
+ //textSpan.textContent = self.GetCaption();
}
}
@@ -735,8 +735,7 @@
/*
* Fill indent container
*/
- function FillIndentsContainer() {
- var cont = GetIndentsContainer();
+ function FillIndentsContainer( cont ) {
var level = self.GetLevel();
var linesDir = self.GetTreeView().GetLinesDir();
@@ -795,8 +794,8 @@
/*
* Fill fork Icon image container
*/
- function FillForkImageContainer() {
- GetForkImageContainer().appendChild( document.createElement( "img" ) );
+ function FillForkImageContainer( forkImageContainer ) {
+ forkImageContainer.appendChild( document.createElement( "img" ) );
}
function ClearForkImageContainer() {
@@ -811,7 +810,6 @@
}
}
-
/*
* Render Child Nodes
*/
@@ -858,7 +856,7 @@
var textSpan = GetTextSpan();
EmptyContainer( textSpan );
- FillTextSpan();
+ FillTextSpan( textSpan );
}
/*
@@ -1283,9 +1281,10 @@
* (Recursively) update indents, needed after DnD
*/
this.UpdateIndents = function( recursive ) {
+ var indentsContainer = GetIndentsContainer();
- EmptyContainer( GetIndentsContainer() ); // empty indent container
- FillIndentsContainer(); // fill it again with new content
+ EmptyContainer( indentsContainer ); // empty indent container
+ FillIndentsContainer( indentsContainer ); // fill it again with new content
if ( recursive ) { // if told to do so, tell my childs
var len = self.Nodes.length;
@@ -1337,7 +1336,6 @@
self.SetSelected( true );
self.GetTreeView().SetSelectedNode( self );
- self.GetTreeView().GetRootNode().UpdateNode( true );
if ( self.GetNodeSelectedMethod() != null ) {
if ( typeof( self.GetNodeSelectedMethod() ) == 'function' ) {
|