diff options
Diffstat (limited to 'webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object')
11 files changed, 1635 insertions, 0 deletions
diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/AliasManager.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/AliasManager.js new file mode 100644 index 0000000000..5ba86b7a32 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/AliasManager.js @@ -0,0 +1,172 @@ +/* ************************************************************************ + + 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 singleton manage global resource aliases + * + * @event change {qx.event.type.Event} + */ +qx.OO.defineClass("qx.manager.object.AliasManager", qx.core.Target, +function() +{ + qx.core.Target.call(this); + + // Contains defined aliases (like icons/, widgets/, application/, ...) + this._aliases = {}; + + // Containes computed paths + this._uris = {}; + + // Define static alias from setting + this.add("static", this.getSetting("staticUri")); +}); + + + + + + +/* +--------------------------------------------------------------------------- + DEFAULT SETTINGS +--------------------------------------------------------------------------- +*/ + +qx.Settings.setDefault("resourceUri", "../../resource"); +qx.Settings.setDefault("staticUri", qx.Settings.getValue("resourceUri") + "/static"); + + + + + +/* +--------------------------------------------------------------------------- + ALIAS MANAGMENT +--------------------------------------------------------------------------- +*/ + +qx.Proto.add = function(vPrefix, vPath) +{ + this._aliases[vPrefix] = vPath; + this.createDispatchEvent("change"); +} + +qx.Proto.remove = function(vPrefix) +{ + delete this._aliases[vPrefix]; + this.createDispatchEvent("change"); +} + +qx.Proto.resolve = function(vPrefix) { + return this._aliases[vPrefix]; +} + + + + + + +/* +--------------------------------------------------------------------------- + URI HANDLING +--------------------------------------------------------------------------- +*/ + +qx.Proto.resolvePath = function(vPath, vForceUpdate) +{ + var vUri = this._uris[vPath]; + + if (vForceUpdate || typeof vUri === "undefined") + { + vUri = this._uris[vPath] = this._computePath(vPath); + // this.debug("URI: " + vPath + " => " + vUri); + } + + return vUri; +} + +qx.Proto._computePath = function(vPath, vForce) +{ + switch(vPath.charAt(0)) + { + case "/": + case ".": + return vPath; + + default: + if (qx.lang.String.startsWith(vPath, qx.net.Protocol.URI_HTTP) || qx.lang.String.startsWith(vPath, qx.net.Protocol.URI_HTTPS) || qx.lang.String.startsWith(vPath, qx.net.Protocol.URI_FILE)) { + return vPath; + } + + var vAlias = vPath.substring(0, vPath.indexOf("/")); + var vResolved = this._aliases[vAlias]; + + if (qx.util.Validation.isValidString(vResolved)) { + return vResolved + vPath.substring(vAlias.length); + } + + return vPath; + } +} + + + + + + + + +/* +--------------------------------------------------------------------------- + DISPOSER +--------------------------------------------------------------------------- +*/ + +qx.Proto.dispose = function() +{ + if (this.getDisposed()) { + return; + } + + this._aliases = null; + this._uris = null; + + return qx.core.Target.prototype.dispose.call(this); +} + + + + + + +/* +--------------------------------------------------------------------------- + DEFER SINGLETON INSTANCE +--------------------------------------------------------------------------- +*/ + +/** + * Singleton Instance Getter + */ +qx.Class.getInstance = qx.util.Return.returnInstance; diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/AppearanceManager.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/AppearanceManager.js new file mode 100644 index 0000000000..680bd09073 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/AppearanceManager.js @@ -0,0 +1,139 @@ +/* ************************************************************************ + + 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(ui_core) + +************************************************************************ */ + +qx.OO.defineClass("qx.manager.object.AppearanceManager", qx.manager.object.ObjectManager, +function() { + qx.manager.object.ObjectManager.call(this); + + // Themes + this._appearanceThemes = {}; +}); + + + + +/* +--------------------------------------------------------------------------- + DEFAULT SETTINGS +--------------------------------------------------------------------------- +*/ + +qx.Settings.setDefault("appearanceTheme", "qx.theme.appearance.Classic"); + + + + + +/* +--------------------------------------------------------------------------- + PROPERTIES +--------------------------------------------------------------------------- +*/ + +qx.OO.addProperty({ name : "appearanceTheme", type : "object", allowNull : false, instance : "qx.renderer.theme.AppearanceTheme" }); + + + + + + +/* +--------------------------------------------------------------------------- + REGISTRATION +--------------------------------------------------------------------------- +*/ + +qx.Proto.registerAppearanceTheme = function(vThemeClass) +{ + this._appearanceThemes[vThemeClass.classname] = vThemeClass; + + if (vThemeClass.classname == this.getSetting("appearanceTheme")) { + this.setAppearanceTheme(vThemeClass.getInstance()); + } +} + + + + + + + + +/* +--------------------------------------------------------------------------- + MODIFIER +--------------------------------------------------------------------------- +*/ + +qx.Proto._modifyAppearanceTheme = function(propValue, propOldValue, propData) +{ + var vComp = qx.core.Init.getInstance().getComponent(); + + if (vComp && vComp.isUiReady()) { + qx.ui.core.ClientDocument.getInstance()._recursiveAppearanceThemeUpdate(propValue, propOldValue); + } + + return true; +} + + + + + + + +/* +--------------------------------------------------------------------------- + DISPOSER +--------------------------------------------------------------------------- +*/ + +qx.Proto.dispose = function() +{ + if (this.getDisposed()) { + return; + } + + // Themes + this._appearanceThemes = null; + + return qx.manager.object.ObjectManager.prototype.dispose.call(this); +} + + + + + + + +/* +--------------------------------------------------------------------------- + DEFER SINGLETON INSTANCE +--------------------------------------------------------------------------- +*/ + +/** + * Singleton Instance Getter + */ +qx.Class.getInstance = qx.util.Return.returnInstance; diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/ColorManager.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/ColorManager.js new file mode 100644 index 0000000000..6eb4038bd8 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/ColorManager.js @@ -0,0 +1,227 @@ +/* ************************************************************************ + + 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(ui_core) +#optional(qx.ui.form.Button) + +************************************************************************ */ + +qx.OO.defineClass("qx.manager.object.ColorManager", qx.manager.object.ObjectManager, +function() +{ + qx.manager.object.ObjectManager.call(this); + + // Themes + this._colorThemes = {}; + + // Contains the qx.renderer.color.ColorObjects which + // represent a themed color. + this._dependentObjects = {}; +}); + + + + + +/* +--------------------------------------------------------------------------- + DEFAULT SETTINGS +--------------------------------------------------------------------------- +*/ + +qx.Settings.setDefault("colorTheme", "qx.theme.color.WindowsRoyale"); + + + + +/* +--------------------------------------------------------------------------- + PROPERTIES +--------------------------------------------------------------------------- +*/ + +qx.OO.addProperty({ name : "colorTheme", type : "object", allowNull : false, instance : "qx.renderer.theme.ColorTheme" }); + + + + + + +/* +--------------------------------------------------------------------------- + REGISTRATION +--------------------------------------------------------------------------- +*/ + +qx.Proto.registerColorTheme = function(vThemeClass) +{ + this._colorThemes[vThemeClass.classname] = vThemeClass; + + if (vThemeClass.classname == this.getSetting("colorTheme")) { + this.setColorTheme(vThemeClass.getInstance()); + } +} + +qx.Proto.setColorThemeById = function(vId) { + this.setColorTheme(this._colorThemes[vId].getInstance()); +} + + + + + + +/* +--------------------------------------------------------------------------- + PUBLIC METHODS FOR qx.renderer.color.ColorOBJECTS +--------------------------------------------------------------------------- +*/ + +qx.Proto.add = function(oObject) +{ + var vValue = oObject.getValue(); + + this._objects[vValue] = oObject; + + if (oObject.isThemedColor()) { + this._dependentObjects[vValue] = oObject; + } +} + +qx.Proto.remove = function(oObject) +{ + var vValue = oObject.getValue(); + + delete this._objects[vValue]; + delete this._dependentObjects[vValue]; +} + +qx.Proto.has = function(vValue) { + return this._objects[vValue] != null; +} + +qx.Proto.get = function(vValue) { + return this._objects[vValue]; +} + + + + + + + +/* +--------------------------------------------------------------------------- + MODIFIER +--------------------------------------------------------------------------- +*/ + +qx.Proto._modifyColorTheme = function(propValue, propOldValue, propData) +{ + propValue.compile(); + + for (var i in this._dependentObjects) { + this._dependentObjects[i]._updateTheme(propValue); + } + + return true; +} + + + + + + + + +/* +--------------------------------------------------------------------------- + UTILITY +--------------------------------------------------------------------------- +*/ + +qx.Proto.createThemeList = function(vParent, xCor, yCor) +{ + var vButton; + var vThemes = this._colorThemes; + var vIcon = "icon/16/colors.png"; + var vPrefix = "Color Theme: "; + var vEvent = "execute"; + + for (var vId in vThemes) + { + var vObj = vThemes[vId].getInstance(); + var vButton = new qx.ui.form.Button(vPrefix + vObj.getTitle(), vIcon); + + vButton.setLocation(xCor, yCor); + vButton.addEventListener(vEvent, new Function("qx.manager.object.ColorManager.getInstance().setColorThemeById('" + vId + "')")); + + vParent.add(vButton); + + yCor += 30; + } +} + + + + + + +/* +--------------------------------------------------------------------------- + DISPOSER +--------------------------------------------------------------------------- +*/ + +qx.Proto.dispose = function() +{ + if (this.getDisposed()) { + return; + } + + // Themes + this._colorThemes = null; + + // Cleanup dependent objects + for (var i in this._dependentObjects) { + delete this._dependentObjects[i]; + } + + delete this._dependentObjects; + + return qx.manager.object.ObjectManager.prototype.dispose.call(this); +} + + + + + + + +/* +--------------------------------------------------------------------------- + DEFER SINGLETON INSTANCE +--------------------------------------------------------------------------- +*/ + +/** + * Singleton Instance Getter + */ +qx.Class.getInstance = qx.util.Return.returnInstance; diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/IframeManager.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/IframeManager.js new file mode 100644 index 0000000000..79695169b2 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/IframeManager.js @@ -0,0 +1,75 @@ +/* ************************************************************************ + + 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: + * Til Schneider (til132) + +************************************************************************ */ + +/** + * This singleton manages multiple instances of qx.ui.embed.Iframe. + * <p> + * The problem: When dragging over an iframe then all mouse events will be + * passed to the document of the iframe, not the main document. + * <p> + * The solution: In order to be able to track mouse events over iframes, this + * manager will block all iframes during a drag with a glasspane. + */ +qx.OO.defineClass("qx.manager.object.IframeManager", qx.manager.object.ObjectManager, +function(){ + qx.manager.object.ObjectManager.call(this); +}); + + + + + +/* +--------------------------------------------------------------------------- + METHODS +--------------------------------------------------------------------------- +*/ + +qx.Proto.handleMouseDown = function(evt) { + var iframeMap = this.getAll(); + + for (var key in iframeMap) { + var iframe = iframeMap[key]; + iframe.block(); + } +} + +qx.Proto.handleMouseUp = function(evt) { + var iframeMap = this.getAll(); + + for (var key in iframeMap) { + var iframe = iframeMap[key]; + iframe.release(); + } +} + + + + + + + +/* +--------------------------------------------------------------------------- + DEFER SINGLETON INSTANCE +--------------------------------------------------------------------------- +*/ + +/** + * Singleton Instance Getter + */ +qx.Class.getInstance = qx.util.Return.returnInstance; diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/ImageManager.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/ImageManager.js new file mode 100644 index 0000000000..f1fbfe6fb9 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/ImageManager.js @@ -0,0 +1,305 @@ +/* ************************************************************************ + + 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(ui_core) +#optional(qx.ui.form.Button) + +************************************************************************ */ + +/*! + This singleton manage the global image path (prefix) and allowes themed icons. +*/ +qx.OO.defineClass("qx.manager.object.ImageManager", qx.manager.object.ObjectManager, +function() +{ + qx.manager.object.ObjectManager.call(this); + + // Themes + this._iconThemes = {}; + this._widgetThemes = {}; + + // Contains known image sources (all of them, if loaded or not) + // The value is a number which represents the number of image + // instances which use this source + this._sources = {}; + + // Change event connection to AliasManager + qx.manager.object.AliasManager.getInstance().addEventListener("change", this._onaliaschange, this); +}); + + + + +/* +--------------------------------------------------------------------------- + DEFAULT SETTINGS +--------------------------------------------------------------------------- +*/ + +qx.Settings.setDefault("iconTheme", "qx.theme.icon.CrystalSvg"); +qx.Settings.setDefault("widgetTheme", "qx.theme.widget.Windows"); + + + + + + +/* +--------------------------------------------------------------------------- + PROPERTIES +--------------------------------------------------------------------------- +*/ + +qx.OO.addProperty({ name : "iconTheme", type : "object", instance : "qx.renderer.theme.IconTheme" }); +qx.OO.addProperty({ name : "widgetTheme", type : "object", instance : "qx.renderer.theme.WidgetTheme" }); + + + + + + +/* +--------------------------------------------------------------------------- + REGISTRATION +--------------------------------------------------------------------------- +*/ + +qx.Proto.registerIconTheme = function(vThemeClass) +{ + this._iconThemes[vThemeClass.classname] = vThemeClass; + + if (vThemeClass.classname == this.getSetting("iconTheme")) { + this.setIconTheme(vThemeClass.getInstance()); + } +} + +qx.Proto.registerWidgetTheme = function(vThemeClass) +{ + this._widgetThemes[vThemeClass.classname] = vThemeClass; + + if (vThemeClass.classname == this.getSetting("widgetTheme")) { + this.setWidgetTheme(vThemeClass.getInstance()); + } +} + +qx.Proto.setIconThemeById = function(vId) { + this.setIconTheme(this._iconThemes[vId].getInstance()); +} + +qx.Proto.setWidgetThemeById = function(vId) { + this.setWidgetTheme(this._widgetThemes[vId].getInstance()); +} + + + + + + + +/* +--------------------------------------------------------------------------- + EVENTS +--------------------------------------------------------------------------- +*/ + +qx.Proto._onaliaschange = function() { + this._updateImages(); +} + + + + + + +/* +--------------------------------------------------------------------------- + MODIFIERS +--------------------------------------------------------------------------- +*/ + +qx.Proto._modifyIconTheme = function(propValue, propOldValue, propData) +{ + propValue ? qx.manager.object.AliasManager.getInstance().add("icon", propValue.getSetting("imageUri")) : qx.manager.object.AliasManager.getInstance().remove("icon"); + return true; +} + +qx.Proto._modifyWidgetTheme = function(propValue, propOldValue, propData) +{ + propValue ? qx.manager.object.AliasManager.getInstance().add("widget", propValue.getSetting("imageUri")) : qx.manager.object.AliasManager.getInstance().remove("widget"); + return true; +} + + + + + + +/* +--------------------------------------------------------------------------- + PRELOAD API +--------------------------------------------------------------------------- +*/ + +qx.Proto.getPreloadImageList = function() +{ + var vPreload = {}; + + for (var vSource in this._sources) + { + if (this._sources[vSource]) { + vPreload[vSource] = true; + } + } + + return vPreload; +} + +qx.Proto.getPostPreloadImageList = function() +{ + var vPreload = {}; + + for (var vSource in this._sources) + { + if (!this._sources[vSource]) { + vPreload[vSource] = true; + } + } + + return vPreload; +} + + + + + + + +/* +--------------------------------------------------------------------------- + INTERNAL HELPER +--------------------------------------------------------------------------- +*/ + +qx.Proto._updateImages = function() +{ + var vAll = this.getAll(); + var vPreMgr = qx.manager.object.ImagePreloaderManager.getInstance(); + var vAliasMgr = qx.manager.object.AliasManager.getInstance(); + var vObject; + + // Recreate preloader of affected images + for (var vHashCode in vAll) + { + vObject = vAll[vHashCode]; + vObject.setPreloader(vPreMgr.create(vAliasMgr.resolvePath(vObject.getSource(), true))); + } + + return true; +} + + + + + + + +/* +--------------------------------------------------------------------------- + UTILITY +--------------------------------------------------------------------------- +*/ + +// TODO: rename to createIconThemeList +qx.Proto.createThemeList = function(vParent, xCor, yCor) +{ + var vButton; + var vThemes = this._iconThemes; + var vIcon = "icon/16/icons.png"; + var vPrefix = "Icon Theme: "; + var vEvent = "execute"; + + for (var vId in vThemes) + { + var vObj = vThemes[vId].getInstance(); + var vButton = new qx.ui.form.Button(vPrefix + vObj.getTitle(), vIcon); + + vButton.setLocation(xCor, yCor); + vButton.addEventListener(vEvent, new Function("qx.manager.object.ImageManager.getInstance().setIconThemeById('" + vId + "')")); + + vParent.add(vButton); + + yCor += 30; + } +} + +qx.Proto.preload = function(vPath) { + qx.manager.object.ImagePreloaderManager.getInstance().create(qx.manager.object.AliasManager.getInstance().resolvePath(vPath)); +} + + + + + + + + +/* +--------------------------------------------------------------------------- + DISPOSER +--------------------------------------------------------------------------- +*/ + +qx.Proto.dispose = function() +{ + if (this.getDisposed()) { + return; + } + + // Change event connection to AliasManager + qx.manager.object.AliasManager.getInstance().removeEventListener("change", this._onaliaschange, this); + + // Delete counter field + this._sources = null; + + // Themes + this._iconThemes = null; + this._widgetThemes = null; + + return qx.manager.object.ObjectManager.prototype.dispose.call(this); +} + + + + + + + + + +/* +--------------------------------------------------------------------------- + DEFER SINGLETON INSTANCE +--------------------------------------------------------------------------- +*/ + +/** + * Singleton Instance Getter + */ +qx.Class.getInstance = qx.util.Return.returnInstance; diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/ImagePreloaderManager.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/ImagePreloaderManager.js new file mode 100644 index 0000000000..8c0d68eb6b --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/ImagePreloaderManager.js @@ -0,0 +1,82 @@ +/* ************************************************************************ + + 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(ui_core) + +************************************************************************ */ + +/*! + This singleton manage all qx.io.image.Preloader instances. +*/ +qx.OO.defineClass("qx.manager.object.ImagePreloaderManager", qx.manager.object.ObjectManager, +function() { + qx.manager.object.ObjectManager.call(this); +}); + + + + + +/* +--------------------------------------------------------------------------- + METHODS +--------------------------------------------------------------------------- +*/ + +qx.Proto.add = function(vObject) { + this._objects[vObject.getUri()] = vObject; +} + +qx.Proto.remove = function(vObject) { + delete this._objects[vObject.getUri()]; +} + +qx.Proto.has = function(vSource) { + return this._objects[vSource] != null; +} + +qx.Proto.get = function(vSource) { + return this._objects[vSource]; +} + +qx.Proto.create = function(vSource) +{ + if (this._objects[vSource]) { + return this._objects[vSource]; + } + + return new qx.io.image.Preloader(vSource); +} + + + + + + +/* +--------------------------------------------------------------------------- + DEFER SINGLETON INSTANCE +--------------------------------------------------------------------------- +*/ + +/** + * Singleton Instance Getter + */ +qx.Class.getInstance = qx.util.Return.returnInstance; diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/MenuManager.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/MenuManager.js new file mode 100644 index 0000000000..b7914b4bcf --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/MenuManager.js @@ -0,0 +1,92 @@ +/* ************************************************************************ + + 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(ui_menu) + +************************************************************************ */ + +/*! + This singleton manages multiple instances of qx.ui.menu.Menu and their state. +*/ +qx.OO.defineClass("qx.manager.object.MenuManager", qx.manager.object.ObjectManager, +function(){ + qx.manager.object.ObjectManager.call(this); +}); + + + + + +/* +--------------------------------------------------------------------------- + METHODS +--------------------------------------------------------------------------- +*/ + +qx.Proto.update = function(vTarget, vEventName) +{ + var vMenu, vHashCode; + var vAll = this.getAll(); + + for (vHashCode in vAll) + { + vMenu = vAll[vHashCode]; + + if(!vMenu.getAutoHide()) { + continue; + } + + if (vTarget && vTarget.getMenu && vTarget.getMenu()) { + continue; + } + + // Hide on global events (mouseup, window focus, window blur, ...) + if (!vTarget) + { + vMenu.hide(); + continue; + } + + // Hide only if the target is not a button inside this + // or any sub menu and is not the opener + if (vMenu.getOpener() !== vTarget && ((vTarget && !vMenu.isSubButton(vTarget)) || vEventName !== "mousedown")) + { + vMenu.hide(); + continue; + } + } +} + + + + + + + +/* +--------------------------------------------------------------------------- + DEFER SINGLETON INSTANCE +--------------------------------------------------------------------------- +*/ + +/** + * Singleton Instance Getter + */ +qx.Class.getInstance = qx.util.Return.returnInstance; diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/ObjectManager.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/ObjectManager.js new file mode 100644 index 0000000000..c1160ab64b --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/ObjectManager.js @@ -0,0 +1,117 @@ +/* ************************************************************************ + + 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) + +************************************************************************ */ + +/* ************************************************************************ + + +************************************************************************ */ + +/*! + This class allows basic managment of assigned objects. +*/ +qx.OO.defineClass("qx.manager.object.ObjectManager", qx.core.Target, +function() +{ + qx.core.Target.call(this); + + this._objects = {}; +}); + + + + + +/* +--------------------------------------------------------------------------- + USER API +--------------------------------------------------------------------------- +*/ + +qx.Proto.add = function(vObject) +{ + if (this.getDisposed()) { + return; + } + + this._objects[vObject.toHashCode()] = vObject; + return true; +} + +qx.Proto.remove = function(vObject) +{ + if (this.getDisposed()) { + return; + } + + delete this._objects[vObject.toHashCode()]; + return true; +} + +qx.Proto.has = function(vObject) { + return this._objects[vObject.toHashCode()] != null; +} + +qx.Proto.get = function(vObject) { + return this._objects[vObject.toHashCode()]; +} + +qx.Proto.getAll = function() { + return this._objects; +} + +qx.Proto.enableAll = function() +{ + for (var vHashCode in this._objects) { + this._objects[vHashCode].setEnabled(true); + }; +}; + +qx.Proto.disableAll = function() +{ + for (var vHashCode in this._objects) { + this._objects[vHashCode].setEnabled(false); + }; +}; + + + + + +/* +--------------------------------------------------------------------------- + DISPOSER +--------------------------------------------------------------------------- +*/ + +qx.Proto.dispose = function() +{ + if(this.getDisposed()) { + return; + } + + if (this._objects) + { + for (var i in this._objects) { + delete this._objects[i]; + } + + delete this._objects; + } + + return qx.core.Target.prototype.dispose.call(this); +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/PopupManager.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/PopupManager.js new file mode 100644 index 0000000000..218c988c83 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/PopupManager.js @@ -0,0 +1,77 @@ +/* ************************************************************************ + + 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(ui_popup) + +************************************************************************ */ + +/*! + This singleton is used to manager multiple instances of popups and their state. +*/ +qx.OO.defineClass("qx.manager.object.PopupManager", qx.manager.object.ObjectManager, +function() { + qx.manager.object.ObjectManager.call(this); +}); + + + +/* +--------------------------------------------------------------------------- + METHODS +--------------------------------------------------------------------------- +*/ + +qx.Proto.update = function(vTarget) +{ + // be sure that target is correctly set (needed for contains() later) + if (!(vTarget instanceof qx.ui.core.Widget)) { + vTarget = null; + } + + var vPopup, vHashCode; + var vAll = this.getAll(); + + for (vHashCode in vAll) + { + vPopup = vAll[vHashCode]; + + if(!vPopup.getAutoHide() || vTarget == vPopup || vPopup.contains(vTarget)) { + continue; + } + + vPopup.hide(); + } +} + + + + + + +/* +--------------------------------------------------------------------------- + DEFER SINGLETON INSTANCE +--------------------------------------------------------------------------- +*/ + +/** + * Singleton Instance Getter + */ +qx.Class.getInstance = qx.util.Return.returnInstance; diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/ToolTipManager.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/ToolTipManager.js new file mode 100644 index 0000000000..f29be08eda --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/ToolTipManager.js @@ -0,0 +1,191 @@ +/* ************************************************************************ + + 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(ui_popup) + +************************************************************************ */ + +/*! + This manages ToolTip instances +*/ +qx.OO.defineClass("qx.manager.object.ToolTipManager", qx.manager.object.ObjectManager, +function() { + qx.manager.object.ObjectManager.call(this); +}); + +qx.OO.addProperty({ name : "currentToolTip", type : "object", instance : "qx.ui.popup.ToolTip" }); + + + + + + +/* +--------------------------------------------------------------------------- + MODIFIER +--------------------------------------------------------------------------- +*/ + +qx.Proto._modifyCurrentToolTip = function(propValue, propOldValue, propData) +{ + // Return if the new tooltip is a child of the old one + if(propOldValue && propOldValue.contains(propValue)) { + return; + } + + // If old tooltip existing, hide it and clear widget binding + if(propOldValue) + { + propOldValue.hide(); + + propOldValue._stopShowTimer(); + propOldValue._stopHideTimer(); + } + + // If new tooltip is not null, set it up and start the timer + if(propValue) { + propValue._startShowTimer(); + } + + return true; +} + + + + + +/* +--------------------------------------------------------------------------- + EVENT INTERFACE: MOUSE +--------------------------------------------------------------------------- +*/ + +qx.Proto.handleMouseOver = function(e) +{ + var vTarget = e.getTarget(); + var vToolTip; + + // Allows us to use DOM Nodes as tooltip target :) + if (!(vTarget instanceof qx.ui.core.Widget) && vTarget.nodeType == 1) { + vTarget = qx.event.handler.EventHandler.getTargetObject(vTarget); + } + + //Search first parent which has a tooltip + while(vTarget != null && !(vToolTip = vTarget.getToolTip())) { + vTarget = vTarget.getParent(); + } + + // Bind tooltip to widget + if (vToolTip != null) { + vToolTip.setBoundToWidget(vTarget); + } + + // Set Property + this.setCurrentToolTip(vToolTip); +} + +qx.Proto.handleMouseOut = function(e) +{ + var vTarget = e.getTarget(); + var vRelatedTarget = e.getRelatedTarget(); + + var vToolTip = this.getCurrentToolTip(); + + // If there was a tooltip and + // - the destination target is the current tooltip + // or + // - the current tooltip contains the destination target + if(vToolTip && (vRelatedTarget == vToolTip || vToolTip.contains(vRelatedTarget))) { + return; + } + + // If the destination target exists and the target contains it + if(vRelatedTarget && vTarget && vTarget.contains(vRelatedTarget)) { + return; + } + + // If there was a tooltip and there is no new one + if(vToolTip && !vRelatedTarget) { + this.setCurrentToolTip(null); + } +} + + + + + + + +/* +--------------------------------------------------------------------------- + EVENT INTERFACE: FOCUS +--------------------------------------------------------------------------- +*/ + +qx.Proto.handleFocus = function(e) +{ + var vTarget = e.getTarget(); + var vToolTip = vTarget.getToolTip(); + + // Only set new tooltip if focus widget + // has one + if(vToolTip != null) + { + // Bind tooltip to widget + vToolTip.setBoundToWidget(vTarget); + + // Set Property + this.setCurrentToolTip(vToolTip); + } +} + +qx.Proto.handleBlur = function(e) +{ + var vTarget = e.getTarget(); + + if(!vTarget) { + return; + } + + var vToolTip = this.getCurrentToolTip(); + + // Only set to null if blured widget is the + // one which has created the current tooltip + if(vToolTip && vToolTip == vTarget.getToolTip()) { + this.setCurrentToolTip(null); + } +} + + + + + + + +/* +--------------------------------------------------------------------------- + DEFER SINGLETON INSTANCE +--------------------------------------------------------------------------- +*/ + +/** + * Singleton Instance Getter + */ +qx.Class.getInstance = qx.util.Return.returnInstance; diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/WindowManager.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/WindowManager.js new file mode 100644 index 0000000000..96e13acd4d --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/manager/object/WindowManager.js @@ -0,0 +1,158 @@ +/* ************************************************************************ + + 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(ui_window) + +************************************************************************ */ + +/*! + This singleton manages qx.ui.window.Windows +*/ +qx.OO.defineClass("qx.manager.object.WindowManager", qx.manager.object.ObjectManager, +function() { + qx.manager.object.ObjectManager.call(this); +}); + +qx.OO.addProperty({ name : "activeWindow", type : "object" }); + + + + + + +/* +--------------------------------------------------------------------------- + MODIFIER +--------------------------------------------------------------------------- +*/ + +qx.Proto._modifyActiveWindow = function(propValue, propOldValue, propData) +{ + qx.manager.object.PopupManager.getInstance().update(); + + if (propOldValue) { + propOldValue.setActive(false); + } + + if (propValue) { + propValue.setActive(true); + } + + if (propOldValue && propOldValue.getModal()) { + propOldValue.getTopLevelWidget().release(propOldValue); + } + + if (propValue && propValue.getModal()) { + propValue.getTopLevelWidget().block(propValue); + } + + return true; +} + + + + + + +/* +--------------------------------------------------------------------------- + UTILITIES +--------------------------------------------------------------------------- +*/ + +qx.Proto.update = function(oTarget) +{ + var vWindow, vHashCode; + var vAll = this.getAll(); + + for (var vHashCode in vAll) + { + vWindow = vAll[vHashCode]; + + if(!vWindow.getAutoHide()) { + continue; + } + + vWindow.hide(); + } +} + + + + + +/* +--------------------------------------------------------------------------- + MANAGER INTERFACE +--------------------------------------------------------------------------- +*/ + +qx.Proto.compareWindows = function(w1, w2) +{ + switch(w1.getWindowManager().getActiveWindow()) + { + case w1: + return 1; + + case w2: + return -1; + } + + return w1.getZIndex() - w2.getZIndex(); +} + +qx.Proto.add = function(vWindow) +{ + qx.manager.object.ObjectManager.prototype.add.call(this, vWindow); + + // this.debug("Add: " + vWindow); + this.setActiveWindow(vWindow); +} + +qx.Proto.remove = function(vWindow) +{ + qx.manager.object.ObjectManager.prototype.remove.call(this, vWindow); + + // this.debug("Remove: " + vWindow); + + if (this.getActiveWindow() == vWindow) + { + var a = []; + for (var i in this._objects) { + a.push(this._objects[i]); + } + + var l = a.length; + + if (l==0) + { + this.setActiveWindow(null); + } + else if (l==1) + { + this.setActiveWindow(a[0]); + } + else if (l>1) + { + a.sort(this.compareWindows); + this.setActiveWindow(a[l-1]); + } + } +} |