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 mt...@apache.org on 2006/08/14 18:12:58 UTC

svn commit: r431391 - in /incubator/xap/trunk: WebContent/ WebContent/examples/ WebContent/examples/basic/ WebContent/examples/dojo/ src/xap/ src/xap/bridges/basic/ src/xap/bridges/dojo/

Author: mturyn
Date: Mon Aug 14 11:12:57 2006
New Revision: 431391

URL: http://svn.apache.org/viewvc?rev=431391&view=rev
Log:
Updated and (one hopes) improved the names for the xaplet "home-base" and its components' optional display sites; added an example (portlet.html) to illustrate why one would bother at all with this.

Added:
    incubator/xap/trunk/WebContent/examples/dojo/portlet.html   (with props)
    incubator/xap/trunk/WebContent/examples/dojo/portlet.xal   (with props)
    incubator/xap/trunk/WebContent/examples/dojo/portletHandler.js   (with props)
Modified:
    incubator/xap/trunk/WebContent/XapConfig.xml
    incubator/xap/trunk/WebContent/examples/basic/dom0.xal
    incubator/xap/trunk/WebContent/examples/dojo/colorPicker.xal
    incubator/xap/trunk/WebContent/examples/dojo/colorPickerHandler.js
    incubator/xap/trunk/WebContent/examples/dojo/datePicker.html
    incubator/xap/trunk/WebContent/examples/dojo/datePicker.xal
    incubator/xap/trunk/WebContent/examples/index.html
    incubator/xap/trunk/src/xap/Xap.js
    incubator/xap/trunk/src/xap/bridges/basic/AbstractBlackBoxWidgetBridge.js
    incubator/xap/trunk/src/xap/bridges/basic/DomNodeBridge.js
    incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js

Modified: incubator/xap/trunk/WebContent/XapConfig.xml
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/XapConfig.xml?rev=431391&r1=431390&r2=431391&view=diff
==============================================================================
--- incubator/xap/trunk/WebContent/XapConfig.xml (original)
+++ incubator/xap/trunk/WebContent/XapConfig.xml Mon Aug 14 11:12:57 2006
@@ -1,4 +1,4 @@
 <xap-configuration>
-	<log-configuration logging-enabled="true">
+	<log-configuration logging-enabled="false">
 	</log-configuration>
 </xap-configuration>

Modified: incubator/xap/trunk/WebContent/examples/basic/dom0.xal
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/basic/dom0.xal?rev=431391&r1=431390&r2=431391&view=diff
==============================================================================
--- incubator/xap/trunk/WebContent/examples/basic/dom0.xal (original)
+++ incubator/xap/trunk/WebContent/examples/basic/dom0.xal Mon Aug 14 11:12:57 2006
@@ -12,7 +12,7 @@
   <xm:modifications xmlns:xm="http://www.openxal.org/xmodify">
     <xm:append select="/xal">
 		<dom xmlns="http://www.dojotoolkit.org/" 		
-				elementId="targetNode"
+				displayerId="targetNode"
 				bgColor="#eeddFF"
 				color="#ffeeff"
 				innerHTML="Mouse over me!"

Modified: incubator/xap/trunk/WebContent/examples/dojo/colorPicker.xal
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dojo/colorPicker.xal?rev=431391&r1=431390&r2=431391&view=diff
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dojo/colorPicker.xal (original)
+++ incubator/xap/trunk/WebContent/examples/dojo/colorPicker.xal Mon Aug 14 11:12:57 2006
@@ -13,7 +13,7 @@
     <xm:append select="/xal">
 	
 		<colorPalette xmlns="http://www.dojotoolkit.org/" 		
-				elementId="colorPickerHome"
+				displayerId="colorPickerHome"
 				id="theColorPicker"
 				height="60px"
 				width="90px"

Modified: incubator/xap/trunk/WebContent/examples/dojo/colorPickerHandler.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dojo/colorPickerHandler.js?rev=431391&r1=431390&r2=431391&view=diff
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dojo/colorPickerHandler.js (original)
+++ incubator/xap/trunk/WebContent/examples/dojo/colorPickerHandler.js Mon Aug 14 11:12:57 2006
@@ -11,8 +11,11 @@
 							
 
 colorPickerHandler.prototype.onPick = function( clientEvent){							 
-	var uiDoc  = clientEvent.session.getDocumentContainer().getUiDocument();
-	var dpEl = uiDoc.getElementById("theColorPicker");
+	var uiDoc  = clientEvent.session.getDocumentContainer().getUiDocument() ;
+	
+	var elId = "theColorPicker_" + clientEvent.source.getAttribute("id") ;	
+	
+	var dpEl = uiDoc.getElementById(elId);
 	
 	var bridge = clientEvent.session.getUiDocumentHandler().getHandlerForElement( dpEl );	
 

Modified: incubator/xap/trunk/WebContent/examples/dojo/datePicker.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dojo/datePicker.html?rev=431391&r1=431390&r2=431391&view=diff
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dojo/datePicker.html (original)
+++ incubator/xap/trunk/WebContent/examples/dojo/datePicker.html Mon Aug 14 11:12:57 2006
@@ -79,7 +79,7 @@
 				xapId="DatePicker" xapSrc="datePicker.xal" xapToolkit="dojo">This cell is the xap ClientSession "DatePicker"'s home-base.</div>
 			</td>
 		</tr>
-		<tr><td><div id="datePickerHome" >This DatePicker was put here via a xap application:</div></td><td></td></tr>
+		<tr><td><div id="datePickerDisplayer" >This DatePicker was put here via a xap application:</div></td><td></td></tr>
 		<tr><td height="30px" bgColor="#FFFFee"><div id="displ"><b>Pick a day....</b></div></td><td id="mouseOverDisplayer"/><td/></tr>
 	</table>
 

Modified: incubator/xap/trunk/WebContent/examples/dojo/datePicker.xal
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dojo/datePicker.xal?rev=431391&r1=431390&r2=431391&view=diff
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dojo/datePicker.xal (original)
+++ incubator/xap/trunk/WebContent/examples/dojo/datePicker.xal Mon Aug 14 11:12:57 2006
@@ -13,7 +13,7 @@
     <xm:append select="/xal">
 		<datePicker xmlns="http://www.dojotoolkit.org/" 	
 				id="theDatePicker"	
-				elementId="datePickerHome"
+				displayerId="datePickerDisplayer"
 				height="60px"
 				width="90px"
 				x="10px"

Added: incubator/xap/trunk/WebContent/examples/dojo/portlet.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dojo/portlet.html?rev=431391&view=auto
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dojo/portlet.html (added)
+++ incubator/xap/trunk/WebContent/examples/dojo/portlet.html Mon Aug 14 11:12:57 2006
@@ -0,0 +1,84 @@
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    <title>A spatially-distributed component.</title>
+
+	<style type="text/css">
+      <!--
+          @import url(../../css/xapDefault.css);
+      -->
+    </style>
+    
+	<!-- Keep dojo from trying to scan this whole page for dojoType'd tags: -->
+	<script type="text/javascript">
+		djConfig = {
+			parseWidgets: true
+		};
+	</script>    
+	
+    <script language="JavaScript" type="text/javascript" src="../../src/dojo/dojo.js"></script>
+    <script language="JavaScript" type="text/javascript" src="../../src/xap/util/Utils.js"></script>
+    <script language="JavaScript" type="text/javascript" src="../../src/xap/Xap.js"></script>
+    
+
+    <script language="JavaScript" type="text/javascript"> 
+    	// These should be in this order, as this is what their dependencies
+    	// look like   	
+		Xap.addDebuggables( 
+						"xap.session.ClientSession",
+						"xap.taghandling.AbstractTagImpl",
+						"xap.bridges.basic.AbstractBlackBoxWidgetBridge",
+						"xap.bridges.dojo.DojoWidgetBridge",
+						"xap.bridges.dojo.DojoColorPaletteBridge"						
+							) ;
+    </script>
+   
+    <script language="JavaScript" type="text/javascript">
+    	Xap.bootstrap( "../../", true );
+  	</script>
+<!--  Do this as late as possible---brings in script tags: -->
+<script language="JavaScript"> Xap._loadDebuggables();</script>
+
+  	
+  	  <!-- SECTION 2 -->
+	<script type="text/javascript">
+		// Load Dojo's code concerned with a Button or Button2 widget,
+		// including the object dojo.widget needed to create one
+		dojo.require("dojo.widget.*");   
+		dojo.require("dojo.event.*");            
+		dojo.require("dojo.widget.ColorPalette");  			                                          
+ 	</script>
+
+	<script language="JavaScript" src="portletHandler.js"> </script>	
+
+	<script language="JavaScript">
+     		Xap.defineSession("portlet.xal", "ThreeSquare","xapHome","../../","dojo") ; 
+ 	</script>
+ 
+ 
+ </head>
+  
+ <body onload="Xap.createAllPredefinedSessions();">
+
+<h1>A spatially-distributed component</h1>
+<h2>---a "component" can be XAP+HTML....</h2>
+
+<TABLE align="left" border="4" width="80%" height="60%" cellpadding="3" cellspacing="4">
+	<TR>
+		<TD border="2" align="center"  valign="middle"  id="00"></TD>
+		<TD id="01"></TD>
+		<TD border="2" align="center"  valign="middle"  id="02"></TD>
+	</TR>
+	<TR>
+		<TD id="10"></TD>
+		<TD border="2" align="center"  valign="middle"  id="xapHome"></TD>
+		<TD id="12"></TD>
+	</TR>
+	<TR>
+		<TD border="2" align="center"  valign="middle"  id="20"></TD>
+		<TD id="21"></TD>
+		<TD border="2" align="center"  valign="middle"  id="22"></TD>
+	</TR>
+</TABLE>
+</body>
+</html>

Propchange: incubator/xap/trunk/WebContent/examples/dojo/portlet.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/xap/trunk/WebContent/examples/dojo/portlet.xal
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dojo/portlet.xal?rev=431391&view=auto
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dojo/portlet.xal (added)
+++ incubator/xap/trunk/WebContent/examples/dojo/portlet.xal Mon Aug 14 11:12:57 2006
@@ -0,0 +1,72 @@
+<xal xmlns="http://www.openxal.org/xal"> 
+
+
+	<mco:mco 
+		xmlns:mco="http://www.openxal.org/mco" 
+		id="handler" 
+		src="portletHandler"
+	/>
+
+
+
+  <xm:modifications xmlns:xm="http://www.openxal.org/xmodify">
+    <xm:append select="/xal">
+		<!-- top-left -->
+		<colorPalette xmlns="http://www.dojotoolkit.org/" 		
+				displayerId="00"
+				id="theColorPicker_00"
+				height="60px"
+				width="90px"
+				x="10px"
+				y="10px"
+				onCommand="mco:handler.onPick(event)"		
+		/>		
+
+		<!-- top-right -->
+		<colorPalette xmlns="http://www.dojotoolkit.org/" 		
+				displayerId="02"
+				id="theColorPicker_02"
+				height="60px"
+				width="90px"
+				x="10px"
+				y="10px"
+				onCommand="mco:handler.onPick(event)"		
+		/>		
+		
+		<!-- home---for now, the centre -->
+		<button xmlns="http://www.dojotoolkit.org/" 
+			text="Clear Button at Xap's attach-point.." 	
+			color="#aa0000"
+			id="button0"
+			backgroundColor="#00aaaa"
+			onCommand="mco:handler.onClick()"				
+		/> 		
+		
+		
+		<!-- bottom-left -->
+		<colorPalette xmlns="http://www.dojotoolkit.org/" 		
+				displayerId="20"
+				id="theColorPicker_20"
+				height="60px"
+				width="90px"
+				x="10px"
+				y="10px"
+				onCommand="mco:handler.onPick(event)"		
+		/>		
+
+		<!-- bottom-right -->
+		<colorPalette xmlns="http://www.dojotoolkit.org/" 		
+				displayerId="22"
+				id="theColorPicker_22"
+				height="60px"
+				width="90px"
+				x="10px"
+				y="10px"
+				onCommand="mco:handler.onPick(event)"		
+		/>				
+		
+   	</xm:append> 	  	
+	  
+   	
+  </xm:modifications>
+</xal>
\ No newline at end of file

Propchange: incubator/xap/trunk/WebContent/examples/dojo/portlet.xal
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/xap/trunk/WebContent/examples/dojo/portletHandler.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dojo/portletHandler.js?rev=431391&view=auto
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dojo/portletHandler.js (added)
+++ incubator/xap/trunk/WebContent/examples/dojo/portletHandler.js Mon Aug 14 11:12:57 2006
@@ -0,0 +1,52 @@
+
+portletHandler = function(){} ;
+
+// Light-up an adjacent cell:
+portletHandler.getPairedCorner = function(cornerId){ 
+	if(cornerId=="00"){ 
+		return "10";
+	} else if(cornerId=="02"){ 
+		return "01";
+	} else if(cornerId=="20"){ 
+		return "21";
+	} else if(cornerId=="22"){ 
+		return "12";
+	}
+
+}
+
+portletHandler.prototype.onPick = function () {
+
+	var args = arguments ;
+	var clientEvent = arguments[0] ;
+
+	var uiDoc  = clientEvent.session.getDocumentContainer().getUiDocument();
+	
+	var cpId = "theColorPicker_"+ clientEvent.source.getAttribute("displayerId") ;
+	
+	var cpEl = uiDoc.getElementById( cpId);
+	
+	var bridge = clientEvent.session.getUiDocumentHandler().getHandlerForElement( cpEl );	
+
+	var palette = bridge.getPeer() ;
+	var colour = palette._color.replace(/\s/g,"") ;	
+
+	var elementId = clientEvent.source.getAttribute("displayerId") ;
+	var element = document.getElementById(portletHandler.getPairedCorner(elementId) );
+	
+	element.style.background = colour ;
+
+};
+
+
+portletHandler.prototype.onClick = function () {
+// Clears these cells:
+	var elIds=["01","10","12","21" ] ;
+
+	for ( var k = 0; k < elIds.length; ++k ){
+		var element = document.getElementById(elIds[k] );
+		element.style.background = "rgb(255,255,235)" ;
+	}
+
+};
+

Propchange: incubator/xap/trunk/WebContent/examples/dojo/portletHandler.js
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/xap/trunk/WebContent/examples/index.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/index.html?rev=431391&r1=431390&r2=431391&view=diff
==============================================================================
--- incubator/xap/trunk/WebContent/examples/index.html (original)
+++ incubator/xap/trunk/WebContent/examples/index.html Mon Aug 14 11:12:57 2006
@@ -29,6 +29,8 @@
       <li><a href="dojo/colorPicker.html">Wrapped ColorPalette, with most code in DojoWidget superclass.</a></li>      
       <br>        
       <li><a href="dojo/dateAndColorPickers.html">Page using the ColorPalette and DatePicker XAL's used in the above.</a></li>      
+      <br>        
+      <li><a href="dojo/portlet.html">A single xaplet distributed over a set of HTML components.</a></li>      
       
 </ul>
   </body>

Modified: incubator/xap/trunk/src/xap/Xap.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/Xap.js?rev=431391&r1=431390&r2=431391&view=diff
==============================================================================
--- incubator/xap/trunk/src/xap/Xap.js (original)
+++ incubator/xap/trunk/src/xap/Xap.js Mon Aug 14 11:12:57 2006
@@ -166,7 +166,7 @@
 			continue;
 		}
 		// The HTML DOM node from which we're getting all these attributes....
-		thisSessionsParameters.htmlElement = element ;	
+		thisSessionsParameters.xapHome = element ;	
 
 		// What's the XAL file?---required
 		thisSessionsParameters.xapSrc = element.getAttribute(Xap.APPLICATION_SOURCE_ATTRIBUTE__NAME);	
@@ -212,14 +212,16 @@
 		var src = thisSessionDef.xapSrc ;	
 		var toolkit = thisSessionDef.xapToolkit ;
 		var context = thisSessionDef.xapContext ;		
-		var element = thisSessionDef.htmlElement ;
+		var element = thisSessionDef.xapHome ;
+		// If this is a string, then it's the _i.d._ for the
+		// home element rather than the element itself:
 		if( element && typeof element == "string"){
 			element = document.getElementById(element) ;
 		}	
 		if (!element){
 			element = document.body ;
 		}			
-		thisSessionDef.htmlElement = element ;
+		thisSessionDef.xapHome = element ;
 
 
 		var session = Xap.createSession(context, src, toolkit , element);
@@ -242,7 +244,7 @@
 
 
 
-Xap.defineSession = function(src, xapletName,elementId,context,toolkit){
+Xap.defineSession = function(src, xapletName,xapHomeId,context,toolkit){
 
 	if( !src ){
 		throw new xap.util.Exception("No source (.xal) file given for this xap application.") ;
@@ -262,9 +264,9 @@
 	}
 	newSess.xapSrc = src  ;
 	newSess.xapToolkit =  toolkit ;
-	newSess.htmlElement = elementId ;
-	if( !newSess.htmlElement ){
-		newSess.htmlElement = document.body ;
+	newSess.xapHome = xapHomeId ;
+	if( !newSess.xapHome ){
+		newSess.xapHome = document.body ;
 	}
 
 

Modified: incubator/xap/trunk/src/xap/bridges/basic/AbstractBlackBoxWidgetBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/basic/AbstractBlackBoxWidgetBridge.js?rev=431391&r1=431390&r2=431391&view=diff
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/basic/AbstractBlackBoxWidgetBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/basic/AbstractBlackBoxWidgetBridge.js Mon Aug 14 11:12:57 2006
@@ -179,8 +179,8 @@
 	// NOTE: TO_DO:  Decide if this is a permissible behaviour.
 		var parentDomNode = parentPeerDomNode ;
 		
-	    	if( this.getSpecifiedAttachmentNode){ 
-	    		var specifiedDomNode = this.getSpecifiedAttachmentNode() ;
+	    	if( this.getSpecifiedDisplayNode){ 
+	    		var specifiedDomNode = this.getSpecifiedDisplayNode() ;
 			if ( specifiedDomNode){
 		    		parentDomNode = specifiedDomNode ;
 		    }
@@ -262,10 +262,10 @@
  * lay out the location for a component.
  *
 **/ 
-xap.bridges.basic.AbstractBlackBoxWidgetBridge.prototype.getSpecifiedAttachmentNode = function(){
+xap.bridges.basic.AbstractBlackBoxWidgetBridge.prototype.getSpecifiedDisplayNode = function(){
 	// What will the id of the node to which we'll attach this widget be?
-	var elementId = this.getElement().getAttribute("elementId");
-	return document.getElementById(elementId);
+	var xapDisplayId = this.getElement().getAttribute("displayerId");
+	return document.getElementById(xapDisplayId);
 }
 
 

Modified: incubator/xap/trunk/src/xap/bridges/basic/DomNodeBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/basic/DomNodeBridge.js?rev=431391&r1=431390&r2=431391&view=diff
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/basic/DomNodeBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/basic/DomNodeBridge.js Mon Aug 14 11:12:57 2006
@@ -64,8 +64,8 @@
 	// If we don't have a peer, try to find one:
 	if ( !this._peer ) {
     	try {
-		var elementId = this.getElement().getAttribute("elementId")  ;    	
-		var peer = document.getElementById(elementId) ;
+		var displayerId = this.getElement().getAttribute("displayerId")  ;    	
+		var peer = document.getElementById(displayerId) ;
 		// This method does more than just set the _peer member; it
 		// can also set up handlers.....
     		this.setPeer(peer) ;

Modified: incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js?rev=431391&r1=431390&r2=431391&view=diff
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js Mon Aug 14 11:12:57 2006
@@ -132,7 +132,7 @@
 		}	    
 
 		// If we've specified a node....
-	    var specifiedDomNode = this.getSpecifiedAttachmentNode() ;
+	    var specifiedDomNode = this.getSpecifiedDisplayNode() ;
 	    if ( specifiedDomNode){
 	    	parentPeerNode = specifiedDomNode ;
 	    }