Author: nbelaevski
Date: 2008-01-07 14:54:55 -0500 (Mon, 07 Jan 2008)
New Revision: 5161
Modified:
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/SelectItem.js
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ShuttleUtils.js
Log:
http://jira.jboss.com/jira/browse/RF-1841
Modified:
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js
===================================================================
---
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js 2008-01-07
19:54:46 UTC (rev 5160)
+++
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js 2008-01-07
19:54:55 UTC (rev 5161)
@@ -4,13 +4,7 @@
this.headerDiv = (this.headerTable) ? this.headerTable.parentNode : null;
this.contentDiv = this.contentTable.parentNode;
- var obj = this;
- if (window.attachEvent) {
- this.contentDiv.attachEvent("onscroll", function()
{obj.scrollHandler(obj)});
- } else {
- this.contentDiv.addEventListener("scroll", function()
{obj.scrollHandler(obj)}, true);
- }
-
+ Event.observe(this.contentDiv, "scroll",
this.scrollHandler.bindAsEventListener(this));
}
LayoutManager.SCROLL_WIDTH = 17;
@@ -52,9 +46,9 @@
return 0;
}
-LayoutManager.prototype.scrollHandler = function(obj) {
- if (obj.headerDiv) {
- obj.headerDiv.scrollLeft = obj.contentDiv.scrollLeft;
+LayoutManager.prototype.scrollHandler = function() {
+ if (this.headerDiv) {
+ this.headerDiv.scrollLeft = this.contentDiv.scrollLeft;
}
}
Modified:
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js
===================================================================
---
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js 2008-01-07
19:54:46 UTC (rev 5160)
+++
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js 2008-01-07
19:54:55 UTC (rev 5161)
@@ -1,19 +1,18 @@
if(!window.Richfaces) window.Richfaces = {};
-Richfaces.disableSelectionText = function(target) {
- target.onselectstart = function(e) {
- e = window.event||e;
- if (e.srcElement) {
- if (e.srcElement.tagName) {
- var tagName = e.srcElement.tagName.toUpperCase();
-
- if (tagName != "INPUT" && tagName != "TEXTAREA" /* any
items more? */) {
- return false;
- }
+Richfaces.disableSelectionText = function(e) {
+ e = window.event||e;
+ if (e.srcElement) {
+ if (e.srcElement.tagName) {
+ var tagName = e.srcElement.tagName.toUpperCase();
+
+ if (tagName != "INPUT" && tagName != "TEXTAREA" /* any
items more? */) {
+ return false;
}
}
}
-}
+};
+
Richfaces.ListBase = Class.create();
Richfaces.ListBase.compare = function(obj1, obj2) {
@@ -39,7 +38,7 @@
//this.layoutManager = layoutManager;
this.container = $(containerId);
this.shuttleTable = $(contentTableId);
- Richfaces.disableSelectionText(this.shuttleTable);
+ this.shuttleTable.onselectstart = Richfaces.disableSelectionText;
this.focusKeeper = $(focusKeeperId);
this.focusKeeper.focused = false;
//this.setFocus();
@@ -65,6 +64,14 @@
this.shuttleTable.observe("click", this.clckHandler);
},
+ destroy: function() {
+ this.shuttleTable.onselectstart = null;
+ var items = this.shuttleItems;
+ for (var i = 0; i < items.length; i++) {
+ items[i].destroy();
+ }
+ },
+
setActiveItem : function(newActiveItem) {
this.pseudoActiveItem = newActiveItem;
this.activeItem = newActiveItem;
Modified:
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
===================================================================
---
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2008-01-07
19:54:46 UTC (rev 5160)
+++
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2008-01-07
19:54:55 UTC (rev 5161)
@@ -23,12 +23,20 @@
initialize: function($super, containerId, contentTableId, headerTableId, focusKeeperId,
ids, onclickControlId, onorderchanged, controlClass, columnsClasses, rowClasses) {
$super(containerId, contentTableId, headerTableId, focusKeeperId, onclickControlId,
controlClass, columnsClasses, rowClasses);
+ this.container.component = this;
+
if (onorderchanged) {
this.container.observe("rich:onorderchanged", onorderchanged);
}
this.controlList = new Array();
this.initControlList(containerId, ids);
},
+
+ destroy: function($super) {
+ $super();
+
+ this.container.component = null;
+ },
initControlList : function(containerId, ids) {
for (var i = 0; i < ids.length; i++) {
Modified:
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/SelectItem.js
===================================================================
---
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/SelectItem.js 2008-01-07
19:54:46 UTC (rev 5160)
+++
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/SelectItem.js 2008-01-07
19:54:55 UTC (rev 5161)
@@ -28,6 +28,10 @@
this.active = /^s?a/.test(this.input.value);
},
+ destroy: function() {
+ this._node.item = null;
+ },
+
doActive : function(rowStoredClass, cellStoredClasses) {
var classes = this.CLASSES;
var row = this._node;
Modified:
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ShuttleUtils.js
===================================================================
---
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ShuttleUtils.js 2008-01-07
19:54:46 UTC (rev 5160)
+++
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ShuttleUtils.js 2008-01-07
19:54:55 UTC (rev 5161)
@@ -1,26 +1,48 @@
Object.extend(Event, {
- _domReady : function() {
- if (arguments.callee.done) return;
- arguments.callee.done = true;
- if (Event._timer) clearInterval(Event._timer);
- Event._readyCallbacks.each(function(f) { f() });
- Event._readyCallbacks = null;
- },
+ _domReady : function() {
+ var domReady = arguments.callee
+ if (!domReady.done) {
+ domReady.done = true;
+
+ Event._readyCallbacks.each(function(f) { f() });
+ Event._readyCallbacks = null;
+
+ if (Event._timer) {
+ clearInterval(Event._timer);
+ }
+
+ if (document.removeEventListener) {
+ document.removeEventListener("DOMContentLoaded", domReady, false);
+ }
+
+ Event.stopObserving(window, 'load', domReady);
+ }
+ },
+
onReady : function(f) {
+ var domReady = this._domReady;
+ if (domReady.done) {
+ return f();
+ }
+
if (!this._readyCallbacks) {
- var domReady = this._domReady;
- if (domReady.done) return f();
- if (document.addEventListener)
- document.addEventListener("DOMContentLoaded", domReady, false);
+
+ this._readyCallbacks = [];
+
+ if (document.addEventListener) {
+ document.addEventListener("DOMContentLoaded", domReady, false);
+ }
+
if (/WebKit/i.test(navigator.userAgent)) {
this._timer = setInterval(function() {
if (/loaded|complete/.test(document.readyState)) domReady();
}, 10);
}
- Event.observe(window, 'load', domReady);
- Event._readyCallbacks = [];
+
+ this.observe(window, 'load', domReady);
}
- Event._readyCallbacks.push(f);
+
+ this._readyCallbacks.push(f);
}
});