diff options
author | Derrell Lipman <derrell@samba.org> | 2006-12-30 05:09:59 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:30:29 -0500 |
commit | 1170417ceeb8c49a46cda522a38eaa71c9cae30c (patch) | |
tree | dbf4c3fdcdb1af928dbd55f642ea40f00d09283a /webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/core | |
parent | 23ccdca41670085da4486841b0d4900b4c8b02f3 (diff) | |
download | samba-1170417ceeb8c49a46cda522a38eaa71c9cae30c.tar.gz samba-1170417ceeb8c49a46cda522a38eaa71c9cae30c.tar.bz2 samba-1170417ceeb8c49a46cda522a38eaa71c9cae30c.zip |
r20414: Start to make SWAT usable by others. This is just a start...
(This used to be commit 26a34037a7ca6fbd05c5a6f7c2d5973e34bc6918)
Diffstat (limited to 'webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/core')
4 files changed, 1218 insertions, 0 deletions
diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/core/Init.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/core/Init.js new file mode 100644 index 0000000000..aae3ea1ac8 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/core/Init.js @@ -0,0 +1,327 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(core) +#require(qx.dom.EventRegistration) +#optional(qx.component.init.InterfaceInitComponent) + +************************************************************************ */ + +/** + * Initialize qooxdoo. + * + * Attaches qooxdoo callbacks to the load events (onload, onunload, onbeforeunload) + * and initializes the qooxdoo application. The initializations starts automatically. + * + * Make shure you set the application to your application before the load event is fired: + * <pre>qx.core.Init.getInstance().setApplication(YourApplication)</pre> + */ +qx.OO.defineClass("qx.core.Init", qx.core.Target, +function() +{ + qx.core.Target.call(this, false); + + // Object Wrapper to Events (Needed for DOM-Events) + var o = this; + + /** + * private + * @param e {Object} + */ + this.__onload = function(e) { return o._onload(e); } + /** + * private + * @param e {Object} + */ + this.__onbeforeunload = function(e) { return o._onbeforeunload(e); } + /** + * private + * @param e {Object} + */ + this.__onunload = function(e) { return o._onunload(e); } + + // Attach events + qx.dom.EventRegistration.addEventListener(window, "load", this.__onload); + qx.dom.EventRegistration.addEventListener(window, "beforeunload", this.__onbeforeunload); + qx.dom.EventRegistration.addEventListener(window, "unload", this.__onunload); +}); + + + + + +/* +--------------------------------------------------------------------------- + DEFAULT SETTINGS +--------------------------------------------------------------------------- +*/ + +qx.Settings.setDefault("component", "qx.component.init.InterfaceInitComponent"); + + + + + + +/* +--------------------------------------------------------------------------- + PROPERTIES +--------------------------------------------------------------------------- +*/ + +/** + * Instance of the component initializer. + */ +qx.OO.addProperty({ name : "component", type : "object", instance : "qx.component.init.BasicInitComponent" }); + +/** + * Reference to the constructor of the main application. + * + * Set this before the onload event is fired. + */ +qx.OO.addProperty({ name : "application", type : "function" }); + + + + + + + +/* +--------------------------------------------------------------------------- + MODIFIER +--------------------------------------------------------------------------- +*/ + +qx.Proto._modifyApplication = function(propValue, propOldValue, propData) +{ + if (propValue) { + this._applicationInstance = new propValue; + } + + return true; +}; + + + + + + +/* +--------------------------------------------------------------------------- + INTERNAL PROPERTIES +--------------------------------------------------------------------------- +*/ + +/** + * Rreturns an instance of the current qooxdoo Application + * + * @return {qx.component.AbstractApplication} instance of the current qooxdoo application + */ +qx.Proto.getApplicationInstance = function() +{ + if (!this.getApplication()) { + this.setApplication(qx.component.DummyApplication); + } + + return this._applicationInstance; +}; + + + + + + +/* +--------------------------------------------------------------------------- + COMPONENT BINDING +--------------------------------------------------------------------------- +*/ + +/** + * define the initialisation function + * Don't use this method directly. Use setApplication instead! + * + * @param vFunc {Function} callback function + */ +qx.Proto.defineInitialize = function(vFunc) { + this.getApplicationInstance().initialize = vFunc; +} + +/** + * define the main function + * Don't use this method directly. Use setApplication instead! + * + * @param vFunc {Function} callback function + */ +qx.Proto.defineMain = function(vFunc) { + this.getApplicationInstance().main = vFunc; +} + +/** + * define the finalize function + * Don't use this method directly. Use setApplication instead! + * + * @param vFunc {Function} callback function + */ +qx.Proto.defineFinalize = function(vFunc) { + this.getApplicationInstance().finalize = vFunc; +} + +/** + * define the close function + * Don't use this method directly. Use setApplication instead! + * + * @param vFunc {Function} callback function + */ +qx.Proto.defineClose = function(vFunc) { + this.getApplicationInstance().close = vFunc; +} + +/** + * define the terminate function + * Don't use this method directly. Use setApplication instead! + * + * @param vFunc {Function} callback function + */ +qx.Proto.defineTerminate = function(vFunc) { + this.getApplicationInstance().terminate = vFunc; +} + + + + + + + +/* +--------------------------------------------------------------------------- + EVENT HANDLER +--------------------------------------------------------------------------- +*/ + +/** + * load event handler + * + * @param e {Object} + */ +qx.Proto._onload = function(e) +{ + this.debug("qooxdoo " + qx.core.Version.toString()); + + // Print out class information + this.debug("loaded " + qx.lang.Object.getLength(qx.OO.classes) + " classes"); + + // Print browser information + var cl = qx.sys.Client.getInstance(); + this.debug("client: " + cl.getEngine() + "-" + cl.getMajor() + "." + + cl.getMinor() + "/" + cl.getPlatform() + "/" + cl.getLocale()); + + if (cl.isMshtml() && !cl.isInQuirksMode()) { + this.warn("Wrong box sizing: Please modify the document's DOCTYPE!"); + } + + // Init component from settings + this.setComponent(new qx.OO.classes[this.getSetting("component")](this)); + + // Send onload + return this.getComponent()._onload(e); +} + + +/** + * beforeunload event handler + * + * @param e {Object} + */ +qx.Proto._onbeforeunload = function(e) +{ + // Send onbeforeunload event (can be cancelled) + return this.getComponent()._onbeforeunload(e); +} + + +/** + * unload event handler + * + * @param e {Object} + */ +qx.Proto._onunload = function(e) +{ + // Send onunload event (last event) + this.getComponent()._onunload(e); + + // Dispose all qooxdoo objects + qx.core.Object.dispose(); +} + + + + + + + +/* +--------------------------------------------------------------------------- + DISPOSER +--------------------------------------------------------------------------- +*/ + +/** + * Destructor + */ +qx.Proto.dispose = function() +{ + if (this.getDisposed()) { + return; + } + + // Detach Events + qx.dom.EventRegistration.removeEventListener(window, "load", this.__onload); + qx.dom.EventRegistration.removeEventListener(window, "beforeunload", this.__onbeforeunload); + qx.dom.EventRegistration.removeEventListener(window, "unload", this.__onunload); + + // Reset inline functions + this.__onload = this.__onbeforeunload = this.__onunload = null; + + if (this._applicationInstance) { + this._applicationInstance.dispose(); + this._applicationInstance = null; + } + + qx.core.Target.prototype.dispose.call(this); +} + + + + +/* +--------------------------------------------------------------------------- + DIRECT SINGLETON INSTANCE +--------------------------------------------------------------------------- +*/ + +/** + * Singleton Instance Getter + */ +qx.Class.getInstance = qx.util.Return.returnInstance; + +// Force direct creation +qx.Class.getInstance(); diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/core/Object.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/core/Object.js new file mode 100644 index 0000000000..26453f82a2 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/core/Object.js @@ -0,0 +1,525 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(core) +#load(qx.core.Init) + +************************************************************************ */ + +/** + * The qooxdoo base object. All qooxdoo classes extend this one + * + * This class contains functions for: + * <ul> + * <li> logging </li> + * <li> common getter/setter </li> + * <li> user data </li> + * <li> object destruction </li> + * </ul> + * + * @param vAutoDispose {boolean ? true} wether the object should be disposed automatically by qooxdoo + */ +qx.OO.defineClass("qx.core.Object", Object, +function(vAutoDispose) +{ + this._hashCode = qx.core.Object._counter++; + + if (vAutoDispose !== false) { + qx.core.Object._db.push(this); + } +}); + + +/* +--------------------------------------------------------------------------- + DEFAULT SETTINGS +--------------------------------------------------------------------------- +*/ + +qx.Settings.setDefault("enableDisposerDebug", false); + + + + + +/* ************************************************************************ + Class data, properties and methods +************************************************************************ */ + +qx.Class._counter = 0; +qx.Class._db = []; + +/** + * Generate an unique key for the given object and return it. + * Sets object._hashCode to the generated key. + * + * @param o {Object} + * @return {int} unique key for the given object + */ +qx.Class.toHashCode = function(o) +{ + if(o._hashCode != null) { + return o._hashCode; + } + + return o._hashCode = qx.core.Object._counter++; +} + + +/** + * Class function which returns an object given its hash code + * + * @param hash {string} hash code of an object + * + * @returns {Object} the object whose hash is specified + */ +qx.Class.fromHashCode = function(hash) { + return qx.core.Object._db[hash]; +} + + +/** + * Destructor. This method is called by qooxdoo on object destruction. + * + * Any class that holds ressources like links to DOM nodes must overwrite + * this method and free theese ressources. + */ +qx.Class.dispose = function() +{ + // var logger = qx.dev.log.Logger.getClassLogger(qx.core.Object); + // logger.debug("Disposing Application"); + + // var vStart = (new Date).valueOf(); + var vObject; + + for (var i=qx.core.Object._db.length-1; i>=0; i--) + { + vObject = qx.core.Object._db[i]; + + if (vObject && vObject._disposed === false) + { + // logger.debug("Disposing: " + vObject); + vObject.dispose(); + } + } + + // logger.debug("Done in: " + ((new Date).valueOf() - vStart) + "ms"); +} + + +/** + * Summary of allocated objects + * + * @return {string} summary of allocated objects. + */ +qx.Class.summary = function() +{ + var vData = {}; + var vCounter = 0; + + for (var i=qx.core.Object._db.length-1; i>=0; i--) + { + vObject = qx.core.Object._db[i]; + + if (vObject && vObject._disposed === false) + { + if (vData[vObject.classname] == null) + { + vData[vObject.classname] = 1; + } + else + { + vData[vObject.classname]++; + } + + vCounter++; + } + } + + var vArrData = []; + + for (var vClassName in vData) { + vArrData.push({ classname : vClassName, number : vData[vClassName] }); + } + + vArrData.sort(function(a, b) { + return b.number - a.number; + }); + + var vMsg = "Summary: (" + vCounter + " Objects)\n\n"; + + for (var i=0; i<vArrData.length; i++) { + vMsg += vArrData[i].number + ": " + vArrData[i].classname + "\n"; + } + + alert(vMsg); +} + +/** + * Enable or disable the Object. + * + * The actual semantic of this property depends on concrete subclass of qx.core.Object. + */ +qx.OO.addProperty({ name : "enabled", type : "boolean", defaultValue : true, getAlias : "isEnabled" }); + + + + + + +/* ************************************************************************ + Instance data, properties and methods +************************************************************************ */ + +/* +--------------------------------------------------------------------------- + UTILITIES +--------------------------------------------------------------------------- +*/ + +/** + * Returns a string represantation of the qooxdoo object. + * + * @returns {string} string representation of the object + */ +qx.Proto.toString = function() +{ + if(this.classname) { + return "[object " + this.classname + "]"; + } + + return "[object Object]"; +} + + +/** + * Return unique hash code of object + * + * @return {int} unique hash code of the object + */ +qx.Proto.toHashCode = function() { + return this._hashCode; +} + + +/** + * Returns true if the object is disposed. + * + * @return {boolean} wether the object has been disposed + */ +qx.Proto.getDisposed = function() { + return this._disposed; +} + + +/** + * Returns true if the object is disposed. + * + * @return {boolean} wether the object has been disposed + */ +qx.Proto.isDisposed = function() { + return this._disposed; +} + + +/** + * Returns a settings from global setting definition + * + * @param vKey {string} + * @return {Object} value of the global setting + */ +qx.Proto.getSetting = function(vKey) { + return qx.Settings.getValueOfClass(this.classname, vKey); +} + + +/* +--------------------------------------------------------------------------- + LOGGING INTERFACE +--------------------------------------------------------------------------- +*/ + +/** + * Returns the logger of this class. + * + * @return {qx.dev.log.Logger} the logger of this class. + */ +qx.Proto.getLogger = function() { + return qx.dev.log.Logger.getClassLogger(this.constructor); +} + + +/** + * Logs a debug message. + * + * @param msg {var} the message to log. If this is not a string, the + * object dump will be logged. + * @param exc {var ? null} the exception to log. + */ +qx.Proto.debug = function(msg, exc) { + this.getLogger().debug(msg, this._hashCode, exc); +} + + +/** + * Logs an info message. + * + * @param msg {var} the message to log. If this is not a string, the + * object dump will be logged. + * @param exc {var ? null} the exception to log. + */ +qx.Proto.info = function(msg, exc) { + this.getLogger().info(msg, this._hashCode, exc); +} + + +/** + * Logs a warning message. + * + * @param msg {var} the message to log. If this is not a string, the + * object dump will be logged. + * @param exc {var ? null} the exception to log. + */ +qx.Proto.warn = function(msg, exc) { + this.getLogger().warn(msg, this._hashCode, exc); +} + + +/** + * Logs an error message. + * + * @param msg {var} the message to log. If this is not a string, the + * object dump will be logged. + * @param exc {var ? null} the exception to log. + */ +qx.Proto.error = function(msg, exc) { + this.getLogger().error(msg, this._hashCode, exc); +} + + + + +/* +--------------------------------------------------------------------------- + COMMON SETTER/GETTER SUPPORT +--------------------------------------------------------------------------- +*/ + +/** + * Sets multiple properties at once by using a property list + * + * @param propertyValues {Object} A hash of key-value pairs. + */ +qx.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[qx.OO.setter[prop]](propertyValues[prop]); + } + catch(ex) + { + this.error("Setter of property " + prop + " returned with an error", ex); + } + } + + return this; +} + +/** + * Gets multiple properties at once by using a property list + * + * @param propertyNames {string | array | hash} list of the properties to get + * @param outputHint {string ? "array"} how should the values be returned. Possible values are "hash" and "array". +*/ +qx.Proto.get = function(propertyNames, outputHint) +{ + switch(typeof propertyNames) + { + case "string": + return this["get" + qx.lang.String.toFirstUp(propertyNames)](); + + 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" + qx.lang.String.toFirstUp(propertyNames[i])](); + } + 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" + qx.lang.String.toFirstUp(propertyNames[i])](); + } + 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" + qx.lang.String.toFirstUp(i)](); + } + + return propertyNames; + } + + default: + throw new Error("Please use a valid array, hash or string as parameter!"); + } +} + + + + + +/* +--------------------------------------------------------------------------- + USER DATA +--------------------------------------------------------------------------- +*/ + +/** + * Store user defined data inside the object. + * + * @param vKey {string} + * @param vValue {Object} + */ +qx.Proto.setUserData = function(vKey, vValue) +{ + if (!this._userData) { + this._userData = {}; + } + + this._userData[vKey] = vValue; +} + + +/** + * Load user defined data from the object + * + * @param vKey {string} + * @return {Object} the user data + */ +qx.Proto.getUserData = function(vKey) +{ + if (!this._userData) { + return null; + } + + return this._userData[vKey]; +} + + + + + + +/* +--------------------------------------------------------------------------- + DISPOSER +--------------------------------------------------------------------------- +*/ + +qx.Proto._disposed = false; + +/** + * Dispose this object + */ +qx.Proto.dispose = function() +{ + if (this.getDisposed()) { + return; + } + + // Dispose user data + if (this._userData) + { + for(var vKey in this._userData) { + this._userData[vKey] = null; + } + + this._userData = null; + } + + // Finally cleanup properties + if (this._objectproperties) + { + var a = this._objectproperties.split(","); + var d = qx.OO.values; + + for (var i=0, l=a.length; i<l; i++) { + this[d[a[i]]] = null; + } + + this._objectproperties = null; + } + + if (this.getSetting("enableDisposerDebug")) + { + for (var vKey in this) + { + if (this[vKey] !== null && typeof this[vKey] === "object") + { + this.debug("Missing class implementation to dispose: " + vKey); + delete this[vKey]; + } + } + } + + /* + if (typeof CollectGarbage === "function") { + CollectGarbage(); + } + */ + + // Delete Entry from Object DB + qx.core.Object._db[this._hashCode] = null; + + // Mark as disposed + this._disposed = true; +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/core/Target.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/core/Target.js new file mode 100644 index 0000000000..891ac44426 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/core/Target.js @@ -0,0 +1,299 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(core) + +************************************************************************ */ + +/** + * This is the main constructor for all objects that need to be connected to qx.event.type.Event objects. + * + * In objects created with this constructor, you find functions to addEventListener or + * removeEventListener to or from the created object. Each event to connect to has a type in + * form of an identification string. This type could be the name of a regular dom event like "click" or + * something self-defined like "ready". + * + * @param vAutoDispose {boolean ? true} wether the object should be disposed automatically by qooxdoo + */ +qx.OO.defineClass("qx.core.Target", qx.core.Object, +function(vAutoDispose) { + qx.core.Object.call(this, vAutoDispose); +}); + +/** + * @private + */ +qx.Class.EVENTPREFIX = "evt"; + + + + +/* +--------------------------------------------------------------------------- + EVENT CONNECTION +--------------------------------------------------------------------------- +*/ + +/** + * Add event listener to an object. + * + * @param vType {string} name of the event type + * @param vFunction {Function} event callback function + * @param vObject {object ? window} reference to the 'this' variable inside the callback + */ +qx.Proto.addEventListener = function(vType, vFunction, vObject) +{ + if(this._disposed) { + return; + } + + if(typeof vFunction !== "function") { + throw new Error("qx.core.Target: addEventListener(" + vType + "): '" + vFunction + "' is not a function!"); + } + + // If this is the first event of given type, we need to create a subobject + // that contains all the actions that will be assigned to this type + if (typeof this._listeners === "undefined") + { + this._listeners = {}; + this._listeners[vType] = {}; + } + else if(typeof this._listeners[vType] === "undefined") + { + this._listeners[vType] = {}; + } + + // Create a special vKey string to allow identification of each bound action + var vKey = qx.core.Target.EVENTPREFIX + qx.core.Object.toHashCode(vFunction) + (vObject ? "_" + qx.core.Object.toHashCode(vObject) : ""); + + // Finally set up the listeners object + this._listeners[vType][vKey] = + { + handler : vFunction, + object : vObject + } +} + + +/** + * Remove event listener from object + * + * @param vType {string} name of the event type + * @param vFunction {Function} event callback function + * @param vObject {object ? window} reference to the 'this' variable inside the callback + */ +qx.Proto.removeEventListener = function(vType, vFunction, vObject) +{ + if(this._disposed) { + return; + } + + var vListeners = this._listeners; + if (!vListeners || typeof vListeners[vType] === "undefined") { + return; + } + + if(typeof vFunction !== "function") { + throw new Error("qx.core.Target: removeEventListener(" + vType + "): '" + vFunction + "' is not a function!"); + } + + // Create a special vKey string to allow identification of each bound action + var vKey = qx.core.Target.EVENTPREFIX + qx.core.Object.toHashCode(vFunction) + (vObject ? "_" + qx.core.Object.toHashCode(vObject) : ""); + + // Delete object entry for this action + delete this._listeners[vType][vKey]; +} + + + +/* +--------------------------------------------------------------------------- + EVENT CONNECTION UTILITIES +--------------------------------------------------------------------------- +*/ + +/** + * Check if there are one or more listeners for an event type. + * + * @param vType {string} name of the event type + */ +qx.Proto.hasEventListeners = function(vType) { + return this._listeners && typeof this._listeners[vType] !== "undefined" && !qx.lang.Object.isEmpty(this._listeners[vType]); +} + + +/** + * Checks if the event is registered. If so it creates an event object and dispatches it. + * + * @param vType {string} name of the event type + */ +qx.Proto.createDispatchEvent = function(vType) +{ + if (this.hasEventListeners(vType)) { + this.dispatchEvent(new qx.event.type.Event(vType), true); + } +} + + +/** + * Checks if the event is registered. If so it creates an event object and dispatches it. + * + * @param vType {string} name of the event type + * @param vData {Object} user defined data attached to the event object + */ +qx.Proto.createDispatchDataEvent = function(vType, vData) +{ + if (this.hasEventListeners(vType)) { + this.dispatchEvent(new qx.event.type.DataEvent(vType, vData), true); + } +} + + + +/* +--------------------------------------------------------------------------- + EVENT DISPATCH +--------------------------------------------------------------------------- +*/ + +/** + * Dispatch an event + * + * @param vEvent {qx.event.type.Event} event to dispatch + * @param vEnableDispose {boolean} wether the event object should be disposed after all event handlers run. + * @return {boolean} wether the event default was prevented or not. Returns true, when the event was NOT prevented. + */ +qx.Proto.dispatchEvent = function(vEvent, vEnableDispose) +{ + // Ignore event if eventTarget is disposed + if(this.getDisposed() && this.getEnabled()) { + return; + } + + if (vEvent.getTarget() == null) { + vEvent.setTarget(this); + } + + if (vEvent.getCurrentTarget() == null) { + vEvent.setCurrentTarget(this); + } + + // Dispatch Event + this._dispatchEvent(vEvent, vEnableDispose); + + // Read default prevented + var defaultPrevented = vEvent._defaultPrevented; + + // enable dispose for event? + vEnableDispose && vEvent.dispose(); + + return !defaultPrevented; +} + + +/** + * Internal event dispatch method + * + * @param vEvent {qx.event.type.Event} event to dispatch + */ +qx.Proto._dispatchEvent = function(vEvent) +{ + var vListeners = this._listeners; + if (vListeners) + { + // Setup current target + vEvent.setCurrentTarget(this); + + // Shortcut for listener data + var vTypeListeners = vListeners[vEvent.getType()]; + + if(vTypeListeners) + { + var vFunction, vObject; + + // Handle all events for the specified type + for (var vHashCode in vTypeListeners) + { + // Shortcuts for handler and object + vFunction = vTypeListeners[vHashCode].handler; + vObject = vTypeListeners[vHashCode].object; + + // Call object function + try + { + if(typeof vFunction === "function") { + vFunction.call(qx.util.Validation.isValid(vObject) ? vObject : this, vEvent); + } + } + catch(ex) + { + this.error("Could not dispatch event of type \"" + vEvent.getType() + "\"", ex); + } + } + } + } + + // Bubble event to parents + // TODO: Move this to Parent or Widget? + if(vEvent.getBubbles() && !vEvent.getPropagationStopped() && this.getParent) + { + var vParent = this.getParent(); + if (vParent && !vParent.getDisposed() && vParent.getEnabled()) { + vParent._dispatchEvent(vEvent); + } + } +} + + + + +/* +--------------------------------------------------------------------------- + DISPOSER +--------------------------------------------------------------------------- +*/ + +/** + * Destructor. + */ +qx.Proto.dispose = function() +{ + if(this.getDisposed()) { + return; + } + + if (typeof this._listeners === "object") + { + for (var vType in this._listeners) + { + var listener = this._listeners[vType]; + for (var vKey in listener) + { + listener[vKey] = null; + } + + this._listeners[vType] = null; + } + } + + this._listeners = null; + + return qx.core.Object.prototype.dispose.call(this); +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/core/Version.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/core/Version.js new file mode 100755 index 0000000000..c5b094eb97 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/core/Version.js @@ -0,0 +1,67 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(core) +#random(386) + +************************************************************************ */ + +/** + * qooxdoo version number information + */ +qx.OO.defineClass("qx.core.Version", +{ + /** + * qooxdoo major version number + */ + major : 0, + + /** + * qooxdoo minor version number + */ + minor : 6, + + /** + * qooxdoo revision number + */ + revision : 3, + + /** + * qooxdoo revision state + */ + state : "", + + /** + * qooxdoo subversion revision number + */ + svn : Number("$Rev: 5000 $".match(/[0-9]+/)[0]), + + /** + * returns the qooxdoo version string + * + * @return {string} qooxdoo version string + */ + toString: function() + { + with(qx.core.Version) { + return major + "." + minor + (revision==0 ? "" : "." + revision) + (state == "" ? "" : "-" + state) + " (r" + svn + ")"; + } + } +}); |