[limb-svn] r5801 - 3.x/trunk/limb/js/shared

svn at limb-project.com svn at limb-project.com
Fri May 4 14:20:17 MSD 2007


Author: pachanga
Date: 2007-05-04 14:20:17 +0400 (Fri, 04 May 2007)
New Revision: 5801
URL: http://fisheye.limb-project.com/changelog/limb/?cs=5801

Added:
   3.x/trunk/limb/js/shared/limb.js
   3.x/trunk/limb/js/shared/limb/
Removed:
   3.x/trunk/limb/js/shared/Limb.js
   3.x/trunk/limb/js/shared/Limb/
Log:
-- temp commit: Limb.js => limb.js, Limb => limb

Deleted: 3.x/trunk/limb/js/shared/Limb.js
===================================================================
--- 3.x/trunk/limb/js/shared/Limb.js	2007-05-04 10:16:28 UTC (rev 5800)
+++ 3.x/trunk/limb/js/shared/Limb.js	2007-05-04 10:20:17 UTC (rev 5801)
@@ -1,340 +0,0 @@
-/**
- * Limb Web Application Framework
- *
- * @link http://limb-project.com
- *
- * @copyright  Copyright © 2004-2007 BIT
- * @license    LGPL http://www.gnu.org/copyleft/lesser.html
- * @version    $Id$
- * @package    js
- */
-
-if(Limb == undefined) var Limb = {};
-
-String.prototype.trim = function()
-{
-  var r=/^\s+|\s+$/;
-  return this.replace(r,'');
-}
-
-if(!Function.prototype.bind)
-{
-  Function.prototype.bind = function(object)
-  {
-    var __method = this;
-    return function() {__method.apply( object, arguments );};
-  };
-}
-
-if(!Function.prototype.bindAsEventListener)
-{
-  Function.prototype.bindAsEventListener = function(object)
-  {
-    var __method = this;
-    return function(event) {__method.call(object, event || window.event);};
-  };
-}
-
-Limb.Exception = function()
-{
-  if(arguments.length == 1 && Limb.isObject(arguments[0]))
-  {
-    this.type = arguments[0].type || 'LimbException';
-    this.message = arguments[0].message;
-    this.stack = arguments[0].stack || 'Stack is not available';
-    this.file_name = arguments[0].fileName || 'File name is not available';
-    this.line_number = arguments[0].lineNumber || 'Line number is not available';
-  }
-  else
-  {
-    this.type = arguments[0] || 'LimbException';
-    this.message = arguments[1] || 'Unknown error';
-    if(typeof(arguments[2]) == 'object')
-    {
-      this.stack = arguments[2].stack || e.stack;
-      this.file_name = arguments[2].fileName || e.fileName;
-      this.line_number = arguments[2].lineNumber || e.lineNumber;
-    }
-    else
-    {
-      this.stack = 'Stack is not available';
-      this.file_name = 'File name is not available';
-      this.line_number = 'Line number is not available';
-    }
-  }
-}
-
-Limb.Exception.prototype =
-{
-  getMessage: function()
-  {
-    return this.message;
-  },
-
-  getType: function()
-  {
-    return this.type;
-  },
-
-  getStack: function()
-  {
-    return this.stack;
-  },
-
-  getFileName: function()
-  {
-    return this.file_name;
-  },
-
-  getLineNumber: function()
-  {
-    return this.line_number;
-  },
-
-  toString: function()
-  {
-    return '[ exception ' + this.type + ' ]';
-  }
-}
-
-Limb.define = function(name, value)
-{
-  var parts = name.split('.');
-  var var_name = parts.pop();
-
-  var namespace = Limb.namespace(parts.join('.'));
-  namespace[var_name] = value;
-}
-
-Limb.namespace = function(name)
-{
-  var parts = name.split('.');
-  var parent = window;
-  for(var i=0; i<parts.length; i++)
-  {
-    if(!parts[i])
-      continue;
-
-    if(!parent[parts[i]])
-      parent[parts[i]] = {};
-
-    parent = parent[parts[i]];
-  }
-
-  return parent;
-}
-
-Limb.require = function(package_name)
-{
-  //no working function for now. It needs to be written from the scratch or may be ported from 2.x
-}
-
-Limb.isset = function(variable)
-{
-  return typeof(variable) != 'undefined' && variable != null;
-}
-
-Limb.isObject = function(variable)
-{
-  return typeof(variable) == 'object';
-}
-
-Limb.isFunction = function(variable)
-{
-  return typeof(variable) == 'function';
-}
-
-Limb.namespace('Limb.Classkit');
-
-Limb.Classkit.createClass = function(body)
-{
-  var new_class = function()
-  {
-    if(Limb.isFunction(this['parent']))
-      this.parent = Limb.Classkit.makeParentProxy(this, this.parent);
-
-    this.__construct.apply(this, arguments);
-  }
-
-  new_class.toString = Limb.Classkit.classToString;
-
-  Limb.Classkit.inherit(new_class, Limb.Object, body);
-
-  return new_class;
-}
-
-Limb.Classkit.createInterface = function(body)
-{
-  var new_interface = function()
-  {
-    throw new Limb.Exception('InterfaceException', 'Can not create instance of interface');
-  }
-
-  new_interface.toString = Limb.Classkit.interfaceToString;
-
-  Limb.Classkit.extendInterface(new_interface, body || null);
-
-  return new_interface;
-}
-
-Limb.Classkit.clone = function(target, source)
-{
-  for(var i in source)
-  {
-    if(Limb.isObject(source[i]) || i == 'NAME')
-      continue;
-
-    target[i] = source[i];
-  }
-}
-
-Limb.Classkit.makeParentProxy = function(child_class, parent_class)
-{
-  var proxy = new Object();
-  proxy['NAME'] = parent.NAME;
-
-  var parent_instance = new parent_class();
-
-  for(var method in parent_instance)
-  {
-    if(!Limb.isFunction(parent_instance[method]))
-      continue;
-
-    proxy[method] = Limb.Classkit.parentMethodWrapper(child_class, parent_instance, method);
-  }
-
-  return proxy;
-}
-
-Limb.Classkit.inherit = function(child_class, parent_class, child_body)
-{
-  Limb.Classkit.clone(child_class, parent_class);
-  Limb.Classkit.clone(child_class.prototype, parent_class.prototype);
-
-  if(Limb.isFunction(parent_class))
-    child_class.prototype.parent = parent_class;
-
-  if(Limb.isset(child_body))
-    Limb.Classkit.extendClass(child_class, child_body);
-}
-
-Limb.Classkit.implement = function(class_ref, interface_ref, class_body)
-{
-  if(Limb.isset(class_body))
-    Limb.Classkit.extendClass(class_ref, class_body);
-
-  Limb.Classkit.checkInterfaceImplementation(class_ref, interface_ref);
-}
-
-Limb.Classkit.extendClass = function(class_ref, class_body)
-{
-  Limb.Classkit.clone(class_ref.prototype, class_body);
-
-  if(Limb.isObject(class_body['static']))
-    Limb.Classkit.clone(class_ref, class_body['static']);
-}
-
-Limb.Classkit.checkInterfaceImplementation = function(child_class, interface_ref)
-{
-  for(var method in interface_ref)
-  {
-    if(!Limb.isFunction(interface_ref[method]))
-      continue;
-
-    if(!Limb.isFunction(child_class.prototype[method]) && !Limb.isFunction(child_class[method]))
-      throw new Limb.Exception('InterfaceException', "Method '" + method + "' not implemented");
-  }
-}
-
-Limb.Classkit.extendInterface = function(interface_ref, body)
-{
-  if(!Limb.isObject(body))
-    return;
-
-  for(var method in body)
-  {
-    if(!Limb.isFunction(body[method]))
-      continue;
-
-    interface_ref[method] = Limb.Classkit.interfaceMethodPrototype;
-  }
-}
-
-Limb.Classkit.parentMethodWrapper = function(child_class_ref, parent_class_ref, method)
-{
-  return function()
-  {
-    return parent_class_ref[method].apply(child_class_ref, arguments);
-  }
-}
-
-Limb.Classkit.interfaceMethodPrototype = function()
-{
-  throw new Limb.Exception('InterfaceException', 'Interface methods can not be called');
-}
-
-Limb.Classkit.classToString = function()
-{
-  return '[ class ' + this.prototype.NAME + ' ]';
-}
-
-Limb.Classkit.interfaceToString = function()
-{
-  return '[ interface ' + this.NAME + ' ]';
-}
-
-Limb.Class = function(class_name, body)
-{
-  var class_ref = Limb.Classkit.createClass(body || null);
-  class_ref.prototype.NAME = class_name;
-  class_ref.prototype.static = class_ref;
-
-  Limb.define(class_name, class_ref);
-
-  return class_ref;
-}
-
-Limb.Interface = function(interface_name, body)
-{
-  var interface_ref = Limb.Classkit.createInterface(body || null);
-  interface_ref.NAME = interface_name;
-  interface_ref.is_interface = true;
-
-  Limb.define(interface_name, interface_ref);
-
-  return interface_ref;
-}
-
-Limb.namespace('Limb.Object');
-
-Limb.Object.inherits = function(class_name, body)
-{
-  var parent_class = Limb.namespace(class_name);
-  if(!parent_class)
-    return this;
-
-  Limb.Classkit.inherit(this, parent_class, body);
-
-  return this;
-}
-
-Limb.Object.implements = function(interface_name, body)
-{
-  var interface_ref = Limb.namespace(interface_name);
-  if(!interface_ref)
-    return this;
-
-  Limb.Classkit.implement(this, interface_ref, body);
-
-  return this;
-}
-
-Limb.Object.prototype = {
-  __construct: function() {},
-
-  toString: function()
-  {
-    return '[ object ' + this.NAME + ' ]';
-  }
-}
-

Copied: 3.x/trunk/limb/js/shared/limb (from rev 5800, 3.x/trunk/limb/js/shared/Limb)

Copied: 3.x/trunk/limb/js/shared/limb.js (from rev 5800, 3.x/trunk/limb/js/shared/Limb.js)
===================================================================
--- 3.x/trunk/limb/js/shared/limb.js	                        (rev 0)
+++ 3.x/trunk/limb/js/shared/limb.js	2007-05-04 10:20:17 UTC (rev 5801)
@@ -0,0 +1,340 @@
+/**
+ * Limb Web Application Framework
+ *
+ * @link http://limb-project.com
+ *
+ * @copyright  Copyright &copy; 2004-2007 BIT
+ * @license    LGPL http://www.gnu.org/copyleft/lesser.html
+ * @version    $Id$
+ * @package    js
+ */
+
+if(Limb == undefined) var Limb = {};
+
+String.prototype.trim = function()
+{
+  var r=/^\s+|\s+$/;
+  return this.replace(r,'');
+}
+
+if(!Function.prototype.bind)
+{
+  Function.prototype.bind = function(object)
+  {
+    var __method = this;
+    return function() {__method.apply( object, arguments );};
+  };
+}
+
+if(!Function.prototype.bindAsEventListener)
+{
+  Function.prototype.bindAsEventListener = function(object)
+  {
+    var __method = this;
+    return function(event) {__method.call(object, event || window.event);};
+  };
+}
+
+Limb.Exception = function()
+{
+  if(arguments.length == 1 && Limb.isObject(arguments[0]))
+  {
+    this.type = arguments[0].type || 'LimbException';
+    this.message = arguments[0].message;
+    this.stack = arguments[0].stack || 'Stack is not available';
+    this.file_name = arguments[0].fileName || 'File name is not available';
+    this.line_number = arguments[0].lineNumber || 'Line number is not available';
+  }
+  else
+  {
+    this.type = arguments[0] || 'LimbException';
+    this.message = arguments[1] || 'Unknown error';
+    if(typeof(arguments[2]) == 'object')
+    {
+      this.stack = arguments[2].stack || e.stack;
+      this.file_name = arguments[2].fileName || e.fileName;
+      this.line_number = arguments[2].lineNumber || e.lineNumber;
+    }
+    else
+    {
+      this.stack = 'Stack is not available';
+      this.file_name = 'File name is not available';
+      this.line_number = 'Line number is not available';
+    }
+  }
+}
+
+Limb.Exception.prototype =
+{
+  getMessage: function()
+  {
+    return this.message;
+  },
+
+  getType: function()
+  {
+    return this.type;
+  },
+
+  getStack: function()
+  {
+    return this.stack;
+  },
+
+  getFileName: function()
+  {
+    return this.file_name;
+  },
+
+  getLineNumber: function()
+  {
+    return this.line_number;
+  },
+
+  toString: function()
+  {
+    return '[ exception ' + this.type + ' ]';
+  }
+}
+
+Limb.define = function(name, value)
+{
+  var parts = name.split('.');
+  var var_name = parts.pop();
+
+  var namespace = Limb.namespace(parts.join('.'));
+  namespace[var_name] = value;
+}
+
+Limb.namespace = function(name)
+{
+  var parts = name.split('.');
+  var parent = window;
+  for(var i=0; i<parts.length; i++)
+  {
+    if(!parts[i])
+      continue;
+
+    if(!parent[parts[i]])
+      parent[parts[i]] = {};
+
+    parent = parent[parts[i]];
+  }
+
+  return parent;
+}
+
+Limb.require = function(package_name)
+{
+  //no working function for now. It needs to be written from the scratch or may be ported from 2.x
+}
+
+Limb.isset = function(variable)
+{
+  return typeof(variable) != 'undefined' && variable != null;
+}
+
+Limb.isObject = function(variable)
+{
+  return typeof(variable) == 'object';
+}
+
+Limb.isFunction = function(variable)
+{
+  return typeof(variable) == 'function';
+}
+
+Limb.namespace('Limb.Classkit');
+
+Limb.Classkit.createClass = function(body)
+{
+  var new_class = function()
+  {
+    if(Limb.isFunction(this['parent']))
+      this.parent = Limb.Classkit.makeParentProxy(this, this.parent);
+
+    this.__construct.apply(this, arguments);
+  }
+
+  new_class.toString = Limb.Classkit.classToString;
+
+  Limb.Classkit.inherit(new_class, Limb.Object, body);
+
+  return new_class;
+}
+
+Limb.Classkit.createInterface = function(body)
+{
+  var new_interface = function()
+  {
+    throw new Limb.Exception('InterfaceException', 'Can not create instance of interface');
+  }
+
+  new_interface.toString = Limb.Classkit.interfaceToString;
+
+  Limb.Classkit.extendInterface(new_interface, body || null);
+
+  return new_interface;
+}
+
+Limb.Classkit.clone = function(target, source)
+{
+  for(var i in source)
+  {
+    if(Limb.isObject(source[i]) || i == 'NAME')
+      continue;
+
+    target[i] = source[i];
+  }
+}
+
+Limb.Classkit.makeParentProxy = function(child_class, parent_class)
+{
+  var proxy = new Object();
+  proxy['NAME'] = parent.NAME;
+
+  var parent_instance = new parent_class();
+
+  for(var method in parent_instance)
+  {
+    if(!Limb.isFunction(parent_instance[method]))
+      continue;
+
+    proxy[method] = Limb.Classkit.parentMethodWrapper(child_class, parent_instance, method);
+  }
+
+  return proxy;
+}
+
+Limb.Classkit.inherit = function(child_class, parent_class, child_body)
+{
+  Limb.Classkit.clone(child_class, parent_class);
+  Limb.Classkit.clone(child_class.prototype, parent_class.prototype);
+
+  if(Limb.isFunction(parent_class))
+    child_class.prototype.parent = parent_class;
+
+  if(Limb.isset(child_body))
+    Limb.Classkit.extendClass(child_class, child_body);
+}
+
+Limb.Classkit.implement = function(class_ref, interface_ref, class_body)
+{
+  if(Limb.isset(class_body))
+    Limb.Classkit.extendClass(class_ref, class_body);
+
+  Limb.Classkit.checkInterfaceImplementation(class_ref, interface_ref);
+}
+
+Limb.Classkit.extendClass = function(class_ref, class_body)
+{
+  Limb.Classkit.clone(class_ref.prototype, class_body);
+
+  if(Limb.isObject(class_body['static']))
+    Limb.Classkit.clone(class_ref, class_body['static']);
+}
+
+Limb.Classkit.checkInterfaceImplementation = function(child_class, interface_ref)
+{
+  for(var method in interface_ref)
+  {
+    if(!Limb.isFunction(interface_ref[method]))
+      continue;
+
+    if(!Limb.isFunction(child_class.prototype[method]) && !Limb.isFunction(child_class[method]))
+      throw new Limb.Exception('InterfaceException', "Method '" + method + "' not implemented");
+  }
+}
+
+Limb.Classkit.extendInterface = function(interface_ref, body)
+{
+  if(!Limb.isObject(body))
+    return;
+
+  for(var method in body)
+  {
+    if(!Limb.isFunction(body[method]))
+      continue;
+
+    interface_ref[method] = Limb.Classkit.interfaceMethodPrototype;
+  }
+}
+
+Limb.Classkit.parentMethodWrapper = function(child_class_ref, parent_class_ref, method)
+{
+  return function()
+  {
+    return parent_class_ref[method].apply(child_class_ref, arguments);
+  }
+}
+
+Limb.Classkit.interfaceMethodPrototype = function()
+{
+  throw new Limb.Exception('InterfaceException', 'Interface methods can not be called');
+}
+
+Limb.Classkit.classToString = function()
+{
+  return '[ class ' + this.prototype.NAME + ' ]';
+}
+
+Limb.Classkit.interfaceToString = function()
+{
+  return '[ interface ' + this.NAME + ' ]';
+}
+
+Limb.Class = function(class_name, body)
+{
+  var class_ref = Limb.Classkit.createClass(body || null);
+  class_ref.prototype.NAME = class_name;
+  class_ref.prototype.static = class_ref;
+
+  Limb.define(class_name, class_ref);
+
+  return class_ref;
+}
+
+Limb.Interface = function(interface_name, body)
+{
+  var interface_ref = Limb.Classkit.createInterface(body || null);
+  interface_ref.NAME = interface_name;
+  interface_ref.is_interface = true;
+
+  Limb.define(interface_name, interface_ref);
+
+  return interface_ref;
+}
+
+Limb.namespace('Limb.Object');
+
+Limb.Object.inherits = function(class_name, body)
+{
+  var parent_class = Limb.namespace(class_name);
+  if(!parent_class)
+    return this;
+
+  Limb.Classkit.inherit(this, parent_class, body);
+
+  return this;
+}
+
+Limb.Object.implements = function(interface_name, body)
+{
+  var interface_ref = Limb.namespace(interface_name);
+  if(!interface_ref)
+    return this;
+
+  Limb.Classkit.implement(this, interface_ref, body);
+
+  return this;
+}
+
+Limb.Object.prototype = {
+  __construct: function() {},
+
+  toString: function()
+  {
+    return '[ object ' + this.NAME + ' ]';
+  }
+}
+



More information about the limb-svn mailing list