incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r454631 - in /incubator/xap/trunk/WebContent/examples/dataBinding: formatterChain.html formatterChain.xal index.html
Date Tue, 10 Oct 2006 05:53:45 GMT
Author: mturyn
Date: Mon Oct  9 22:53:44 2006
New Revision: 454631

URL: http://svn.apache.org/viewvc?view=rev&rev=454631
Log:
Chained formatters examples added.

Added:
    incubator/xap/trunk/WebContent/examples/dataBinding/formatterChain.html
    incubator/xap/trunk/WebContent/examples/dataBinding/formatterChain.xal
Modified:
    incubator/xap/trunk/WebContent/examples/dataBinding/index.html

Added: incubator/xap/trunk/WebContent/examples/dataBinding/formatterChain.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dataBinding/formatterChain.html?view=auto&rev=454631
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dataBinding/formatterChain.html (added)
+++ incubator/xap/trunk/WebContent/examples/dataBinding/formatterChain.html Mon Oct  9 22:53:44
2006
@@ -0,0 +1,85 @@
+<html>
+	<head>
+		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+		<title>
+				Testing chained formatters against a JSON data source.
+		</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>
+	<!-- For MCO code -->
+	<script language="JavaScript" type="text/javascript" src="Layout.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.FormatterBridge",
+							"xap.data.bridge.DecimalFormatterBridge",							
+							"xap.data.bridge.FormatterChainBridge",							
+							"xap.data.bridge.JavascriptDataSourceBridge",
+							"xap.data.bridge.JsonDataSourceBridge",														
+							"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.JavascriptDataSource",
+							"xap.data.datasource.JsonDataSource",							
+							"xap.data.datasource.SimpleDocumentDataSource",							
+							"xap.data.formatter.MessageFormatter",
+							"xap.data.formatter.DecimalFormatter",
+							"xap.data.formatter.FormatterChain",														
+							"xap.resolver.AttributeResolutionHandler",
+							"xap.session.ClientSession",
+							"xap.session.DeclarativeArgumentParser",
+							"xap.taghandling.AbstractTagImpl",							
+							"xap.taghandling.AttributeConverter",
+							"xap.util.MessageFormat",
+							"xap.xml.dom.Document"
+																						
+							) ;
+		Xap._loadDebuggables() ;
+	</script -->	
+	
+	<!--Needed for the mco tag in the xal file:  -->
+	<script language="JavaScript" src="Layout.js"> </script>						
+
+	</head>
+
+	<body onload="Xap.createAllPredefinedSessions();">
+		<h3>Testing chained formatters on data from a JSON document:</h3>
+		<div style="left:100px;top:100px" xapId="ChainFmtExample" xapSrc="formatterChain.xal"
xapToolkit="dojo" xapContext="../../"></div>
+		<div top="380px">
+			(see <a href="formatterChain.xal">formatterChain.xal</a>, <a href="EmployeesArrays_json.js">EmployeesArrays_json.js</a>.)
+		</div>		
+	</body>
+</html>

Added: incubator/xap/trunk/WebContent/examples/dataBinding/formatterChain.xal
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dataBinding/formatterChain.xal?view=auto&rev=454631
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dataBinding/formatterChain.xal (added)
+++ incubator/xap/trunk/WebContent/examples/dataBinding/formatterChain.xal Mon Oct  9 22:53:44
2006
@@ -0,0 +1,233 @@
+<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"	
+>
+
+	<jsonDataSource
+		xmlns="http://www.openxal.org/data"
+		id="theEmployees"
+		path="Employees_json.js"
+		source="employees"
+	/>	
+	
+	<data:decimalFormatter 
+		id="four_places" 
+		format="0.0000"
+	/>
+
+
+	<data:messageFormatter 
+		id="enchained_plusses" 
+		format="+++{0}+++"
+	/>
+	
+	<data:messageFormatter 
+		id="enchained_equalses" 
+		format="==={0}==="
+	/>
+	
+	<data:messageFormatter 
+		id="enchained_minuses" 
+		format="----{0}---"
+	/>		
+	
+	<data:formatterChain id="rightWay">
+		<formatterReference formatter="four_places"/>
+		<formatterReference formatter="enchained_plusses"/>
+		<formatterReference formatter="enchained_equalses"/>
+		<formatterReference formatter="enchained_minuses"/>	
+	</data:formatterChain>
+	
+	<data:formatterChain id="rightWay_0">
+		<formatterReference formatter="four_places"/>
+	</data:formatterChain>	
+	
+	<data:formatterChain id="rightWay_1">
+		<formatterReference formatter="four_places"/>
+		<formatterReference formatter="enchained_plusses"/>
+	</data:formatterChain>
+	
+	<data:formatterChain id="rightWay_2">
+		<formatterReference formatter="four_places"/>
+		<formatterReference formatter="enchained_plusses"/>
+		<formatterReference formatter="enchained_equalses"/>
+	</data:formatterChain>	
+		
+	
+	<data:formatterChain id="wrongWay">
+		<formatterReference formatter="enchained_minuses"/>	
+		<formatterReference formatter="enchained_equalses"/>
+		<formatterReference formatter="enchained_plusses"/>
+		<formatterReference formatter="four_places"/>
+	</data:formatterChain>
+	
+	<data:formatterChain id="wrongWay_0">
+		<formatterReference formatter="enchained_minuses"/>	
+	</data:formatterChain>
+		
+	<data:formatterChain id="wrongWay_1">
+		<formatterReference formatter="enchained_minuses"/>	
+		<formatterReference formatter="enchained_equalses"/>			
+	</data:formatterChain>		
+	
+	<data:formatterChain id="wrongWay_2">
+		<formatterReference formatter="enchained_minuses"/>	
+		<formatterReference formatter="enchained_equalses"/>
+		<formatterReference formatter="enchained_plusses"/>						
+	</data:formatterChain>		
+		
+	
+	<data:binding  
+		dataSource="theEmployees" 
+		select="array[2].id" 
+		id="thirdId_noFormatting"
+	/>	
+
+	<data:binding  
+		dataSource="theEmployees" 
+		select="array[2].id" 
+		id="thirdId_rightWay"
+		formatter="rightWay"
+	/>
+	
+	<data:binding  
+		dataSource="theEmployees" 
+		select="array[2].id" 
+		id="thirdId_rightWay_2"
+		formatter="rightWay_2"
+	/>
+	
+	<data:binding  
+		dataSource="theEmployees" 
+		select="array[2].id" 
+		id="thirdId_rightWay_1"
+		formatter="rightWay_1"
+	/>
+	
+	<data:binding  
+		dataSource="theEmployees" 
+		select="array[2].id" 
+		id="thirdId_rightWay_0"
+		formatter="rightWay_0"
+	/>			
+	
+	<data:binding  
+		dataSource="theEmployees" 
+		select="array[2].id" 
+		id="thirdId_wrongWay"
+		formatter="wrongWay"
+	/>	
+	
+	<data:binding  
+		dataSource="theEmployees" 
+		select="array[2].id" 
+		id="thirdId_wrongWay_0"
+		formatter="wrongWay_0"
+	/>		
+	
+	
+	<data:binding  
+		dataSource="theEmployees" 
+		select="array[2].id" 
+		id="thirdId_wrongWay_1"
+		formatter="wrongWay_1"
+	/>		
+		
+	
+	<data:binding  
+		dataSource="theEmployees" 
+		select="array[2].id" 
+		id="thirdId_wrongWay_2"
+		formatter="wrongWay_2"
+	/>		
+			
+	
+	<xm:modifications>
+		<xm:append select="/xal">
+			<table height="280px" width="888px">
+				<row>
+					<cell text="Data:" textAlign="left" fontSize="11pt"/>
+					<cell text=" " textAlign="left" fontSize="11pt"/>					
+					<cell text="{bind(binding:thirdId_noFormatting)}" 
+						fontSize="12pt"					
+					/>
+				</row>
+				
+				<row>
+					<cell text="Apply number format: 0.0000" textAlign="left" fontSize="11pt"/>
+					<cell text=" " textAlign="left" fontSize="11pt"/>					
+					<cell text="{bind(binding:thirdId_rightWay_0)}" 
+						fontSize="12pt"					
+					/>
+				</row>
+				
+				<row>
+					<cell text="...then apply message format: +++{0}+++" textAlign="left" fontSize="11pt"/>
+					<cell text=" " textAlign="left" fontSize="11pt"/>					
+					<cell text="{bind(binding:thirdId_rightWay_1)}" 
+						fontSize="12pt"					
+					/>
+				</row>
+				
+				<row>
+					<cell text="...then apply message format: ==={0}===" textAlign="left" fontSize="11pt"/>
+					<cell text=" " textAlign="left" fontSize="11pt"/>					
+					<cell text="{bind(binding:thirdId_rightWay_2)}" 
+						fontSize="12pt"					
+					/>
+				</row>
+				
+				<row>
+					<cell text="...then apply message format: ---{0}---" textAlign="left" fontSize="11pt"/>
+					<cell text=" " textAlign="left" fontSize="11pt"/>					
+					<cell text="{bind(binding:thirdId_rightWay)}" 
+						fontSize="12pt"					
+					/>
+				</row>	
+				<row>
+					<cell text=" " textAlign="left" fontSize="11pt"/>
+					<cell text="Then, reversed:" textAlign="left" fontSize="11pt"/>
+					<cell text=" " textAlign="left" fontSize="11pt"/>
+				</row>				
+				
+				<row>
+					<cell text="Apply message format: ---{0}---" textAlign="left" fontSize="11pt"/>
+					<cell text=" " textAlign="left" fontSize="11pt"/>					
+					<cell text="{bind(binding:thirdId_wrongWay_0)}" 
+						fontSize="12pt"					
+					/>
+				</row>	
+				
+				<row>
+					<cell text="...then apply message format: ==={0}===" textAlign="left" fontSize="11pt"/>
+					<cell text=" " textAlign="left" fontSize="11pt"/>					
+					<cell text="{bind(binding:thirdId_wrongWay_1)}" 
+						fontSize="12pt"					
+					/>
+				</row>					
+								
+				
+				<row>
+					<cell text="...then apply message format: +++{0}+++" textAlign="left" fontSize="11pt"/>
+					<cell text=" " textAlign="left" fontSize="11pt"/>					
+					<cell text="{bind(binding:thirdId_wrongWay_2)}" 
+						fontSize="12pt"					
+					/>
+				</row>					
+								
+				
+				<row>
+					<cell text="...then apply number format: 0.0000" textAlign="left" fontSize="11pt"/>
+					<cell text=" " textAlign="left" fontSize="11pt"/>					
+					<cell text="{bind(binding:thirdId_wrongWay)}" 
+						fontSize="12pt"					
+					/>
+				</row>					
+
+			</table>
+
+		</xm:append>
+	</xm:modifications>
+</xal>

Modified: incubator/xap/trunk/WebContent/examples/dataBinding/index.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dataBinding/index.html?view=diff&rev=454631&r1=454630&r2=454631
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dataBinding/index.html (original)
+++ incubator/xap/trunk/WebContent/examples/dataBinding/index.html Mon Oct  9 22:53:44 2006
@@ -1,40 +1,53 @@
 <html>
 	<head>
-		<title>Data binding, iteration, formatting:</title>	
+		<title>Data binding, iteration, formatting:</title>
 	</head>
 	<body>
-		<h2>Data binding, iteration, formatting:</h2>
-		<ul><font size="+1">
-			<li>
-				<a href="./mcoAttribute.html">Testing basic attribute-resolution for an MCO.</a>
-			</li>
-			<br>
-			<li>
-				<a href="./simpleEmployees.html">Employee data from an XML document data source
and XPATH query in a table layout.</a>
-			</li>
-			<li>
-				<a href="./simpleDocumentDatasource_0.html">Data from an XML document data source
and XPATH query, layed out with an MCO.</a>
-			</li>
-			<br>
-			<li>
-				<a href="./jsonDatasource.html">Employee data from a JSON-compliant data source
and query.</a>
-			</li>
-			<br>
-			<li>
-				<a href="decimalFormatter.html">Testing the decimal formatter and bridge.</a>
-			</li>
-			<li>
-				<a href="messageFormatter.html">Testing the message formatter and bridge.</a>
-			</li>
-			<li>
-				<a href="messageFormatter_altSyntax.html">Testing the message formatter and bridge

-				using the <code>bind('select=...;formatter=...;')</code> syntax.</a>
-			</li>						
-			<br>
-			<br>
-			<li>
-				<a href="./javascriptDatasource.html">Employee data from a generalised javascript
data source using a scriptlet "query" and iterator macros.</a>
-			</li>
-		</font></ul>
+		<h2>
+			Data binding, iteration, formatting:
+		</h2>
+		<font size="+1">
+			Basics:
+			<ul>
+				<li>
+					<a href="./mcoAttribute.html">Testing basic attribute-resolution for an MCO.</a>
+				</li>
+				</ul>
+				<br/>Binding to or iterating over a data source:
+				<ul>
+				<li>
+					<a href="./simpleEmployees.html">Employee data from an XML document data source
and an XPATH query (XAL table layout).</a>
+				</li>
+				<li>
+					<a href="./simpleDocumentDatasource_0.html">Data from an XML document data source
and XPATH query (layed out with an MCO).</a>
+				</li>
+				<br>
+				<li>
+					<a href="./jsonDatasource.html">Employee data from a JSON-compliant data source
and query.</a>
+				</li>
+				<li>
+					<a href="./javascriptDatasource.html">Employee data from a generalised javascript
data source, using a scriptlet "query" and iterator macros.</a>
+				</li>
+				
+			</ul> Formatters: testing...
+			<ul>
+				<li>
+					<a href="decimalFormatter.html">...the decimal formatter and bridge.</a>
+				</li>
+				<li>
+					<a href="messageFormatter.html">...the message formatter and bridge.</a>
+				</li>
+				<li>
+					<a href="messageFormatter_altSyntax.html">...the message formatter and bridge
using the
+						<br/><CODE>
+							bind('select=...;formatter=...;')
+						</CODE> syntax.</a>
+				</LI>
+				<li>
+					<a href="formatterChain.html">...a series of enchained formatters.</a>
+				</LI>				
+				</ul>
+
+		</font>
 	</body>
 </html>



Mime
View raw message