diff options
Diffstat (limited to 'webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/embed/Iframe.js')
-rw-r--r-- | webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/embed/Iframe.js | 433 |
1 files changed, 0 insertions, 433 deletions
diff --git a/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/embed/Iframe.js b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/embed/Iframe.js deleted file mode 100644 index 73dc8dc254..0000000000 --- a/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/embed/Iframe.js +++ /dev/null @@ -1,433 +0,0 @@ -/* ************************************************************************ - - qooxdoo - the new era of web development - - http://qooxdoo.org - - Copyright: - 2004-2007 1&1 Internet AG, Germany, http://www.1and1.org - - License: - LGPL: http://www.gnu.org/licenses/lgpl.html - EPL: http://www.eclipse.org/org/documents/epl-v10.php - See the LICENSE file in the project's top-level directory for details. - - Authors: - * Sebastian Werner (wpbasti) - * Andreas Ecker (ecker) - * Til Schneider (til132) - -************************************************************************ */ - -/* ************************************************************************ - -#embed(qx.static/image/blank.gif) - -************************************************************************ */ - -/** - * @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 (vSource != undefined) { - 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 - var blockerNode = this.setBlockerNode(qx.ui.embed.Iframe._blocker.cloneNode(true)); - - if (qx.core.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.core.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.core.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.core.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.core.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"; -}; - - |