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/ui/embed | |
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/ui/embed')
9 files changed, 2357 insertions, 0 deletions
diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/Flash.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/Flash.js new file mode 100644 index 0000000000..30f32319f2 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/Flash.js @@ -0,0 +1,468 @@ +/* ************************************************************************ + + 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) + +************************************************************************ */ + +/* ************************************************************************ + + +************************************************************************ */ + +/*! + Original non qooxdoo Version by Geoff Stearns + Flash detection and embed - http://blog.deconcept.com/flashobject/ + FlashObject is (c) 2005 Geoff Stearns and is released under the MIT License + http://www.opensource.org/licenses/mit-license.php + + Modified for qooxdoo by Sebastian Werner + Based on version 1.2.3 + Relicensed under LGPL in assent of Geoff Stearns +*/ + +qx.OO.defineClass("qx.ui.embed.Flash", qx.ui.basic.Terminator, +function(vSource, vVersion) +{ + qx.ui.basic.Terminator.call(this); + + // Use background handling of qx.ui.core.Widget instead + this._params = {}; + this._variables = {}; + + if(qx.util.Validation.isValidString(vSource)) { + this.setSource(vSource); + } + + this.setVersion(qx.util.Validation.isValidString(vVersion) ? vVersion : qx.ui.embed.Flash.MINREQUIRED); +}); + +qx.OO.addProperty({ name : "source", type : "string" }); +qx.OO.addProperty({ name : "version" }); + +qx.OO.addProperty({ name : "enableExpressInstall", type : "boolean", defaultValue : false }); +qx.OO.addProperty({ name : "enableDetection", type : "boolean", defaultValue : true }); +qx.OO.addProperty({ name : "redirectUrl", type : "string" }); + +qx.OO.addProperty({ name : "quality", type : "string", impl : "param", defaultValue : "high", possibleValues : [ "low", "autolow", "autohigh", "medium", "high", "best" ] }); +qx.OO.addProperty({ name : "scale", type : "string", impl : "param", defaultValue : "showall", possibleValues : [ "showall", "noborder", "excactfit", "noscale" ] }); +qx.OO.addProperty({ name : "wmode", type : "string", impl : "param", defaultValue : "", possibleValues : [ "window", "opaque", "transparent" ] }); +qx.OO.addProperty({ name : "play", type : "boolean", impl : "param", defaultValue : true }); +qx.OO.addProperty({ name : "loop", type : "boolean", impl : "param", defaultValue : true }); +qx.OO.addProperty({ name : "menu", type : "boolean", impl : "param", defaultValue : true }); + +qx.ui.embed.Flash.EXPRESSINSTALL = [6,0,65]; +qx.ui.embed.Flash.MINREQUIRED = "1"; +qx.ui.embed.Flash.PLAYERVERSION = null; +qx.ui.embed.Flash.PLUGINKEY = "Shockwave Flash"; +qx.ui.embed.Flash.ACTIVEXKEY = "ShockwaveFlash.ShockwaveFlash"; + + + + + +/* +--------------------------------------------------------------------------- + PLAYER VERSION CACHE +--------------------------------------------------------------------------- +*/ + +qx.ui.embed.Flash.getPlayerVersion = function() +{ + if (qx.ui.embed.Flash.PLAYERVERSION != null) { + return qx.ui.embed.Flash.PLAYERVERSION; + } + + var vPlayerVersion = new qx.type.Version(0,0,0); + + if(navigator.plugins && navigator.mimeTypes.length) + { + var x = navigator.plugins[qx.ui.embed.Flash.PLUGINKEY]; + + if(x && x.description) { + vPlayerVersion = new qx.type.Version(x.description.replace(/([a-z]|[A-Z]|\s)+/, '').replace(/(\s+r|\s+b[0-9]+)/, '.')); + } + } + else if (window.ActiveXObject) + { + try { + var axo = new ActiveXObject(qx.ui.embed.Flash.ACTIVEXKEY); + vPlayerVersion = new qx.type.Version(axo.GetVariable("$version").split(" ")[1].split(",")); + } + catch (e) {} + } + + return qx.ui.embed.Flash.PLAYERVERSION = vPlayerVersion; +} + + + + + + +/* +--------------------------------------------------------------------------- + BASICS +--------------------------------------------------------------------------- +*/ + +qx.Proto._version = null; +qx.Proto._source = ""; + +qx.Proto._applyElementData = function(el) +{ + qx.ui.basic.Terminator.prototype._applyElementData.call(this, el); + + // Check for ExpressInstall + this._expressInstall = false; + + if (this.getEnableExpressInstall()) + { + // check to see if we need to do an express install + var expressInstallReqVer = new qx.type.Version(qx.ui.embed.Flash.EXPRESSINSTALL); + var installedVer = qx.ui.embed.Flash.getPlayerVersion(); + + if (installedVer.versionIsValid(expressInstallReqVer) && !installedVer.versionIsValid(this._version)) { + this._expressInstall = true; + } + } + + // this.debug("ExpressInstall Enabled: " + this._expressInstall); + + // Apply HTML + if(!this.getEnableDetection() || this._expressInstall || qx.ui.embed.Flash.getPlayerVersion().versionIsValid(this._version)) + { + el.innerHTML = this.generateHTML(); + } + else + { + var redir = this.getRedirectUrl(); + + if(redir != "") { + document.location.replace(redir); + } + } +} + + + + + +/* +--------------------------------------------------------------------------- + MODIFIER +--------------------------------------------------------------------------- +*/ + +qx.Proto._modifySource = function(propValue, propOldValue, propName) +{ + this._source = qx.util.Validation.isValidString(propValue) ? qx.manager.object.AliasManager.getInstance().resolvePath(propValue) : ""; + return true; +} + +qx.Proto._modifyVersion = function(propValue, propOldValue, propData) +{ + if (this._version) + { + this._version.dispose(); + this._version = null; + } + + if (qx.util.Validation.isValidString(propValue)) { + this._version = new qx.type.Version(propValue); + } + + return true; +} + +qx.Proto._modifyParam = function(propValue, propOldValue, propData) +{ + this.setParam(propData.name, propValue.toString()); + return true; +} + + + + + +/* +--------------------------------------------------------------------------- + OVERWRITE BACKGROUND COLOR HANDLING +--------------------------------------------------------------------------- +*/ + +qx.Proto._modifyBackgroundColor = function(propValue, propOldValue, propData) +{ + if (propOldValue) { + propOldValue.remove(this); + } + + if (propValue) + { + this._applyBackgroundColor(propValue.getHex()); + propValue.add(this); + } + else + { + this._resetBackgroundColor(); + } + + return true; +} + +qx.Proto._applyBackgroundColor = function(vNewValue) { + this.setParam("bgcolor", vNewValue); +} + + + + +/* +--------------------------------------------------------------------------- + PARAMS +--------------------------------------------------------------------------- +*/ + +qx.Proto.setParam = function(name, value){ + this._params[name] = value; +} + +qx.Proto.getParam = function(name){ + return this._params[name]; +} + +qx.Proto.getParams = function() { + return this._params; +} + + + + + +/* +--------------------------------------------------------------------------- + VARIABLES +--------------------------------------------------------------------------- +*/ + +qx.Proto.setVariable = function(name, value){ + this._variables[name] = value; +} + +qx.Proto.getVariable = function(name){ + return this._variables[name]; +} + +qx.Proto.getVariables = function(){ + return this._variables; +} + + + + + +/* +--------------------------------------------------------------------------- + HTML UTILITIES +--------------------------------------------------------------------------- +*/ + +qx.Proto.generateParamTags = function() +{ + var vParams = this.getParams(); + var vParamTags = []; + + for (var vKey in vParams) + { + vParamTags.push("<param name='"); + vParamTags.push(vKey); + vParamTags.push("' value='"); + vParamTags.push(vParams[vKey]); + vParamTags.push("'/>"); + } + + return vParamTags.join(""); +} + +qx.Proto.getVariablePairs = function() +{ + var variables = this.getVariables(); + var variablePairs = []; + + for (var key in variables) { + variablePairs.push(key + "=" + variables[key]); + } + + return variablePairs.join("&"); +} + + + + + + +/* +--------------------------------------------------------------------------- + HTML GENERATOR +--------------------------------------------------------------------------- +*/ + +// Netscape Plugin Architecture +if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) +{ + qx.Proto.generateHTML = function() + { + var html = []; + + // Express Install Handling + if (this._expressInstall) + { + document.title = document.title.slice(0, 47) + ' - Flash Player Installation'; + + this.addVariable('MMredirectURL', escape(window.location)); + this.addVariable('MMdoctitle', document.title); + this.addVariable('MMplayerType', 'PlugIn'); + } + + html.push("<embed type='application/x-shockwave-flash' width='100%' height='100%' src='"); + html.push(this._source); + html.push("'"); + + var params = this.getParams(); + + for (var key in params) + { + html.push(" "); + html.push(key); + html.push("="); + html.push("'"); + html.push(params[key]); + html.push("'"); + } + + var pairs = this.getVariablePairs(); + + if (pairs.length > 0) + { + html.push(" "); + html.push("flashvars"); + html.push("="); + html.push("'"); + html.push(pairs); + html.push("'"); + } + + html.push("></embed>"); + + return html.join(""); + } +} + +// Internet Explorer ActiveX Architecture +else +{ + qx.Proto.generateHTML = function() + { + var html = []; + + // Express Install Handling + if (this._expressInstall) + { + document.title = document.title.slice(0, 47) + ' - Flash Player Installation'; + + this.addVariable("MMredirectURL", escape(window.location)); + this.addVariable("MMdoctitle", document.title); + this.addVariable("MMplayerType", "ActiveX"); + } + + html.push("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='100%' height='100%'>"); + html.push("<param name='movie' value='"); + html.push(this._source); + html.push("'/>"); + + var tags = this.generateParamTags(); + + if(tags.length > 0) { + html.push(tags); + } + + var pairs = this.getVariablePairs(); + + if(pairs.length > 0) + { + html.push("<param name='flashvars' value='"); + html.push(pairs); + html.push("'/>"); + } + + html.push("</object>"); + + return html.join(""); + } +} + + + + + + +/* +--------------------------------------------------------------------------- + METHODS TO GIVE THE LAYOUTERS INFORMATIONS +--------------------------------------------------------------------------- +*/ + +qx.Proto._isWidthEssential = qx.util.Return.returnTrue; +qx.Proto._isHeightEssential = qx.util.Return.returnTrue; + + + + +/* +--------------------------------------------------------------------------- + PREFERRED DIMENSIONS +--------------------------------------------------------------------------- +*/ + +qx.Proto._computePreferredInnerWidth = qx.util.Return.returnZero; +qx.Proto._computePreferredInnerHeight = qx.util.Return.returnZero; + + + + + +/* +--------------------------------------------------------------------------- + DISPOSER +--------------------------------------------------------------------------- +*/ + +qx.Proto.dispose = function() +{ + if (this.getDisposed()) { + return; + } + + delete this._source; + delete this._params; + delete this._variables; + + if (this._version) + { + this._version.dispose(); + this._version = null; + } + + qx.ui.basic.Terminator.prototype.dispose.call(this); +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/Gallery.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/Gallery.js new file mode 100644 index 0000000000..11a40e9046 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/Gallery.js @@ -0,0 +1,556 @@ +/* ************************************************************************ + + 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) + +************************************************************************ */ + +/* ************************************************************************ + + +************************************************************************ */ + +/** + * @event beforeToolTipAppear {qx.event.type.Event} + * @event loadComplete {qx.event.type.Event} + */ +qx.OO.defineClass("qx.ui.embed.Gallery", qx.ui.basic.Terminator, +function(vGalleryList) +{ + qx.ui.basic.Terminator.call(this); + + this._blank = qx.manager.object.AliasManager.getInstance().resolvePath("static/image/blank.gif"); + this._list = vGalleryList; + this._listSize = vGalleryList.length; + this._processedImages = 0; + + this.setOverflow("auto"); + + this.setHtmlProperty("className", "qx_ui_embed_Gallery"); + + this._manager = new qx.manager.selection.DomSelectionManager(this); + + this._manager.setMultiColumnSupport(true); + + this.addEventListener("mousedown", this._onmousedown); + this.addEventListener("mouseup", this._onmouseup); + this.addEventListener("mousemove", this._onmousemove); + + this.addEventListener("click", this._onclick); + this.addEventListener("dblclick", this._ondblclick); + + this.addEventListener("keypress", this._onkeypress); +}); + + + + + +/* +--------------------------------------------------------------------------- + PROPERTIES +--------------------------------------------------------------------------- +*/ + +qx.OO.addProperty({ name : "thumbMaxWidth", type : "number", defaultValue : 100 }); +qx.OO.addProperty({ name : "thumbMaxHeight", type : "number", defaultValue : 100 }); +qx.OO.addProperty({ name : "decorHeight", type : "number", defaultValue : 40 }); +qx.OO.addProperty({ name : "showTitle", type : "boolean", defaultValue : true }); +qx.OO.addProperty({ name : "showComment", type : "boolean", defaultValue : true }); + + + + + + +/* +--------------------------------------------------------------------------- + ELEMENT HANDLING +--------------------------------------------------------------------------- +*/ + +qx.Proto._applyElementData = function() { + this.getElement().appendChild(this.createView()); +} + + + + + + +/* +--------------------------------------------------------------------------- + UTILITIES +--------------------------------------------------------------------------- +*/ + +qx.Proto.getManager = function() { + return this._manager; +} + +qx.Proto.getList = function() { + return this._list; +} + +qx.Proto.update = function(vGalleryList) +{ + this._manager.deselectAll(); + + this._list = vGalleryList; + + var el = this.getElement(); + el.replaceChild(this.createView(), el.firstChild); +} + +qx.Proto.removeAll = function() +{ + this._manager.deselectAll(); + this.getElement().innerHTML = ""; +} + +qx.Proto.updateImageById = function(vId, vSrc, vWidth, vHeight) { + this.updateImageSrcById(vId, vSrc); + this.updateImageDimensionsById(vId, vWidth, vHeight); +} + +qx.Proto.updateImageDimensionsById = function(vId, vWidth, vHeight) { + this.updateImageDimensionsByPosition(this.getPositionById(vId), vWidth, vHeight); +} + +qx.Proto.updateImageDimensionsByPosition = function(vPos, vWidth, vHeight) { + // TBD: compare dimensions with max. thumb size and scale proportionally if necessary + if (vPos == -1) { + throw new Error("No valid Position: " + vPos); + } + + var cnode = this.getNodeByPosition(vPos).getElementsByTagName("img")[0]; + + cnode.width = vWidth; + cnode.height = vHeight; + + cnode.style.marginLeft = cnode.style.marginRight = Math.floor((this.getThumbMaxWidth()-vWidth)/2) + "px"; + cnode.style.marginTop = cnode.style.marginBottom = Math.floor((this.getThumbMaxHeight()-vHeight)/2) + "px"; + + this._list[vPos].thumbWidth = vWidth; + this._list[vPos].thumbHeight = vHeight; +} + +qx.Proto.updateImageSrcById = function(vId, vSrc) { + this.updateImageSrcByPosition(this.getPositionById(vId), vSrc); +} + +qx.Proto.updateImageSrcByPosition = function(vPos, vSrc) +{ + if (vPos == -1) { + throw new Error("No valid Position: " + vPos); + } + + var vNode = this.getNodeByPosition(vPos); + + vNode.getElementsByTagName("img")[0].src = vSrc; + this._list[vPos].src = vSrc; +} + +qx.Proto.deleteById = function(vId) { + this.deleteByPosition(this.getPositionById(vId)); +} + +qx.Proto.deleteByPosition = function(vPos) +{ + this._manager.deselectAll(); + + if (vPos == -1) { + throw new Error("No valid Position: " + vPos); + } + + var vNode = this.getNodeByPosition(vPos); + + if (vNode) { + vNode.parentNode.removeChild(vNode); + } + + this._list.splice(vPos, 1); +} + +qx.Proto.getPositionById = function(vId) +{ + for (var i=0, a=this._list, l=a.length; i<l; i++) { + if (a[i].id == vId) { + return i; + } + } + + return -1; +} + +qx.Proto.getEntryById = function(vId) { + return this.getEntryByPosition(this.getPositionById(vId)); +} + +qx.Proto.getNodeById = function(vId) { + return this.getNodeByPosition(this.getPositionById(vId)); +} + +qx.Proto.getEntryByPosition = function(vPosition) { + return vPosition == -1 ? null : this._list[vPosition]; +} + +qx.Proto.getNodeByPosition = function(vPosition) { + return vPosition == -1 ? null : this._frame.childNodes[vPosition]; +} + +qx.Proto.getEntryByNode = function(vNode) { + return this.getEntryById(vNode.id); +} + +qx.Proto.addFromPartialList = function(vPartialList) +{ + this.concat(vPartialList); + + for (var i=0, a=vPartialList, l=a.length; i<l; i++) { + this._frame.appendChild(this.createCell(a[i], i)); + } +} + +qx.Proto.addFromUpdatedList = function(vNewList) +{ + for (var a=vNewList, l=a.length, i=this._list.length; i<l; i++) { + this._frame.appendChild(this.createCell(a[i], i)); + } + + this._list = vNewList; +} + + + + +/* +--------------------------------------------------------------------------- + EVENT HANDLER +--------------------------------------------------------------------------- +*/ + +qx.Proto._onmousedown = function(e) +{ + var vItem = this.getListItemTarget(e.getDomTarget()); + + if (vItem) { + this._manager.handleMouseDown(vItem, e); + } +} + +qx.Proto._onmouseup = function(e) +{ + var vItem = this.getListItemTarget(e.getDomTarget()); + + if (vItem) { + this._manager.handleMouseUp(vItem, e); + } +} + +qx.Proto._onmousemove = function(e) +{ + if (qx.OO.isAvailable("qx.manager.object.ToolTipManager")) { + return; + } + + var vItem = this.getListItemTarget(e.getDomTarget()); + + if (vItem == this._lastItem) { + return; + } + + if (this._lastItem) + { + var vEventObject = new qx.event.type.MouseEvent("mouseout", e, false, this._lastItem); + qx.manager.object.ToolTipManager.getInstance().handleMouseOut(vEventObject); + vEventObject.dispose(); + } + + if (vItem) + { + if (this.hasEventListeners("beforeToolTipAppear")) { + this.dispatchEvent(new qx.event.type.DataEvent("beforeToolTipAppear", vItem), true); + } + + if (!this.getToolTip()) { + return; + } + + var vEventObject = new qx.event.type.MouseEvent("mouseout", e, false, vItem); + qx.manager.object.ToolTipManager.getInstance().handleMouseOver(vEventObject); + vEventObject.dispose(); + + this.setToolTip(null); + } + + this._lastItem = vItem; +} + +qx.Proto._onclick = function(e) +{ + var vItem = this.getListItemTarget(e.getDomTarget()); + + if (vItem) { + this._manager.handleClick(vItem, e); + } +} + +qx.Proto._ondblclick = function(e) +{ + var vItem = this.getListItemTarget(e.getDomTarget()); + + if (vItem) { + this._manager.handleDblClick(vItem, e); + } +} + +qx.Proto._onkeypress = function(e) { + this._manager.handleKeyPress(e); +} + +qx.Proto.getListItemTarget = function(dt) +{ + while(dt.className.indexOf("galleryCell") == -1 && dt.tagName.toLowerCase() != "body") { + dt = dt.parentNode; + } + + if (dt.tagName.toLowerCase() == "body") { + return null; + } + + return dt; +} + + + + + +/* +--------------------------------------------------------------------------- + SCROLL INTO VIEW +--------------------------------------------------------------------------- +*/ + +qx.Proto.scrollItemIntoView = function(vItem) +{ + this.scrollItemIntoViewX(vItem); + this.scrollItemIntoViewY(vItem); +} + +qx.Proto.scrollItemIntoViewX = function(vItem) { + qx.dom.ScrollIntoView.scrollX(vItem); +} + +qx.Proto.scrollItemIntoViewY = function(vItem) { + qx.dom.ScrollIntoView.scrollY(vItem); +} + + + + + +/* +--------------------------------------------------------------------------- + MANAGER REQUIREMENTS +--------------------------------------------------------------------------- +*/ + +qx.Proto.getItems = function() { + return this._frame.childNodes; +} + +qx.Proto.getFirstChild = function() { + return this._frame.childNodes[0]; +} + +qx.Proto.getLastChild = function() { + return this._frame.childNodes[this._frame.childNodes.length-1]; +} + + + + + + + +/* +--------------------------------------------------------------------------- + INTERNALS +--------------------------------------------------------------------------- +*/ + +qx.Proto.createView = function() +{ + var s = (new Date).valueOf(); + + if (!this._protoCell) { + this.createProtoCell(); + } + + this._frame = document.createElement("div"); + this._frame.className = "galleryFrame clearfix"; + + for (var i=0, a=this._list, l=a.length; i<l; i++) { + this._frame.appendChild(this.createCell(a[i], i)); + } + + return this._frame; +} + +qx.Proto.createCell = function(d, i) +{ + var cframe = this._protoCell.cloneNode(true); + + cframe.id = d.id; + cframe.pos = i; + + if (this.getShowTitle()) + { + cnode = cframe.childNodes[0]; + cnode.firstChild.nodeValue = d.title; + } + + var cnode = cframe.childNodes[this.getShowTitle() ? 1 : 0]; + this.createImageCell(cnode, d); + + if (this.getShowComment()) + { + cnode = cframe.childNodes[this.getShowTitle() ? 2 : 1]; + cnode.firstChild.nodeValue = d.comment; + } + + return cframe; +} + +qx.Proto._mshtml = qx.sys.Client.getInstance().isMshtml(); + +qx.Proto.createImageCell = function(inode, d) +{ + if (this.hasEventListeners("loadComplete")) + { + inode.onload = qx.ui.embed.Gallery.imageOnLoad; + inode.onerror = qx.ui.embed.Gallery.imageOnError; + inode.gallery = this; + } + + if (this._mshtml) { + inode.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + d.src + "',sizingMethod='scale')"; + } else { + inode.src = d.src; + } + + inode.width = d.thumbWidth + 2; + inode.height = d.thumbHeight + 2; + inode.style.marginLeft = inode.style.marginRight = Math.floor((this.getThumbMaxWidth()-d.thumbWidth)/2) + "px"; + inode.style.marginTop = inode.style.marginBottom = Math.floor((this.getThumbMaxHeight()-d.thumbHeight)/2) + "px"; +} + +qx.Proto.imageOnComplete = function() +{ + this._processedImages++; + + if(this._processedImages == this._listSize) { + this.dispatchEvent(new qx.event.type.Event("loadComplete"), true); + } +} + +qx.ui.embed.Gallery.imageOnLoad = function() +{ + this.gallery.imageOnComplete(); + this.gallery = null; + this.onload = null; + this.onerror = null; +} + +qx.ui.embed.Gallery.imageOnError = function() +{ + this.gallery.imageOnComplete(); + this.gallery = null; + this.onload = null; + this.onerror = null; +} + +qx.Proto.createProtoCell = function() +{ + var frame = this._protoCell = document.createElement("div"); + frame.className = "galleryCell"; + frame.unselectable = "on"; + frame.style.width = (this.getThumbMaxWidth() + 2) + "px"; + frame.style.height = (this.getThumbMaxHeight() + this.getDecorHeight() + 2) + "px"; + + if (this.getShowTitle()) + { + var title = document.createElement("div"); + title.className = "galleryTitle"; + title.unselectable = "on"; + var ttext = document.createTextNode("-"); + title.appendChild(ttext); + + frame.appendChild(title); + } + + var image = new Image(); + image.src = this._blank; + frame.appendChild(image); + + if (this.getShowComment()) + { + var comment = document.createElement("div"); + comment.className = "galleryComment"; + comment.unselectable = "on"; + var ctext = document.createTextNode("-"); + comment.appendChild(ctext); + + frame.appendChild(comment); + } +} + + + + + +/* +--------------------------------------------------------------------------- + DISPOSER +--------------------------------------------------------------------------- +*/ + +qx.Proto.dispose = function() +{ + if (this.getDisposed()) { + return true; + } + + this._list = null; + this._protoCell = null; + this._frame = null; + + if (this._manager) + { + this._manager.dispose(); + this._manager = null; + } + + this.removeEventListener("mousedown", this._onmousedown); + this.removeEventListener("mouseup", this._onmouseup); + this.removeEventListener("mousemove", this._onmousemove); + + this.removeEventListener("click", this._onclick); + this.removeEventListener("dblclick", this._ondblclick); + + this.removeEventListener("keypress", this._onkeypress); + + return qx.ui.basic.Terminator.prototype.dispose.call(this); +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/GalleryList.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/GalleryList.js new file mode 100644 index 0000000000..c95b014f6d --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/GalleryList.js @@ -0,0 +1,400 @@ +/* ************************************************************************ + + 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) + +************************************************************************ */ + +/* ************************************************************************ + + +************************************************************************ */ + +/** + * @event loadComplete {qx.event.type.Event} + */ +qx.OO.defineClass("qx.ui.embed.GalleryList", qx.ui.basic.Terminator, +function(galleryList) +{ + qx.ui.basic.Terminator.call(this); + + this._blank = qx.manager.object.AliasManager.getInstance().resolvePath("static/image/blank.gif"); + this._list = galleryList; + this._listSize = galleryList.length; + this._processedImages = 0; + + this.setOverflow("auto"); + + this.setHtmlProperty("className", "qx_ui_embed_GalleryList"); + + this._manager = new qx.manager.selection.DomSelectionManager(this); + + this.addEventListener("mousedown", this._onmousedown); + this.addEventListener("mouseup", this._onmouseup); + this.addEventListener("click", this._onclick); + this.addEventListener("dblclick", this._ondblclick); + this.addEventListener("keypress", this._onkeypress); +}); + +qx.OO.addProperty({ name : "thumbMaxWidth", type : "number", defaultValue : 60 }); +qx.OO.addProperty({ name : "thumbMaxHeight", type : "number", defaultValue : 60 }); +qx.OO.addProperty({ name : "decorHeight", type : "number", defaultValue : 40 }); + + + + + +/* +--------------------------------------------------------------------------- + ELEMENT HANDLING +--------------------------------------------------------------------------- +*/ + +qx.Proto._applyElementData = function() { + this.getElement().appendChild(this.createView()); +} + + + +/* +--------------------------------------------------------------------------- + UTILITIES +--------------------------------------------------------------------------- +*/ + +qx.Proto.getManager = function() { + return this._manager; +} + + +qx.Proto.update = function(vGalleryList) +{ + this._manager.deselectAll(); + + this._list = vGalleryList; + + var el = this.getElement(); + el.replaceChild(this.createView(), el.firstChild); +} + + +qx.Proto.removeAll = function() +{ + this._manager.deselectAll(); + this.getElement().innerHTML = ""; +} + + +/* +--------------------------------------------------------------------------- + EVENT HANDLER +--------------------------------------------------------------------------- +*/ + +qx.Proto._onmousedown = function(e) +{ + var vItem = this.getListItemTarget(e.getDomTarget()); + + if (vItem) { + this._manager.handleMouseDown(vItem, e); + } +} + +qx.Proto._onmouseup = function(e) +{ + var vItem = this.getListItemTarget(e.getDomTarget()); + + if (vItem) { + this._manager.handleMouseUp(vItem, e); + } +} + +qx.Proto._onclick = function(e) +{ + var vItem = this.getListItemTarget(e.getDomTarget()); + + if (vItem) { + this._manager.handleClick(vItem, e); + } +} + +qx.Proto._ondblclick = function(e) +{ + var vItem = this.getListItemTarget(e.getDomTarget()); + + if (vItem) { + this._manager.handleDblClick(vItem, e); + } +} + +qx.Proto._onkeypress = function(e) { + this._manager.handleKeyPress(e); +} + +qx.Proto.getListItemTarget = function(dt) +{ + while(dt.className.indexOf("galleryCell") == -1 && dt.tagName.toLowerCase() != "body") { + dt = dt.parentNode; + } + + if (dt.tagName.toLowerCase() == "body") { + return null; + } + + return dt; +} + + + + + + + +/* +--------------------------------------------------------------------------- + SCROLL INTO VIEW +--------------------------------------------------------------------------- +*/ + +qx.Proto.scrollItemIntoView = function(vItem) +{ + this.scrollItemIntoViewX(vItem); + this.scrollItemIntoViewY(vItem); +} + +qx.Proto.scrollItemIntoViewX = function(vItem) { + qx.dom.ScrollIntoView.scrollX(vItem); +} + +qx.Proto.scrollItemIntoViewY = function(vItem) { + qx.dom.ScrollIntoView.scrollY(vItem); +} + + + + + + + + + +/* +--------------------------------------------------------------------------- + SELECTION MANAGER API +--------------------------------------------------------------------------- +*/ + +qx.Proto.getItems = function() { + return this._frame.childNodes; +} + +qx.Proto.getFirstChild = function() { + return this._frame.childNodes[0]; +} + +qx.Proto.getLastChild = function() { + return this._frame.childNodes[this._frame.childNodes.length-1]; +} + + + + + + +/* +--------------------------------------------------------------------------- + CREATE VIEW +--------------------------------------------------------------------------- +*/ + +qx.Proto.createView = function() +{ + var s = (new Date).valueOf(); + + var protoCell = this.createProtoCell(this.getThumbMaxHeight()); + var frame = this._frame = document.createElement("div"); + + this._frame.className = "galleryFrame clearfix"; + + var cframe, cnode; + + for (var i=0, a=this._list, l=a.length, d; i<l; i++) + { + d = a[i]; + + cframe = protoCell.cloneNode(true); + + cframe.id = d.id; + cframe.pos = i; + + cnode = cframe.childNodes[0]; + cnode.firstChild.nodeValue = d.number; + + cnode = cframe.childNodes[1].firstChild; + this.createImageCell(cnode, d); + + cnode = cframe.childNodes[2].firstChild; + cnode.firstChild.nodeValue = d.title; + + cnode = cframe.childNodes[2].lastChild; + cnode.firstChild.nodeValue = d.comment; + + frame.appendChild(cframe); + } + + return frame; +} + +qx.Proto._mshtml = qx.sys.Client.getInstance().isMshtml(); + +qx.Proto.createImageCell = function(inode, d) +{ + if (this.hasEventListeners("loadComplete")) { + inode.onload = qx.ui.embed.GalleryList.imageOnLoad; + inode.onerror = qx.ui.embed.GalleryList.imageOnError; + inode.gallery = this; + } + + inode.width = d.thumbWidth; + inode.height = d.thumbHeight; + + if (this._mshtml) { + inode.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + d.src + "',sizingMethod='scale')"; + } else { + inode.src = d.src; + } + + inode.style.marginLeft = inode.style.marginRight = Math.floor((this.getThumbMaxWidth()-d.thumbWidth)/2) + "px"; + inode.style.marginTop = inode.style.marginBottom = Math.floor((this.getThumbMaxHeight()-d.thumbHeight)/2) + "px"; +} + +qx.Proto.createProtoCell = function(tHeight) +{ + var frame = document.createElement("div"); + frame.className = "galleryCell"; + frame.unselectable = "on"; + frame.style.height = (tHeight + 2) + "px"; + + var number = document.createElement("div"); + number.className = "galleryNumber"; + number.unselectable = "on"; + var ntext = document.createTextNode("-"); + number.appendChild(ntext); + + var imageContainer = document.createElement("div"); + imageContainer.className = "galleryImageContainer"; + imageContainer.unselectable = "on"; + + var image = new Image(); + image.src = this._blank; + + imageContainer.appendChild(image); + + var text = document.createElement("div"); + text.className = "galleryText"; + text.unselectable = "on"; + text.style.width = (this.getWidth()-100-this.getThumbMaxWidth()) + "px"; + + var title = document.createElement("h3"); + var ttext = document.createTextNode("-"); + title.appendChild(ttext); + title.unselectable = "on"; + text.appendChild(title); + + var comment = document.createElement("p"); + var ctext = document.createTextNode("-"); + comment.appendChild(ctext); + comment.unselectable = "on"; + text.appendChild(comment); + + + frame.appendChild(number); + frame.appendChild(imageContainer); + frame.appendChild(text); + + return frame; +} + + + + + + + +/* +--------------------------------------------------------------------------- + PRELOADING +--------------------------------------------------------------------------- +*/ + +qx.Proto.imageOnComplete = function() +{ + this._processedImages++; + + if(this._processedImages == this._listSize) { + this.dispatchEvent(new qx.event.type.Event("loadComplete"), true); + } +} + +qx.ui.embed.GalleryList.imageOnLoad = function() +{ + this.gallery.imageOnComplete(); + this.gallery = null; + this.onload = null; + this.onerror = null; +} + +qx.ui.embed.GalleryList.imageOnError = function() +{ + this.gallery.imageOnComplete(); + this.gallery = null; + this.onload = null; + this.onerror = null; +} + + + + + + + +/* +--------------------------------------------------------------------------- + DISPOSER +--------------------------------------------------------------------------- +*/ + +qx.Proto.dispose = function() +{ + if (this.getDisposed()) { + return true; + } + + this._list = null; + this._frame = null; + + if (this._manager) + { + this._manager.dispose(); + this._manager = null; + } + + this.removeEventListener("mousedown", this._onmousedown); + this.removeEventListener("mouseup", this._onmouseup); + this.removeEventListener("click", this._onclick); + this.removeEventListener("dblclick", this._ondblclick); + this.removeEventListener("keydown", this._onkeydown); + + return qx.ui.basic.Terminator.prototype.dispose.call(this); +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/HtmlEmbed.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/HtmlEmbed.js new file mode 100644 index 0000000000..0649c69499 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/HtmlEmbed.js @@ -0,0 +1,112 @@ +/* ************************************************************************ + + 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_basic) +#require(qx.renderer.font.FontCache) +#after(qx.renderer.font.FontObject) + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.embed.HtmlEmbed", qx.ui.basic.Terminator, +function(vHtml) +{ + qx.ui.basic.Terminator.call(this); + + if (qx.util.Validation.isValidString(vHtml)) { + this.setHtml(vHtml); + } +}); + + + + +/* +--------------------------------------------------------------------------- + PROPERTIES +--------------------------------------------------------------------------- +*/ + +/*! + Any text string which can contain HTML, too +*/ +qx.OO.addProperty({ name : "html", type : "string" }); + +/*! + The font property describes how to paint the font on the widget. +*/ +qx.OO.addProperty({ name : "font", type : "object", instance : "qx.renderer.font.Font", convert : qx.renderer.font.FontCache, allowMultipleArguments : true }); + +/*! + Wrap the text? +*/ +qx.OO.addProperty({ name : "wrap", type : "boolean", defaultValue : true }); + + + + +/* +--------------------------------------------------------------------------- + MODIFIER +--------------------------------------------------------------------------- +*/ + +qx.Proto._modifyHtml = function() +{ + if (this._isCreated) { + this._syncHtml(); + } + + return true; +} + +qx.Proto._modifyFont = function(propValue, propOldValue, propData) +{ + if (propValue) { + propValue._applyWidget(this); + } else if (propOldValue) { + propOldValue._resetWidget(this); + } + + return true; +} + +qx.Proto._modifyWrap = function(propValue, propOldValue, propData) +{ + this.setStyleProperty("whiteSpace", propValue ? "normal" : "nowrap"); + return true; +} + + + + + +/* +--------------------------------------------------------------------------- + ELEMENT HANDLING +--------------------------------------------------------------------------- +*/ + +qx.Proto._applyElementData = function() { + this._syncHtml(); +} + +qx.Proto._syncHtml = function() { + this.getElement().innerHTML = this.getHtml(); +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/IconHtmlEmbed.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/IconHtmlEmbed.js new file mode 100644 index 0000000000..08e9aa9e8b --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/IconHtmlEmbed.js @@ -0,0 +1,134 @@ +/* ************************************************************************ + + 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) + +************************************************************************ */ + +/* ************************************************************************ + + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.embed.IconHtmlEmbed", qx.ui.embed.HtmlEmbed, +function(vHtml, vIcon, vIconWidth, vIconHeight) +{ + qx.ui.embed.HtmlEmbed.call(this, vHtml); + + if (typeof vIcon != "undefined") + { + this.setIcon(vIcon); + + if (typeof vIconWidth != "undefined") { + this.setIconWidth(vIconWidth); + } + + if (typeof vIconHeight != "undefined") { + this.setIconHeight(vIconWidth); + } + } +}); + + + + +/* +--------------------------------------------------------------------------- + PROPERTIES +--------------------------------------------------------------------------- +*/ + +/*! + Any URI String supported by qx.ui.basic.Image to display a icon +*/ +qx.OO.addProperty({ name : "icon", type : "string", impl : "html" }); + +/*! + The width of the icon. + If configured, this makes qx.ui.embed.IconHtmlEmbed a little bit faster as it does not need to wait until the image loading is finished. +*/ +qx.OO.addProperty({ name : "iconWidth", type : "number", impl : "html" }); + +/*! + The height of the icon + If configured, this makes qx.ui.embed.IconHtmlEmbed a little bit faster as it does not need to wait until the image loading is finished. +*/ +qx.OO.addProperty({ name : "iconHeight", type : "number", impl : "html" }); + +/*! + Space in pixels between the icon and the HTML. +*/ +qx.OO.addProperty({ name : "spacing", type : "number", defaultValue : 4, impl : "html" }); + + + + + +/* +--------------------------------------------------------------------------- + UTILITIES +--------------------------------------------------------------------------- +*/ + +qx.Proto._mshtml = qx.sys.Client.getInstance().isMshtml(); + +qx.Proto._syncHtml = function() +{ + var vHtml = []; + + if (qx.util.Validation.isValidString(this.getIcon())) + { + vHtml.push("<img src=\""); + vHtml.push(qx.manager.object.AliasManager.getInstance().resolvePath(this._mshtml ? "static/image/blank.gif" : this.getIcon())); + vHtml.push("\" style=\"vertical-align:middle;"); + + if (qx.util.Validation.isValidNumber(this.getSpacing())) + { + vHtml.push("margin-right:"); + vHtml.push(this.getSpacing()); + vHtml.push("px;"); + } + + if (qx.util.Validation.isValidNumber(this.getIconWidth())) + { + vHtml.push("width:"); + vHtml.push(this.getIconWidth()); + vHtml.push("px;"); + } + + if (qx.util.Validation.isValidNumber(this.getIconHeight())) + { + vHtml.push("height:"); + vHtml.push(this.getIconHeight()); + vHtml.push("px;"); + } + + if (this._mshtml) + { + vHtml.push("filter:"); + vHtml.push("progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"); + vHtml.push(qx.manager.object.AliasManager.getInstance().resolvePath(this.getIcon())); + vHtml.push("',sizingMethod='scale')"); + vHtml.push(";"); + } + + vHtml.push("\"/>"); + } + + if (qx.util.Validation.isValidString(this.getHtml())) { + vHtml.push(this.getHtml()); + } + + this.getElement().innerHTML = vHtml.join(""); +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/Iframe.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/Iframe.js new file mode 100644 index 0000000000..ef10aa2730 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/Iframe.js @@ -0,0 +1,430 @@ +/* ************************************************************************ + + 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) + * Til Schneider (til132) + +************************************************************************ */ + +/* ************************************************************************ + + +************************************************************************ */ + +/** + * @event load {qx.event.type.Event} + */ +qx.OO.defineClass("qx.ui.embed.Iframe", qx.ui.basic.Terminator, +function(vSource) +{ + // ********************************************************************** + // INIT + // ********************************************************************** + qx.ui.basic.Terminator.call(this); + + this.setSelectable(false); + this.setTabIndex(0); + + var o = this; + this.__onreadystatechange = function(e) { return o._onreadystatechange(e); } + this.__onload = function(e) { return o._onload(e); } + + if (qx.util.Validation.isValid(vSource)) { + this.setSource(vSource); + } +}); + +qx.OO.changeProperty({ name : "appearance", type : "string", defaultValue : "iframe" }); + + + + + + +/* +--------------------------------------------------------------------------- + PROPERTIES +--------------------------------------------------------------------------- +*/ + +qx.OO.addProperty({ name : "source", type : "string" }); + +qx.OO.addProperty({ name : "frameName", type : "string" }); + + + + + + +/* +--------------------------------------------------------------------------- + INTERNAL PROPERTIES +--------------------------------------------------------------------------- +*/ + + +// iframe DOM node + +qx.Proto._iframeNode = null; + +qx.Proto.getIframeNode = function() { + return this._iframeNode; +} + +qx.Proto.setIframeNode = function(vIframeNode) { + return this._iframeNode = vIframeNode; +} + + +// blocker div DOM node + +qx.Proto._blockerNode = null; + +qx.Proto.getBlockerNode = function() { + return this._blockerNode; +} + +qx.Proto.setBlockerNode = function(vBlockerNode) { + return this._blockerNode = vBlockerNode; +} + + + + +/* +--------------------------------------------------------------------------- + METHODS +--------------------------------------------------------------------------- +*/ + +qx.Proto.reload = function() { + this._applySource(); +} + + +qx.Proto.block = function() +{ + if (this._blockerNode) { + this._blockerNode.style.display = ""; + } +}; + +qx.Proto.release = function() +{ + if (this._blockerNode) { + this._blockerNode.style.display = "none"; + } +}; + + + + + +/* +--------------------------------------------------------------------------- + MODIFIER +--------------------------------------------------------------------------- +*/ + +qx.Proto._modifyElement = function(propValue, propOldValue, propData) +{ + + var iframeNode = this.getIframeNode(); + + if (!iframeNode) + { + + qx.ui.embed.Iframe.initIframe(this.getFrameName()); + + // clone proto element and assign iframe + iframeNode = this.setIframeNode(qx.ui.embed.Iframe._element.cloneNode(true)); + + qx.ui.embed.Iframe.initBlocker(); + + // clone proto blocker + blockerNode = this.setBlockerNode(qx.ui.embed.Iframe._blocker.cloneNode(true)); + + if (qx.sys.Client.getInstance().isMshtml()) { + iframeNode.onreadystatechange = this.__onreadystatechange; + } else { + iframeNode.onload = this.__onload; + } + } + + this._applySource(); + + propValue.appendChild(iframeNode); + propValue.appendChild(blockerNode); + + // create basic widget + qx.ui.basic.Terminator.prototype._modifyElement.call(this, propValue, propOldValue, propData); + + return true; +} + + +qx.Proto._beforeAppear = function() { + qx.ui.basic.Terminator.prototype._beforeAppear.call(this); + + // register to iframe manager as active widget + qx.manager.object.IframeManager.getInstance().add(this); +}; + + +qx.Proto._beforeDisappear = function() { + qx.ui.basic.Terminator.prototype._beforeDisappear.call(this); + + // deregister from iframe manager + qx.manager.object.IframeManager.getInstance().remove(this); +}; + + +qx.Proto._modifySource = function(propValue, propOldValue, propData) +{ + if(this.isCreated()) { + this._applySource(); + } + + return true; +} + +qx.Proto._applySource = function() +{ + var currentSource = this.getSource(); + + if (qx.util.Validation.isInvalidString(currentSource)) { + currentSource = qx.manager.object.AliasManager.getInstance().resolvePath("static/image/blank.gif"); + } + + this._isLoaded = false; + this.getIframeNode().src = currentSource; +} + +qx.Proto._modifyFrameName = function (propValue, propOldValue, propName, uniqModIds) +{ + if( this.isCreated()) { + throw new Error("Not allowed to set frame name after it has been created"); + } + + return true; +} + + + + + + + +/* +--------------------------------------------------------------------------- + EVENT HANDLER +--------------------------------------------------------------------------- +*/ + +qx.Proto._onreadystatechange = function() +{ + if (this.getIframeNode().readyState == "complete") { + this.dispatchEvent(new qx.event.type.Event("load"), true); + } +} + +qx.Proto._onload = function() +{ + this._isLoaded = true; + this.dispatchEvent(new qx.event.type.Event("load"), true); +} + + + + + + +/* +--------------------------------------------------------------------------- + WINDOW & DOCUMENT ACCESS +--------------------------------------------------------------------------- +*/ + +if (qx.sys.Client.getInstance().isMshtml()) +{ + qx.Proto.getContentWindow = function() + { + if (this.isCreated()) { + try { return this.getIframeNode().contentWindow; } + catch (ex) {} + } + + return null; + } + + qx.Proto.getContentDocument = function() + { + var win = this.getContentWindow(); + if (win) { + try { return win.document; } + catch (ex) {} + } + + return null; + } +} +else +{ + qx.Proto.getContentWindow = function() + { + var doc = this.getContentDocument(); + return doc ? doc.defaultView : null; + } + + qx.Proto.getContentDocument = function() + { + if (this.isCreated()) { + try { return this.getIframeNode().contentDocument; } + catch (ex) {} + } + + return null; + } +} + + + + + + + +/* +--------------------------------------------------------------------------- + LOAD STATUS +--------------------------------------------------------------------------- +*/ + +qx.Proto._isLoaded = false; + +if (qx.sys.Client.getInstance().isMshtml()) +{ + qx.Proto.isLoaded = function() + { + var doc = this.getContentDocument(); + return doc ? doc.readyState == "complete" : false; + } +} +else +{ + qx.Proto.isLoaded = function() + { + return this._isLoaded; + } +} + + + + + + +/* +--------------------------------------------------------------------------- + DISPOSE +--------------------------------------------------------------------------- +*/ + +qx.Proto.dispose = function() +{ + if (this.getDisposed()) { + return; + } + + this.__onreadystatechange = this.__onload = null; + + if (this._iframeNode) + { + this._iframeNode.onreadystatechange = null; + this._iframeNode.onload = null; + + this._iframeNode = null; + } + + qx.ui.basic.Terminator.prototype.dispose.call(this); +} + + + + + + +/* +--------------------------------------------------------------------------- + INIT +--------------------------------------------------------------------------- +*/ +qx.ui.embed.Iframe.initIframe = function(vFrameName) +{ + if (qx.ui.embed.Iframe._element && !vFrameName) { + return; + } + + if (vFrameName && qx.sys.Client.getInstance().isMshtml()) { + var f = qx.ui.embed.Iframe._element = document.createElement('<iframe name="' + vFrameName + '"></iframe>'); + } else { + var f = qx.ui.embed.Iframe._element = document.createElement("iframe"); + if (vFrameName) { + f.name = vFrameName; + } + } + + f.frameBorder = "0"; + f.frameSpacing = "0"; + + f.marginWidth = "0"; + f.marginHeight = "0"; + + f.width = "100%"; + f.height = "100%"; + + f.hspace = "0"; + f.vspace = "0"; + + f.border = "0"; + f.scrolling = "auto"; + f.unselectable = "on"; + f.allowTransparency = "true"; + + f.style.position = "absolute"; + f.style.top = 0; + f.style.left = 0; + }; + +qx.ui.embed.Iframe.initBlocker = function() +{ + + if (qx.ui.embed.Iframe._blocker) { + return; + } + + var b = qx.ui.embed.Iframe._blocker = document.createElement("div"); + + if (qx.sys.Client.getInstance().isMshtml()) { + b.style.backgroundImage = "url(" + qx.manager.object.AliasManager.getInstance().resolvePath("static/image/blank.gif") + ")"; + } + + b.style.position = "absolute"; + b.style.top = 0; + b.style.left = 0; + b.style.width = "100%"; + b.style.height = "100%"; + b.style.zIndex = 1; + b.style.display = "none"; +}; + + diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/LinkEmbed.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/LinkEmbed.js new file mode 100644 index 0000000000..97bf2a0965 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/LinkEmbed.js @@ -0,0 +1,88 @@ +/* ************************************************************************ + + 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) + +************************************************************************ */ + +/* ************************************************************************ + + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.embed.LinkEmbed", qx.ui.embed.HtmlEmbed, +function(vHtml, vUri, vTarget) +{ + qx.ui.embed.HtmlEmbed.call(this, vHtml); + + if (typeof vUri != "undefined") { + this.setUri(vUri); + } + + if (typeof vTarget != "undefined") { + this.setTarget(vTarget); + } +}); + + + + + + +/* +--------------------------------------------------------------------------- + PROPERTIES +--------------------------------------------------------------------------- +*/ + +/*! + Any valid html URI +*/ +qx.OO.addProperty({ name : "uri", type : "string", defaultValue : "#", impl : "html" }); + +/*! + Any valid html target +*/ +qx.OO.addProperty({ name : "target", type : "string", defaultValue : "_blank", impl : "html" }); + + + + + + +/* +--------------------------------------------------------------------------- + UTILITIES +--------------------------------------------------------------------------- +*/ + +qx.ui.embed.LinkEmbed.LINK_START = "<a target='"; +qx.ui.embed.LinkEmbed.HREF_START = "' href='"; +qx.ui.embed.LinkEmbed.HREF_STOP = "'>"; +qx.ui.embed.LinkEmbed.LINK_STOP = "</a>"; + +qx.Proto._syncHtml = function() +{ + var vHtml = []; + + vHtml.push(qx.ui.embed.LinkEmbed.LINK_START); + vHtml.push(this.getTarget()); + vHtml.push(qx.ui.embed.LinkEmbed.HREF_START); + vHtml.push(this.getUri()); + vHtml.push(qx.ui.embed.LinkEmbed.HREF_STOP); + vHtml.push(this.getHtml()); + vHtml.push(qx.ui.embed.LinkEmbed.LINK_STOP); + + this.getElement().innerHTML = vHtml.join(""); +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/NodeEmbed.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/NodeEmbed.js new file mode 100644 index 0000000000..e5e9fd0d91 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/NodeEmbed.js @@ -0,0 +1,48 @@ +/* ************************************************************************ + + 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_basic) + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.embed.NodeEmbed", qx.ui.basic.Terminator, +function(vId) +{ + qx.ui.basic.Terminator.call(this); + + if (qx.util.Validation.isValidString(vId)) { + this.setSourceNodeId(vId); + } +}); + +qx.OO.addProperty({ name : "sourceNodeId", type : "string" }); + +qx.Proto._createElementImpl = function() +{ + var vNode = document.getElementById(this.getSourceNodeId()); + + if (!vNode) { + throw new Error("Could not find source node with ID: " + this.getSourceNodeId()); + } + + vNode.style.display = ""; + + return this.setElement(vNode); +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/TextEmbed.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/TextEmbed.js new file mode 100644 index 0000000000..d702eef789 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/embed/TextEmbed.js @@ -0,0 +1,121 @@ +/* ************************************************************************ + + 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_basic) +#require(qx.renderer.font.FontCache) +#after(qx.renderer.font.FontObject) + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.embed.TextEmbed", qx.ui.basic.Terminator, +function(vText) +{ + qx.ui.basic.Terminator.call(this); + + if (qx.util.Validation.isValidString(vText)) { + this.setText(vText); + } +}); + + + + +/* +--------------------------------------------------------------------------- + PROPERTIES +--------------------------------------------------------------------------- +*/ + +/*! + Any text string which can contain TEXT, too +*/ +qx.OO.addProperty({ name : "text", type : "string" }); + +/*! + The font property describes how to paint the font on the widget. +*/ +qx.OO.addProperty({ name : "font", type : "object", instance : "qx.renderer.font.Font", convert : qx.renderer.font.FontCache, allowMultipleArguments : true }); + +/*! + Wrap the text? +*/ +qx.OO.addProperty({ name : "wrap", type : "boolean", defaultValue : true }); + +/** The horizontal alignment of the text. */ +qx.OO.addProperty({ name : "textAlign", type : "string", defaultValue : "left", possibleValues : [ "left", "center", "right", "justify" ], allowNull : false }); + + + + +/* +--------------------------------------------------------------------------- + MODIFIER +--------------------------------------------------------------------------- +*/ + +qx.Proto._modifyText = function() +{ + if (this._isCreated) { + this._syncText(); + } + + return true; +} + +qx.Proto._modifyFont = function(propValue, propOldValue, propData) +{ + if (propValue) { + propValue._applyWidget(this); + } else if (propOldValue) { + propOldValue._resetWidget(this); + } + + return true; +} + +qx.Proto._modifyWrap = function(propValue, propOldValue, propData) +{ + this.setStyleProperty("whiteSpace", propValue ? "normal" : "nowrap"); + return true; +} + +// property modifier +qx.Proto._modifyTextAlign = function(propValue, propOldValue, propData) { + this.setStyleProperty("textAlign", propValue); + return true; +} + + + + + +/* +--------------------------------------------------------------------------- + ELEMENT HANDLING +--------------------------------------------------------------------------- +*/ + +qx.Proto._applyElementData = function() { + this.getElement().appendChild(document.createTextNode(this.getText())); +} + +qx.Proto._syncText = function() { + this.getElement().firstChild.nodeValue = this.getText(); +} |