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/10/26 23:57:42 UTC

svn commit: r468197 - in /incubator/xap/trunk: WebContent/examples/dataBinding/customers.xml WebContent/examples/dataBinding/nestedIterators.html WebContent/examples/dataBinding/nestedIterators.xal src/xap/data/datasource/AbstractDataSource.js

Author: mturyn
Date: Thu Oct 26 16:57:41 2006
New Revision: 468197

URL: http://svn.apache.org/viewvc?view=rev&rev=468197
Log:
Fixed AbstractDataSource problem: only had a 2-arg version of getDataSet, neede a 3-arg version as well.

Added:
    incubator/xap/trunk/WebContent/examples/dataBinding/customers.xml
    incubator/xap/trunk/WebContent/examples/dataBinding/nestedIterators.html
    incubator/xap/trunk/WebContent/examples/dataBinding/nestedIterators.xal
Modified:
    incubator/xap/trunk/src/xap/data/datasource/AbstractDataSource.js

Added: incubator/xap/trunk/WebContent/examples/dataBinding/customers.xml
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dataBinding/customers.xml?view=auto&rev=468197
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dataBinding/customers.xml (added)
+++ incubator/xap/trunk/WebContent/examples/dataBinding/customers.xml Thu Oct 26 16:57:41 2006
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<customers>
+    <customer custid="dave1">Dave giggles
+        <first>Dave</first>
+        <last>Gennaco</last>
+        <phone>555-555-7740</phone>
+    </customer>
+    <customer custid="bob1">Bob buffaloes
+        <first>Bob</first>
+        <last>Buffone</last>
+        <phone>555-555-7771</phone>
+    </customer>
+    <customer custid="john1">John fishes
+        <first>John</first>
+        <last>Constantine</last>
+        <phone>555-555-7732</phone>
+    </customer>
+    <customer custid="rob1">Rob manages
+        <first>Rob</first>
+        <last>Gagne</last>
+        <phone>555-555-7773</phone>
+    </customer>
+    <customer custid="james1">James bangs his head
+        <first>James</first>
+        <last>Margaris</last>
+        <phone>555-555-8884</phone>
+    </customer>
+    <titles>
+        <title>King</title>
+        <title>Monkey</title>
+        <title>Madame</title>
+    </titles>
+</customers>
\ No newline at end of file

Added: incubator/xap/trunk/WebContent/examples/dataBinding/nestedIterators.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dataBinding/nestedIterators.html?view=auto&rev=468197
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dataBinding/nestedIterators.html (added)
+++ incubator/xap/trunk/WebContent/examples/dataBinding/nestedIterators.html Thu Oct 26 16:57:41 2006
@@ -0,0 +1,72 @@
+<html>
+	<head>
+		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+		<title>Nested iterators:</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="../../xapcore.js"></script>
+		<!--  No longer need this---now grabs JS source using source object's 'path' attribute: -->
+		<!--  script language="JavaScript" type="text/javascript" src="Employees.js"></script -->
+
+<!--  
+Remove debugging in a final check, since debugging's 
+alternate loading method (using <script/> tags) can
+mask forgetting a .require(<className>) in the code:
+-->
+
+    <script language="JavaScript" type="text/javascript">
+
+    	Xap._sourceRootDir = "../../" ; 	
+		Xap.addDebuggables(		
+							"xap.data.DataFramework",
+							"xap.data.DataServiceFactory",
+							"xap.data.DataServiceImpl",
+							"xap.data.bridge.DataAttributeConverter",
+							"xap.data.bridge.DataFrameworkBridge",
+							"xap.data.bridge.DataSourceBridge",
+							"xap.data.bridge.IteratorBridge",							
+							"xap.data.bridge.SimpleDocumentDataSourceBridge",							
+							"xap.data.bridge.ObjectDataSourceBridge",
+							"xap.data.controller.ContextFrame",		
+							"xap.data.controller.Iterator",
+							"xap.data.controller.Binding",							
+							"xap.data.datasource.AbstractDataSet",
+							"xap.data.datasource.AbstractDataSource",							
+							"xap.data.datasource.ArrayDataSet",
+							"xap.data.datasource.DataSetFactory",						
+							"xap.data.datasource.DataSourceContainerImpl",
+							"xap.data.datasource.DataSourceImpl",
+							"xap.data.datasource.SimpleDocumentDataSource",
+							"xap.resolver.AttributeResolutionHandler",
+							"xap.session.ClientSession",
+							"xap.session.DeclarativeArgumentParser",
+							"xap.taghandling.AbstractTagImpl",							
+							"xap.taghandling.AttributeConverter",
+							"xap.util.Vector",
+							"xap.xml.dom.Document",
+							"xap.xml.dom.XapElement",							
+							"xap.Xap"																							
+							) ;
+		Xap._loadDebuggables() ;
+							
+	</script>							
+
+	</head>
+
+	<body onload="Xap.createAllPredefinedSessions();">
+		<h3>Nested iterators over an XML data set:</h3>
+		<div style="left:100px;top:100px" xapId="NestedItsExample" xapSrc="nestedIterators.xal" xapToolkit="dojo" xapContext="../../"></div>
+	</body>
+</html>

Added: incubator/xap/trunk/WebContent/examples/dataBinding/nestedIterators.xal
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dataBinding/nestedIterators.xal?view=auto&rev=468197
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dataBinding/nestedIterators.xal (added)
+++ incubator/xap/trunk/WebContent/examples/dataBinding/nestedIterators.xal Thu Oct 26 16:57:41 2006
@@ -0,0 +1,77 @@
+<xal 
+	xmlns="http://www.openxal.org/xal" 
+	xmlns:xal="http://www.openxal.org/xal"
+	xmlns:data="http://www.openxal.org/data"
+	xmlns:xm="http://www.openxal.org/xmodify"	
+>
+
+	<simpleDocumentDataSource 
+		xmlns="http://www.openxal.org/data" 
+		id="myDataSource" 
+		source="customers.xml"
+	/>
+
+
+	<xm:modifications>
+		<xm:append select="/xal">
+			<xal:table width="60%">
+		        <!--  column>
+		          <header text="Cust id"/>
+		        </column>
+		        
+		        <column>
+		          <header text="First"/>
+		        </column>
+		        
+		        <column>
+		          <header text="Last"/>
+		        </column>
+		        
+		        <column>
+		          <header text="Phone"/>
+		        </column>
+		
+		        <column>
+		          <header text="Title"/>
+		        </column>
+		        <column>
+		          <header text="Last"/>
+		        </column -->			
+			
+				<!-- Iterator -->
+				<data:iterator 
+					name="customer-iterator" 
+					dataSource="myDataSource" 
+					select="/customers/customer"
+				>
+					<row>			
+						<cell text="[outer iterator] customer id" fontWeight="8pt" color="#AAaaAA"/>					
+						<cell text="{ *('@custid') }" />
+						<data:iterator select="*" name="middle-iterator">   
+							<row>
+								<cell text="[middle iterator] customer node as text" fontWeight="8pt" color="#AAaaAA"/>
+								<cell text=" . . . . . . " color="#FFFFFF"/>								
+								<cell backgroundColor="#FFddFF" text="{ *( 'text()' ) }"/>
+						
+								<data:iterator
+									dataSource="customer-iterator" 
+									select="*"
+									name="inmost-iterator"
+								>
+									<row>
+										<cell text=" . . . . . . " color="#FFFFFF"/>										
+										<cell text="[inmost iterator] customer as text" fontSize="8pt" color="#AAaaAA"/>
+										<cell text=" . . . . . . " color="#FFFFFF"/>
+										<cell backgroundColor="#ddFFFF" text="{ *( 'text()' ) }"/>
+									</row>
+								</data:iterator><!-- inmost iterator -->					
+							</row>
+						</data:iterator> <!-- Middle iterator. -->
+					</row>
+				</data:iterator><!-- Customer iterator. -->
+			</xal:table>
+
+		</xm:append>
+	</xm:modifications>
+</xal>
+<!-- -->
\ No newline at end of file

Modified: incubator/xap/trunk/src/xap/data/datasource/AbstractDataSource.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/data/datasource/AbstractDataSource.js?view=diff&rev=468197&r1=468196&r2=468197
==============================================================================
--- incubator/xap/trunk/src/xap/data/datasource/AbstractDataSource.js (original)
+++ incubator/xap/trunk/src/xap/data/datasource/AbstractDataSource.js Thu Oct 26 16:57:41 2006
@@ -225,11 +225,16 @@
  * @public
  * @param query{String}
  * @param listener{DataRetrievalListener}
+ * @param ctx a context (optional)
  * @throws DataAccessException, MalformedQueryException,UnsupportedBindingTypeException 
  * @return {void}
  **/
-xap.data.datasource.AbstractDataSource.prototype.getDataSet = function (query, listener) {
-	this.handleGenericQuery(query, null, listener);
+xap.data.datasource.AbstractDataSource.prototype.getDataSet = function (query, listener,ctx) {
+	var context = null ;
+	if (typeof ctx != "undefined"){
+		context = ctx ;
+	}
+	this.handleGenericQuery(query, context, listener);
 };
 /**
  * @see xap.data.datasource.DataSource#getDataSet