summaryrefslogtreecommitdiff
path: root/swat2/style/qooxdoo/widgets/core/QxObject.js
diff options
context:
space:
mode:
Diffstat (limited to 'swat2/style/qooxdoo/widgets/core/QxObject.js')
-rw-r--r--swat2/style/qooxdoo/widgets/core/QxObject.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/swat2/style/qooxdoo/widgets/core/QxObject.js b/swat2/style/qooxdoo/widgets/core/QxObject.js
new file mode 100644
index 00000000000..7300612863e
--- /dev/null
+++ b/swat2/style/qooxdoo/widgets/core/QxObject.js
@@ -0,0 +1,2 @@
+/* Copyright (c): 2002-2005 (Germany): United Internet, 1&1, GMX, Schlund+Partner, Alturo */
+function QxObject(autoDispose){this._pos=QxObject._i2++;this._hash="h"+String(Math.round(Math.random()*1e6));this._k1={};if(typeof autoDispose!="boolean"||autoDispose){QxObject._i3.push(this);};};QxObject.extend(Object,"QxObject");QxObject._i2=0;QxObject._siteCounter=0;QxObject._i3=[];QxObject.toHash=function(o){if(o._hash!=null){return o._hash;};return o._hash="h"+String(Math.round(Math.random()*1e6));};QxObject.dispose=function(){for(var i=QxObject._i3.length-1;i>=0;i--){if(typeof QxObject._i3[i]!="undefined"){QxObject._i3[i].dispose();if(typeof QxObject._i3=="undefined"){break;};delete QxObject._i3[i];};};delete QxObject._i3;};QxObject.addProperty({name:"enabled",type:Boolean,defaultValue:true,getAlias:"isEnabled"});proto.debug=function(m){QxDebug(this.classname+"["+this._pos+"]",m);};proto.subug=function(m){QxDebug(this.classname+"["+this._pos+"]","::"+m);};proto.toString=function(){if(this.classname){return "[object "+this.classname+"]";};return "[object Object]";};proto.toHash=function(){return this._hash;};proto._modifyEnabled=function(_b1,_b2,_b3,_b4){return true;};proto._disposed=false;proto.dispose=function(){if(this._disposed){return;};for(var p in this._k1){delete this._k1[p];};delete this._k1;this._disposed=true;delete QxObject._i3[this._pos];};proto.getDisposed=function(){return this._disposed;};proto.isDisposed=function(){return this._disposed;};proto.set=function(propertyValues){if(typeof propertyValues!="object"){throw new Error("Please use a valid hash of property key-values pairs.");};for(var prop in propertyValues){try{this["set"+prop.toFirstUp()](propertyValues[prop]);}catch(ex){throw new Error("Setter of property "+prop+" returned with an error:"+ex);};};return this;};proto.get=function(propertyNames,outputHint){switch(typeof propertyNames){case "string":return this["get"+propertyNames.toFirstUp()]();case "object":if(typeof propertyNames.length=="number"){if(outputHint=="hash"){var h={};propertyLength=propertyNames.length;for(var i=0;i<propertyLength;i++){try{h[propertyNames[i]]=this["get"+propertyNames[i].toFirstUp()]();}catch(ex){throw new Error("Could not get a valid value from property:"+propertyNames[i]+"! Is the property existing?("+ex+")");};};return h;}else {propertyLength=propertyNames.length;for(var i=0;i<propertyLength;i++){try{propertyNames[i]=this["get"+propertyNames[i].toFirstUp()]();}catch(ex){throw new Error("Could not get a valid value from property:"+propertyNames[i]+"! Is the property existing?("+ex+")");};};return propertyNames;};}else {for(var i in propertyNames){propertyNames[i]=this["get"+i.toFirstUp()]();};return propertyNames;};default:throw new Error("Please use a valid array,hash or string as parameter!");};};proto.addData=function(p){if(typeof p!="object"){throw new Error("Param should be an object!");};if(isInvalid(p.name)){throw new Error("Malformed input parameters:name needed!");};var valueKey=p.name;var methodKey=p.method=valueKey.toFirstUp();var changeKey="change"+methodKey;this["retrieve"+methodKey]=function(){return this._k1[valueKey];};if(typeof p.defaultValue!="undefined"){this._k1[valueKey]=p.defaultValue;this["retrieveDefault"+methodKey]=function(){return p.defaultValue;};this["storeDefault"+methodKey]=function(newValue){return p.defaultValue=newValue;};this["restore"+methodKey]=function(){return this["store"+methodKey](p.defaultValue);};};this["store"+methodKey]=function(newValue){var fixedValue=isValid(p.type)?p.type(newValue):newValue;var oldValue=this._k1[valueKey];if(fixedValue!=oldValue){this._k1[valueKey]=fixedValue;if(this instanceof QxTarget&&this.hasEventListeners(changeKey)){var ce=new QxDataEvent(changeKey,fixedValue,oldValue,false);ce.setTarget(this);try{this.dispatchEvent(ce,true);}catch(ex){throw new Error("Failed to dispatch change event:"+ex);};ce=null;};};return fixedValue;};};proto.removeData=function(p){if(typeof p!="object"){throw new Error("Param should be an object!");};if(isInvalid(p.name)){throw new Error("Malformed input parameters:name needed!");};var methodKey=p.method;delete this._k1[p.name];delete this["retrieve"+methodKey];delete this["store"+methodKey];delete this["retrieveDefault"+methodKey];delete this["storeDefault"+methodKey];delete this["restore"+methodKey];}; \ No newline at end of file