incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bbuff...@apache.org
Subject svn commit: r470552 - /incubator/xap/trunk/src/xap/bridges/basic/HtmlHostBridge.js
Date Thu, 02 Nov 2006 22:16:01 GMT
Author: bbuffone
Date: Thu Nov  2 14:16:00 2006
New Revision: 470552

URL: http://svn.apache.org/viewvc?view=rev&rev=470552
Log:
I have updated the starting process of the XAP engine with the HTML page.
This changes is defined in emails from me on the 8/29.  
This changes break compatibilty with existing samples. 
To see how the new process works check out the new samples in 
the startup folder.

Added:
    incubator/xap/trunk/src/xap/bridges/basic/HtmlHostBridge.js   (with props)

Added: incubator/xap/trunk/src/xap/bridges/basic/HtmlHostBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/basic/HtmlHostBridge.js?view=auto&rev=470552
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/basic/HtmlHostBridge.js (added)
+++ incubator/xap/trunk/src/xap/bridges/basic/HtmlHostBridge.js Thu Nov  2 14:16:00 2006
@@ -0,0 +1,118 @@
+/*
+ * Copyright  2006 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+ 
+Xap.provide("xap.bridges.basic.HtmlHostBridge"); 
+// Auto-added---o.k.?
+Xap.require("xap.taghandling.AbstractTagImpl");
+
+/**
+ * @fileoverview
+ * 
+ * A bridge class that controls the hosting of XAL with in the HTML.
+ *
+ */
+
+/**
+ * Creates a xap.bridges.basic.HtmlHostBridge.
+ * 
+ * 
+ * @class xap.bridges.basic.HtmlHostBridge is the bridge between an XML element
+ * representing the insertion point in the HTML document
+ * 
+ * @constructor
+ * 
+ * @author bbuffone
+ */
+xap.bridges.basic.HtmlHostBridge = function() {
+	xap.taghandling.AbstractTagImpl.call( this );
+}
+
+xap.bridges.basic.HtmlHostBridge.prototype = new xap.taghandling.AbstractTagImpl;
+
+xap.bridges.basic.HtmlHostBridge.s_log = xap.util.LogFactory.getLog( "xap.bridges.basic.HtmlHostBridge"
);
+
+xap.bridges.basic.HtmlHostBridge.prototype.toString = function() {
+	return "xap.bridges.basic.HtmlHostBridge";
+}
+
+/**
+ * All bridges to DwtControls should go through these steps:
+ * 
+ * 1: Create the peer object
+ * 2: Handle all the initial attributes
+ * 3: Recursively parse the inititial children
+ * 
+ * It's not clear if we need zShow everwhere. (probably not)
+ * Also the workflow here is a bit strange in that when you create
+ * DwtControls you create them with a parent. Typically with most component
+ * frameworks the parent is responsible for adding the child control
+ * when the parent gets the onChildAdded() event. But with the Zimbra
+ * hierarchy the child adds itself to the parent in it's createPeer(),
+ * before onChildAdded() is ever called.
+ * 
+ * One effect of this is that instead of hooking up the hierarchy 
+ * from tail to head we do it from head to tail.
+ */
+xap.bridges.basic.HtmlHostBridge.prototype.init = function() {
+	this.createPeer();
+}
+
+/**
+ * Creates the peer component that this bridge controls.
+ */
+xap.bridges.basic.HtmlHostBridge.prototype.createPeer = function() {
+}
+
+xap.bridges.basic.HtmlHostBridge.prototype.createHost = function(parentElement, toolkitType)
{
+    var parentElementWrapper = null ;    
+    // If the handler handles a dojo widget, its relevant dom node will be the parentElement;
+    // if zimbroid, it will have to be found some other way Zimbra will handle:
+    if( toolkitType && toolkitType=="dojo"){
+		parentElementWrapper = parentElement!=null? parentElement : document.body ;
+
+		this.getNodeForChildren = function(){
+			return parentElement ;
+		}
+		
+		this.childAdded = function( e ) {
+			var childElement = e.getChange();
+			var childHandler = this.getUiContentHandler().getHandlerForElement( childElement );
+			this.addChild(childHandler, e.getIndex());
+		}		
+
+		this.addChild = function(child, index){
+			if (child.getRootDomNode && child.getRootDomNode()){
+				this.getNodeForChildren().appendChild(child.getRootDomNode());
+			}
+		}
+    }
+    
+    //have the parentElementWrapper be the peer of the xap.taghandling.AbstractTagImpl
+    this.setPeer(parentElementWrapper);
+    
+}
+
+/**
+ * Returns the node that represents this widget at the top level,
+ * for example the wrapping div. We will set basic attributes
+ * like color on this div in the absence of better setter methods.
+ */
+xap.bridges.basic.HtmlHostBridge.prototype.getRootDomNode =  function(){
+	return this.getPeer();
+}
+
+

Propchange: incubator/xap/trunk/src/xap/bridges/basic/HtmlHostBridge.js
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message