Scarab commit: svn commit: r10833 - trunk/src/webapp/scripts
Hussayn Dabbous <[email protected]>
| Newsgroups | gmane.comp.java.scarab.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: dabbous
Date: 2009-07-24 01:23:07-0700
New Revision: 10833
Modified:
trunk/src/webapp/scripts/scarabutil.js
trunk/src/webapp/scripts/sstree.js
Log:
SCB2979 :
- Now the TreeView Attributes fully support the javascript observer introduced recently.
That means, when a page renders, all treeview states are published to all observers
during page initialisation, so the dynamic javascript functions know which data is
currently on the screen and can react accordingly.
Before the methods have only been called when a treeview optionValue was modified
on the screen. thus they did not know about the issues attribute values until they
where called the first time. Now this first time call is forced upon initialisation.
Modified: trunk/src/webapp/scripts/scarabutil.js
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/webapp/scripts/scarabutil.js?view=diff&pathrev=10833&r1=10832&r2=10833
==============================================================================
--- trunk/src/webapp/scripts/scarabutil.js (original)
+++ trunk/src/webapp/scripts/scarabutil.js 2009-07-24 01:23:07-0700
@@ -6,7 +6,7 @@
}
function getCookieScarableftNav() {
var cookie = document.cookie;
- tag = cookie.indexOf("ScarableftNav=");
+ var tag = cookie.indexOf("ScarableftNav=");
return cookie.substring(tag + 14, tag + 15)
}
@@ -27,7 +27,7 @@
}
function getCookieBanner() {
var cookie = document.cookie;
- tag = cookie.indexOf("Banner=");
+ var tag = cookie.indexOf("Banner=");
return cookie.substring(tag + 7, tag + 8)
}
function hideBanner() {
@@ -50,9 +50,10 @@
}
}
-function setLeftcolAndBanner() {
- setLeftcol()
- setBanner()
+function setLeftcolAndBanner()
+{
+ setLeftcol();
+ setBanner();
}
@@ -118,14 +119,30 @@
}
}
-function initializeTreeview() {
+function initializeTreeview()
+{
collapseAll(["ol"]);
//openBookMark();
buttonEndings("button");
- buttonEndings("button3");
- buttonEndings("buttonNotify");
- buttonEndings("buttonPassive");
- buttonEndings("buttonActive");
+ //buttonEndings("button3");
+ //buttonEndings("buttonNotify");
+ //buttonEndings("buttonPassive");
+ //buttonEndings("buttonActive");
+
+ if (treeviewInit != null)
+ {
+ var len = treeviewInit.length;
+ var counter = 0;
+ for(counter=0; counter < len; counter++)
+ {
+ // For each TreeView call the click Handler so that all
+ // observers are notified about the tree view's startup optionValue
+ treeviewInit[counter]();
+ }
+ }
+
+
+
}
Modified: trunk/src/webapp/scripts/sstree.js
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/webapp/scripts/sstree.js?view=diff&pathrev=10833&r1=10832&r2=10833
==============================================================================
--- trunk/src/webapp/scripts/sstree.js (original)
+++ trunk/src/webapp/scripts/sstree.js 2009-07-24 01:23:07-0700
@@ -28,7 +28,9 @@
}
}
-function collapseAll(tags) {
+function collapseAll(tags)
+{
+ var i=0;
for (i = 0; i < tags.length; i++) {
var lists = getElementsByClassName(document, tags[i], "treeview");
for (var j = 0; j < lists.length; j++)
@@ -62,6 +64,7 @@
strClassName = strClassName.replace(/\-/g, "\\-");
var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
var oElement;
+ var i=0;
for(var i=0; i<arrElements.length; i++){
oElement = arrElements[i];
if(oRegExp.test(oElement.className)){
@@ -77,16 +80,19 @@
for (var i = 0; i < root._children.length; i++) {
renderJSONTree(root.name, key, value, root._children[i], imgpath);
}
- document.writeln('</ol></div>');
+ document.writeln('</ol></div>');
}
+var treeviewInit = [];
-function renderJSONTree(attributeId, key, value, root, imgpath) {
- if (root.optionId == value) {
+function renderJSONTree(attributeId, key, value, root, imgpath)
+{
+ if (root.optionId == value)
+ {
document.getElementById(key + ':Display').value = root.displayValue;
- //var data = ["treeview",attributeId, null, null, root.displayValue];
- //observer.fire(data);
- }
+ var data = function(){clickTree(attributeId,key,value,root.displayValue)};
+ treeviewInit.push(data);
+ }
if (root._children.length > 0) {
document.writeln('<li>');
@@ -189,17 +195,15 @@
var observer = new Observer;
function clickTree(attributeId, key, value, display) {
-
- //alert(attributeId);
-
document.getElementById(key).value = value;
document.getElementById(key + ':Display').value = display;
-
var elem = document.getElementById(key + ':Popup');
elem.style.display = 'none';
- document.onmouseup = elem.oldMouseup;
-
- scope = ["treeview", attributeId, key, value, display];
+ if(elem.oldMouseup != undefined)
+ {
+ document.onmouseup = elem.oldMouseup;
+ }
+ var scope = ["treeview", attributeId, key, value, display];
observer.fire(scope);
}
------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=3577&dsMessageId=2375117