You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by bb...@apache.org on 2006/11/02 22:16:35 UTC

svn commit: r470554 - /incubator/xap/trunk/src/xap/bridges/basic/TextViewBridge.js

Author: bbuffone
Date: Thu Nov  2 14:16:34 2006
New Revision: 470554

URL: http://svn.apache.org/viewvc?view=rev&rev=470554
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.

Modified:
    incubator/xap/trunk/src/xap/bridges/basic/TextViewBridge.js   (contents, props changed)

Modified: incubator/xap/trunk/src/xap/bridges/basic/TextViewBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/basic/TextViewBridge.js?view=diff&rev=470554&r1=470553&r2=470554
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/basic/TextViewBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/basic/TextViewBridge.js Thu Nov  2 14:16:34 2006
@@ -1,98 +1,110 @@
-/*
- * 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.TextViewBridge"); 
-// Auto-added---o.k.?
-Xap.require("xap.taghandling.AbstractTagImpl");
-
-// Auto-added---o.k.?
-
-/**
- * @fileoverview
- * 
- * A bridge class that controls a blob of html.
- */
-
-/**
- * Creates a xap.bridges.basic.TextViewBridge.
- * 
- * 
- * @class xap.bridges.basic.TextViewBridge is the bridge between an XML element
- * representing a blob of html.
- * 
- * @constructor
- * 
- * @author bbuffone
- */
-xap.bridges.basic.TextViewBridge = function() {
-	xap.taghandling.AbstractTagImpl.call( this );
-}
-
-xap.bridges.basic.TextViewBridge.prototype = new xap.taghandling.AbstractTagImpl;
-
-xap.bridges.basic.TextViewBridge.s_log = xap.util.LogFactory.getLog( "xap.bridges.basic.TextViewBridge" );
-
-xap.bridges.basic.TextViewBridge.prototype.toString = function() {
-	return "xap.bridges.basic.TextViewBridge";
-}
-
-/**
- * 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.TextViewBridge.prototype.init = function() {
-	this.createPeer();
-	this.parseInitialAttributes( this.getElement() );
-	this.parseInitialChildren( this.getElement() );
-	xap.taghandling.AbstractTagImpl.prototype.init.call( this );
-}
-
-/**
- * Creates the peer component that this bridge controls.
- */
-xap.bridges.basic.TextViewBridge.prototype.createPeer = function() {
-	var parent = this.getElement().getParent();
-	var handler = this.getUiContentHandler().getHandlerForElement( parent );
-	var parentPeer = handler.getPeer();
-	
-	if ( parentPeer instanceof DwtComposite ) {
-    	try {
-    	    htmlEl = document.getElementById(parentPeer._htmlElId)
-    		htmlEl.innerHTML = this.getElement().firstChild.nodeValue;
-        } catch ( e ) {
-        	alert(e);
-    	}
-	} else {
-		xap.bridges.zimbra.DwtButtonBridge.s_log.error("Bogus parent peer:" + parentPeer );
-	}
-}
-
-
+/*
+ * 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.TextViewBridge"); 
+// Auto-added---o.k.?
+Xap.require("xap.taghandling.AbstractTagImpl");
+
+// Auto-added---o.k.?
+
+/**
+ * @fileoverview
+ * 
+ * A bridge class that controls a blob of html.
+ */
+
+/**
+ * Creates a xap.bridges.basic.TextViewBridge.
+ * 
+ * 
+ * @class xap.bridges.basic.TextViewBridge is the bridge between an XML element
+ * representing a blob of html.
+ * 
+ * @constructor
+ * 
+ * @author bbuffone
+ */
+xap.bridges.basic.TextViewBridge = function() {
+	xap.taghandling.AbstractTagImpl.call( this );
+}
+
+xap.bridges.basic.TextViewBridge.prototype = new xap.taghandling.AbstractTagImpl;
+
+xap.bridges.basic.TextViewBridge.s_log = xap.util.LogFactory.getLog( "xap.bridges.basic.TextViewBridge" );
+
+xap.bridges.basic.TextViewBridge.prototype.toString = function() {
+	return "xap.bridges.basic.TextViewBridge";
+}
+
+/**
+ * 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.TextViewBridge.prototype.init = function() {
+	this.createPeer();
+	this.parseInitialAttributes( this.getElement() );
+	this.parseInitialChildren( this.getElement() );
+	xap.taghandling.AbstractTagImpl.prototype.init.call( this );
+}
+
+/**
+ * Creates the peer component that this bridge controls.
+ */
+xap.bridges.basic.TextViewBridge.prototype.createPeer = function() {
+	var parent = this.getElement().getParent();
+	var handler = this.getUiContentHandler().getHandlerForElement( parent );
+	var parentPeer = handler.getPeer();
+	
+ 	if ( handler.getRootDomNode != null ) {
+		htmlElement = handler.getRootDomNode();
+	} else {
+		xap.bridges.basic.TextViewBridge.s_log.error("Bogus parent peer:" + parentPeer );
+	}
+    try {
+    	var myDiv = document.createElement("div");
+    	myDiv.innerHTML = this.getElement().firstChild.nodeValue;
+    	htmlElement.appendChild(myDiv);
+    	this.setPeer(myDiv);
+    } catch ( e ) {
+        alert(e);
+    }
+}
+
+
+
+/**
+ * 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.TextViewBridge.prototype.getRootDomNode =  function(){
+	return this.getPeer();
+}

Propchange: incubator/xap/trunk/src/xap/bridges/basic/TextViewBridge.js
            ('svn:eol-style' removed)