Author: pyaschenko
Date: 2010-12-03 11:53:35 -0500 (Fri, 03 Dec 2010)
New Revision: 20370
Modified:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/collapsible-subtable.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
Log:
http://jira.jboss.com/jira/browse/RF-9858
iteration components code refactoring
Modified:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/collapsible-subtable.js
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/collapsible-subtable.js 2010-12-03
16:44:29 UTC (rev 20369)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/collapsible-subtable.js 2010-12-03
16:53:35 UTC (rev 20370)
@@ -10,8 +10,7 @@
this.eventOptions = options.eventOptions;
this.formId = f;
- $super.constructor.call(this, id);
- this.attachToDom(id);
+ this.attachToDom();
};
$.extend(richfaces.ui.CollapsibleSubTable, {
@@ -20,12 +19,11 @@
MODE_CLNT: "client",
collapse: 0,
expand: 1
- })
-
- var $super = richfaces.BaseComponent.extend(richfaces.ui.CollapsibleSubTable);
- var $p = richfaces.BaseComponent.extend(richfaces.ui.CollapsibleSubTable, {});
- var $super = richfaces.ui.CollapsibleSubTable.$super;
+ });
+ richfaces.BaseComponent.extend(richfaces.ui.CollapsibleSubTable);
+ var $super = richfaces.ui.CollapsibleSubTable.$super;
+
$.extend(richfaces.ui.CollapsibleSubTable.prototype, (function () {
var element = function() {
@@ -62,7 +60,7 @@
return {
- name: "RichFaces.ui.CollapsibleSubTable",
+ name: "CollapsibleSubTable",
toggle: function(e, options) {
if(this.expandMode == richfaces.ui.CollapsibleSubTable.MODE_AJAX) {
@@ -107,7 +105,11 @@
getMode: function() {
return this.expandMode;
- }
+ },
+ destroy: function() {
+ this.detach();
+ $super.destroy.call(this);
+ }
};
})());
Modified:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js 2010-12-03
16:44:29 UTC (rev 20369)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js 2010-12-03
16:53:35 UTC (rev 20370)
@@ -52,9 +52,9 @@
richfaces.ui.DataScroller = function(id, submit, options) {
- $super.constructor.call(this,id);
+ $super.constructor.call(this, id);
- this.attachToDom(id);
+ this.attachToDom();
this.options = options;
this.currentPage = options.currentPage;
@@ -92,8 +92,7 @@
}
};
- var $super = richfaces.BaseComponent.extend(richfaces.ui.DataScroller);
- var $p = richfaces.BaseComponent.extend(richfaces.ui.DataScroller, {});
+ richfaces.BaseComponent.extend(richfaces.ui.DataScroller);
var $super = richfaces.ui.DataScroller.$super;
$.extend(richfaces.ui.DataScroller.prototype, (function (options) {
@@ -159,7 +158,11 @@
getScrollEventName: function() {
return scrollEventName;
- }
+ },
+ destroy: function() {
+ this.detach();
+ $super.destroy.call(this);
+ }
}
})());
Modified:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js 2010-12-03
16:44:29 UTC (rev 20369)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js 2010-12-03
16:53:35 UTC (rev 20370)
@@ -3,15 +3,13 @@
richfaces.ui = richfaces.ui || {};
richfaces.ui.DataTable = function(id, options) {
- this.id = id;
- this.options = options;
$super.constructor.call(this,id);
- this.attachToDom(id);
+ this.options = $.extend(this.options, options || {});
+ this.attachToDom();
};
- var $super = richfaces.BaseComponent.extend(richfaces.ui.DataTable);
- var $p = richfaces.BaseComponent.extend(richfaces.ui.DataTable, {});
+ richfaces.BaseComponent.extend(richfaces.ui.DataTable);
var $super = richfaces.ui.DataTable.$super;
$.extend(richfaces.ui.DataTable, {
@@ -96,7 +94,11 @@
func.call(component);
}
}
- }
+ },
+ destroy: function() {
+ this.detach();
+ $super.destroy.call(this);
+ }
}
})());
Modified:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-12-03
16:44:29 UTC (rev 20369)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-12-03
16:53:35 UTC (rev 20370)
@@ -40,7 +40,8 @@
name: "TreeNode",
init: function (id, commonOptions) {
- this.__rootElt = $(this.attachToDom(id));
+ $superTreeNode.constructor.call(this, id);
+ this.__rootElt = $(this.attachToDom());
this.__children = new Array();
@@ -60,7 +61,6 @@
},
destroy: function() {
- richfaces.BaseComponent.prototype.destroy.call(this);
if (this.parent) {
this.parent.removeChild(this);
@@ -72,6 +72,9 @@
this.__clearChildren();
this.__rootElt = null;
+
+ this.detach();
+ $superTreeNode.destroy.call(this);
},
__initializeChildren: function(commonOptions) {
@@ -254,6 +257,9 @@
});
+ // define super class link for TreeNode
+ var $superTreeNode = richfaces.ui.TreeNode.$super;
+
richfaces.ui.TreeNode.initNodeByAjax = function(nodeId, commonOptions) {
var node = $(document.getElementById(nodeId));
@@ -303,7 +309,7 @@
commonOptions.clientEventHandlers = options.clientEventHandlers || {};
commonOptions.treeId = id;
- this.$super.init.call(this, this.__treeRootElt, commonOptions);
+ $superTree.constructor.call(this, this.__treeRootElt, commonOptions);
this.__toggleType = options.toggleType || 'ajax';
this.__selectionType = options.selectionType || 'client';
@@ -355,6 +361,7 @@
this.__selectionInput = null;
this.__ajaxSubmitFunction = null;
+ $superTree.destroy.call(this);
},
__nodeToggleActivated: function(event) {
@@ -462,6 +469,9 @@
}
});
+ // define super class link for Tree
+ var $superTree = richfaces.ui.Tree.$super;
+
richfaces.ui.TreeNodeSet = function() {
this.init.apply(this, arguments);
};