incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r420861 - in /incubator/xap/trunk/WebContent/examples/dojo: dojo1.html dojo1.js dojo1.xal
Date Tue, 11 Jul 2006 14:14:41 GMT
Author: mturyn
Date: Tue Jul 11 07:14:40 2006
New Revision: 420861

URL: http://svn.apache.org/viewvc?rev=420861&view=rev
Log:
Simple example with a XAP app. embedded in a cell of a table.  Will add mature event handling
next.

Added:
    incubator/xap/trunk/WebContent/examples/dojo/dojo1.html   (with props)
    incubator/xap/trunk/WebContent/examples/dojo/dojo1.js   (with props)
    incubator/xap/trunk/WebContent/examples/dojo/dojo1.xal   (with props)

Added: incubator/xap/trunk/WebContent/examples/dojo/dojo1.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dojo/dojo1.html?rev=420861&view=auto
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dojo/dojo1.html (added)
+++ incubator/xap/trunk/WebContent/examples/dojo/dojo1.html Tue Jul 11 07:14:40 2006
@@ -0,0 +1,70 @@
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    <title>Dojo example 1</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: false
+		};
+	</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">
+    	Xap.bootstrap( "../../", true);
+  	</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.Button");  	                                          
+ 	</script>
+	
+ </head>
+ 
+
+<body onLoad="Xap.scanPage();document.showStatus();">
+	<script type="text/javascript">
+		DBG = new AjxDebug( AjxDebug.NONE, null, false ); 
+	</script>
+	<h1>Xaplet embedded in a table cell:</h1>
+	
+	<table id="bigtable" border="4px" borderColor="#8866AA" width="80%" height="80%"
+		style="left:"10%";top:"10%";opacity:"80%"
+		cellpadding="20em" cellspacing="2px"
+		>
+		<tr><th width="30%">0.</th><th>1.</th></tr>
+		<tr><td/><td/><td/><td/></tr>
+		<tr><td id="xapStat"></td>		
+			<td><div context="../../" 
+				appName="MyApp" src="dojo1.xal" toolkit="dojo">
+			</td>
+		</tr>
+		<tr><td colspan="2" height="5em"></td></tr>
+		<tr><td height="30px" bgColor="#884466"></td><td></td></tr>
+	</table>
+
+
+	<!-- MyApp as the app name is a top-level alias for session
+	as this event handler illustrates -->	
+	<button onclick="alert(MyApp.getDocumentContainer().getUiDocument().toXml());">hello</button>
+	<div id="foot">FOOTER TEXT</dev>
+
+	<script language="JavaScript" src="dojo1.js"/>
+
+</body>
+</html>

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

Added: incubator/xap/trunk/WebContent/examples/dojo/dojo1.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dojo/dojo1.js?rev=420861&view=auto
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dojo/dojo1.js (added)
+++ incubator/xap/trunk/WebContent/examples/dojo/dojo1.js Tue Jul 11 07:14:40 2006
@@ -0,0 +1,38 @@
+document.showStatus = function(){
+	var session = window["MyApp"] ;
+
+	var node = session.domContainer ;
+	var front = "" ;
+	var path = "";
+	while( node.parentNode ){
+		var siblings = node.parentNode.childNodes ;
+		if (path.length>0){
+			path = "<strong>/</strong>" + path  ;
+		}
+		var idx = -1 ;
+		var nodeLikeThisOneName= node.nodeName ;
+		var nodeLikeThisOneNameIndex = -1 ;
+		// Which node is this (e.g., which TR child of a TBODY?)
+		while( ++idx < siblings.length ){
+			if( nodeLikeThisOneName == siblings[idx].nodeName ){
+			// This is {<last count>+1} node like this under
+			// the parent (e.g., the 3rd <td> under a <tr>)
+				++nodeLikeThisOneNameIndex ;
+			}
+			if( siblings[idx] == node ){
+				path = "<strong>" +node.nodeName +"</strong>" +"<font color='#4444FF'>["+nodeLikeThisOneNameIndex+"]</font>"
 + path ;
+				break ;
+			}
+		}	
+		node = node.parentNode ;				
+	}
+	document.getElementById("xapStat").innerHTML =
+					"Found xap tag with <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; appName:"

+						+ session.appName
+						+ ", <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and source " 
+						+ session.src 
+						+ "<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; under element: "
+						+ "<code>"+path +"</code>"
+							;
+}	
+		

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

Added: incubator/xap/trunk/WebContent/examples/dojo/dojo1.xal
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dojo/dojo1.xal?rev=420861&view=auto
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dojo/dojo1.xal (added)
+++ incubator/xap/trunk/WebContent/examples/dojo/dojo1.xal Tue Jul 11 07:14:40 2006
@@ -0,0 +1,18 @@
+<xal xmlns="http://www.openxal.org/xal"> 
+  <xm:modifications xmlns:xm="http://www.openxal.org/xmodify">
+    <xm:append select="/xal">
+		<button xmlns="http://www.dojotoolkit.org/" text="New" 	
+			color="#aa0000"
+			id="button0"
+			backgroundColor="#00aaaa"
+		/> 
+		
+   	</xm:append>
+   	<!-- Try out caption-changing:  -->
+		<xm:set-attribute select="id('button0')">			
+			<attribute name="text" value="First..."/>
+		</xm:set-attribute>   	 
+   	
+   	
+  </xm:modifications>
+</xal>
\ No newline at end of file

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



Mime
View raw message