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 jm...@apache.org on 2007/01/04 02:26:54 UTC

svn commit: r492387 - in /incubator/xap/trunk/WebContent/examples/widgets: CyclingMco.js rowCycling.xal simpleRowCycling.html

Author: jmargaris
Date: Wed Jan  3 18:26:53 2007
New Revision: 492387

URL: http://svn.apache.org/viewvc?view=rev&rev=492387
Log:
more memory leak testing, the 'simple' one uses on dojo stuff

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

Modified: incubator/xap/trunk/WebContent/examples/widgets/CyclingMco.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/CyclingMco.js?view=diff&rev=492387&r1=492386&r2=492387
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/CyclingMco.js (original)
+++ incubator/xap/trunk/WebContent/examples/widgets/CyclingMco.js Wed Jan  3 18:26:53 2007
@@ -1,5 +1,6 @@
 CyclingMco = function(){
-	
+	window.rowCount = 0;
+	window.cellCount = 0;
 };
 
 
@@ -11,6 +12,15 @@
 
 }
 
+
+CyclingMco.prototype.startTextCycling = function( tableElement, macro ){
+	window.tableElement = tableElement;
+	window.cycling = true;
+	window.intervalId = window.setInterval('replaceCells()',1);
+	window.cellCount = 0;
+	window.macro = macro;
+}
+
 CyclingMco.prototype.cycleOnce = function( tableElement ){
 	window.tableElement = tableElement;
 	window.cycling = false;
@@ -28,16 +38,43 @@
 	}	
 }
 
+CyclingMco.prototype.cycleInMemoryRows= function( tableElement ){
+	for (var i = 0; i<1000; i++){
+		var tmp = document.createElement('div');
+		var tmp2 = document.createElement('div');
+		tmp2.appendChild(tmp);
+		var peer = dojo.widget.createWidget("TableRow",{},tmp); 
+		xap.bridges.basic.AbstractWidgetBridge.cleanNode(peer.domNode);
+		peer.destroy();	
+	}
+	dojo.widget.manager.destroyAll();
+}
+
+		
+
 CyclingMco.prototype.printStats= function( event ){
 	var docHandler = event.session.getUiDocumentHandler();
 	alert("Elements->bridges: " + docHandler._elementsToBridges);
 	alert("Peers->bridges: " + docHandler._peersToBridges);
+	alert("Dojo widget manager widgets = " + dojo.widget.manager.widgets);
+	alert("Dojo widget manager widget IDs = " + dojo.widget.manager.widgetIds);
+	alert("Nodes saved for clobbering = " + dojo_ie_clobber.clobberNodes );
 }
 
 CyclingMco.prototype.stopCycling= function( ){
 	window.cycling = false;
 }
 
+
+replaceCells = function(){
+	window.macro.execute("Cell" + window.cellCount);
+	window.cellCount++;
+	
+//	if (window.cycling){
+//		window.intervalId = window.setTimeout('replaceCells()',1);
+//	}
+}
+
 replaceRows = function(){
 	var tableElement = window.tableElement;
 	for (var i = 0; i<tableElement.childNodes.length; i++){
@@ -58,7 +95,7 @@
 		newCell.setAttribute("text","cell:" + window.rowCount);
 		newRow.appendChild(newCell);
 		
-		newCell = ownerDocument.createElement("cell", "http://openxal.org/ui");
+		newCell = ownerDocument.createElement("cell" , "http://openxal.org/ui");
 		newCell.setAttribute("text","cell:" + window.rowCount);
 		newRow.appendChild(newCell);
 		

Modified: incubator/xap/trunk/WebContent/examples/widgets/rowCycling.xal
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/rowCycling.xal?view=diff&rev=492387&r1=492386&r2=492387
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/rowCycling.xal (original)
+++ incubator/xap/trunk/WebContent/examples/widgets/rowCycling.xal Wed Jan  3 18:26:53 2007
@@ -1,4 +1,7 @@
-<xal xmlns="http://openxal.org/ui" xmlns:xal="http://openxal.org/ui"> 
+<xal xmlns="http://openxal.org/ui" 
+	xmlns:xal="http://openxal.org/ui"
+	xmlns:macro="http://openxal.org/core/macro"
+    xmlns:xm="http://openxal.org/core/xmodify"> 
 	
 	<mco:mco 
 		xmlns:mco="http://openxal.org/core/mco" 
@@ -6,6 +9,15 @@
 		class="CyclingMco"
 		src="CyclingMco.js"
 	/>
+	
+	
+	<macro:macro id="changeCellText">
+        <xm:modifications>
+            <xm:set-attribute select="//cell">
+                <xm:attribute name="text" value="{0}"/>
+            </xm:set-attribute>
+        </xm:modifications>
+    </macro:macro>
 
 	
 
@@ -24,6 +36,12 @@
 	<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)"/>
+	
+	<freePane height="20px"/>
+	<button text="Start text cycling" onCommand="mco:cyclingMco.startTextCycling(testComponent, macro:changeCellText)"/>
+	<button text="Stop text cycling" onCommand="mco:cyclingMco.stopCycling(testComponent)"/>
+	<freePane height="20px"/>
+	<button text="Cycle in memory rows" onCommand="mco:cyclingMco.cycleInMemoryRows()"/>
 	<button text="Print stats" onCommand="mco:cyclingMco.printStats(event)"/>
 
 </xal>

Added: incubator/xap/trunk/WebContent/examples/widgets/simpleRowCycling.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/simpleRowCycling.html?view=auto&rev=492387
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/simpleRowCycling.html (added)
+++ incubator/xap/trunk/WebContent/examples/widgets/simpleRowCycling.html Wed Jan  3 18:26:53 2007
@@ -0,0 +1,48 @@
+<!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>Memory testing</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
+			};
+			
+			function cycleRows(){
+				dojo.require("dojo.widget.*");
+				dojo.require("dojo.widget.Parse");
+				dojo.require("dojo.widget.Button");
+				for (var i = 0; i<1000; i++){
+					var tmp = document.createElement('div');
+					var tmp2 = document.createElement('div');
+					tmp2.appendChild(tmp);
+					var peer = dojo.widget.createWidget("Button",{},tmp); 
+				}
+			}
+			
+			function cleanUp(){
+				dojo.widget.manager.destroyAll();
+				alert("Dojo widget manager widgets = " + dojo.widget.manager.widgets);
+				alert("Dojo widget manager widget IDs = " + dojo.widget.manager.widgetIds);
+				alert("Nodes saved for clobbering = " + dojo_ie_clobber.clobberNodes );
+			}
+		</script>    
+		
+		<script language="JavaScript" type="text/javascript" src="../../xapcore.js"></script>
+	</head>
+	  
+	<body>
+		<button onclick="cycleRows();" text="Cycle rows">Cycle Rows</button>
+		<button onclick="cleanUp();" text="Clean up">Clean up</button>
+	</body>
+</html>
+

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