Author: pyaschenko
Date: 2010-03-10 09:56:45 -0500 (Wed, 10 Mar 2010)
New Revision: 16548
Added:
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
Log:
client side library: unified api (BaseComponent)
Added:
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
===================================================================
---
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
(rev 0)
+++
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2010-03-10
14:56:45 UTC (rev 16548)
@@ -0,0 +1,46 @@
+(function (jQuery, richfaces, params) {
+
+ richfaces.blankFunction = function (){}; //TODO: add it to global library
+
+ richfaces.BaseComponent = function(componentId) {
+ this.id = componentId;
+ };
+
+ richfaces.BaseComponent.extend = function (Parent, Child) {
+ var F = richfaces.blankFunction;
+ F.prototype = Parent.prototype;
+ Child.prototype = new F();
+ Child.prototype.constructor = Child;
+ Child.$super = Parent.prototype;
+ return Parent.prototype;
+ }
+
+ jQuery.extend(richfaces.BaseComponent.prototype, (function (params) {
+ return {
+ name: "BaseComponent",
+ toString: function() {
+ var result = [];
+ if (this.constructor.$super) {
+ result[result.length] = this.constructor.$super.toString();
+ }
+ result[result.length] = this.name;
+ return result.join(', ');
+ }
+ };
+ })(params));
+
+})(jQuery, window.RichFaces || (window.RichFaces={}));
+/*
+(function (jQuery, richfaces, params) {
+
+ richfaces.MyComponent = function(componentId) {
+ $super.constructor.call(this);
+ };
+
+ var $super = richfaces.BaseComponent.extend(richfaces.BaseComponent,
richfaces.MyComponent);
+
+ jQuery.extend(richfaces.MyComponent.prototype, (function (params) {
+ return {name:"MyComponent", f:function (){alert("hello");}};
+ })(params));
+})(jQuery, RichFaces);
+*/
\ No newline at end of file
Show replies by date