incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmarga...@apache.org
Subject svn commit: r489550 - in /incubator/xap/trunk/WebContent/examples/widgets: CyclingMco.js index.html rowCycling.html rowCycling.xal
Date Fri, 22 Dec 2006 02:16:13 GMT
Author: jmargaris
Date: Thu Dec 21 18:16:12 2006
New Revision: 489550

URL: http://svn.apache.org/viewvc?view=rev&rev=489550
Log:
memory leak finding sample

Added:
    incubator/xap/trunk/WebContent/examples/widgets/CyclingMco.js   (with props)
    incubator/xap/trunk/WebContent/examples/widgets/rowCycling.html   (with props)
    incubator/xap/trunk/WebContent/examples/widgets/rowCycling.xal   (with props)
Modified:
    incubator/xap/trunk/WebContent/examples/widgets/index.html

Added: incubator/xap/trunk/WebContent/examples/widgets/CyclingMco.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/CyclingMco.js?view=auto&rev=489550
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/CyclingMco.js (added)
+++ incubator/xap/trunk/WebContent/examples/widgets/CyclingMco.js Thu Dec 21 18:16:12 2006
@@ -0,0 +1,75 @@
+CyclingMco = function(){
+	
+};
+
+
+CyclingMco.prototype.startCycling = function( tableElement ){
+	window.tableElement = tableElement;
+	window.cycling = true;
+	window.intervalId = window.setTimeout('replaceRows()',50);
+	window.rowCount = 0;
+
+}
+
+CyclingMco.prototype.cycleOnce = function( tableElement ){
+	window.tableElement = tableElement;
+	window.cycling = false;
+	replaceRows();
+
+}
+
+CyclingMco.prototype.clear= function( tableElement ){
+	for (var i = 0; i<tableElement.childNodes.length; i++){
+		var child = tableElement.childNodes[i];
+		if (child.nodeName=='row'){
+			tableElement.removeChild(child);
+			i--
+		}
+	}	
+}
+
+CyclingMco.prototype.printStats= function( event ){
+	var docHandler = event.session.getUiDocumentHandler();
+	alert("Elements->bridges: " + docHandler._elementsToBridges);
+	alert("Peers->bridges: " + docHandler._peersToBridges);
+}
+
+CyclingMco.prototype.stopCycling= function( ){
+	window.cycling = false;
+}
+
+replaceRows = function(){
+	var tableElement = window.tableElement;
+	for (var i = 0; i<tableElement.childNodes.length; i++){
+		var child = tableElement.childNodes[i];
+		if (child.nodeName=='row'){
+			tableElement.removeChild(child);
+			i--
+		}
+	}	
+	
+	
+	var ownerDocument = new xap.xml.dom.Document();
+	window.rowCount++;
+	
+	for (var i =0; i<50; i++){
+		var newRow = ownerDocument.createElement("row", "http://openxal.org/ui");
+		var newCell = ownerDocument.createElement("cell", "http://openxal.org/ui");
+		newCell.setAttribute("text","cell:" + window.rowCount);
+		newRow.appendChild(newCell);
+		
+		newCell = ownerDocument.createElement("cell", "http://openxal.org/ui");
+		newCell.setAttribute("text","cell:" + window.rowCount);
+		newRow.appendChild(newCell);
+		
+		newCell = ownerDocument.createElement("cell", "http://openxal.org/ui");
+		newCell.setAttribute("text","cell:" + window.rowCount);
+		newRow.appendChild(newCell);
+		
+		tableElement.appendChild(newRow);
+	}
+
+	if (window.cycling){
+		window.intervalId = window.setTimeout('replaceRows()',1);
+	}
+}
\ No newline at end of file

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

Modified: incubator/xap/trunk/WebContent/examples/widgets/index.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/index.html?view=diff&rev=489550&r1=489549&r2=489550
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/index.html (original)
+++ incubator/xap/trunk/WebContent/examples/widgets/index.html Thu Dec 21 18:16:12 2006
@@ -37,6 +37,7 @@
 <h2>Table</h2>
 <ul>
 <li><a href="tableSorting.html">sorting</a></li>
+<li><a href="rowCycling.html">constant row addition/removal</a></li>
 </ul>
 
 

Added: incubator/xap/trunk/WebContent/examples/widgets/rowCycling.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/rowCycling.html?view=auto&rev=489550
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/rowCycling.html (added)
+++ incubator/xap/trunk/WebContent/examples/widgets/rowCycling.html Thu Dec 21 18:16:12 2006
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
+		"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+	<head>
+	    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	    <title>Simple XAP Widget Example</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>
+	</head>
+	  
+	<body onload="Xap.createEmbeddedApplications();">
+		<div startPage="rowCycling.xal"></div>
+	</body>
+</html>
+

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

Added: incubator/xap/trunk/WebContent/examples/widgets/rowCycling.xal
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/rowCycling.xal?view=auto&rev=489550
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/rowCycling.xal (added)
+++ incubator/xap/trunk/WebContent/examples/widgets/rowCycling.xal Thu Dec 21 18:16:12 2006
@@ -0,0 +1,29 @@
+<xal xmlns="http://openxal.org/ui" xmlns:xal="http://openxal.org/ui"> 
+	
+	<mco:mco 
+		xmlns:mco="http://openxal.org/core/mco" 
+		id="cyclingMco" 
+		class="CyclingMco"
+		src="CyclingMco.js"
+	/>
+
+	
+
+	<table id="testComponent" width="300px" height="200px">
+		<column><header text="Column 1"/></column>
+		<column><header text="Column 2"/></column>
+		<column><header text="Column 3"/></column>
+		<row>
+			<cell text="aaa"/>
+			<cell text="bbb"/>
+			<cell text="ccc"/>
+		</row>
+	</table>
+	
+	<button text="Start cycling" onCommand="mco:cyclingMco.startCycling(testComponent)"/>
+	<button text="Stop cycling" onCommand="mco:cyclingMco.stopCycling(testComponent)"/>
+	<button text="Cycle once" onCommand="mco:cyclingMco.cycleOnce(testComponent)"/>
+	<button text="Clear" onCommand="mco:cyclingMco.clear(testComponent)"/>
+	<button text="Print stats" onCommand="mco:cyclingMco.printStats(event)"/>
+
+</xal>
\ No newline at end of file

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



Mime
View raw message