commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbe...@apache.org
Subject svn commit: r984042 - in /commons/sandbox/gsoc/2010/scxml-js/trunk: demo/drawing-tool/behaviour/ src/xslt/backends/js/ src/xslt/ir-compiler/
Date Tue, 10 Aug 2010 14:21:17 GMT
Author: jbeard
Date: Tue Aug 10 14:21:16 2010
New Revision: 984042

URL: http://svn.apache.org/viewvc?rev=984042&view=rev
Log:
Toggling between states now works. Special history-oriented behaviour of the drawing tool
demo now works.

Modified:
    commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool/behaviour/canvas.xml
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/backends/js/AbstractStatechartGenerator.xsl
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/copyEnumeratedEventTransitions.xsl
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/enumerateEvents.xsl

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool/behaviour/canvas.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool/behaviour/canvas.xml?rev=984042&r1=984041&r2=984042&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool/behaviour/canvas.xml (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool/behaviour/canvas.xml Tue Aug
10 14:21:16 2010
@@ -266,7 +266,7 @@ In both:
 					</onentry>
 
 					<history type="shallow" id="nodes_selected_history">
-						<target id="ready_to_scale"/>
+						<transition target="ready_to_scale"/>
 					</history>
 
 					<state id="ready_to_rotate">
@@ -280,7 +280,7 @@ In both:
 								rotationHandle.setAttributeNS(null,"visibility","hidden");
 							</script>
 						</onexit>
-						<target id="ready_to_scale" event="TOGGLE_TRANSFORM"/>
+						<transition target="ready_to_scale" event="TOGGLE_TRANSFORM"/>
 					</state>
 
 					<state id="ready_to_scale">
@@ -294,7 +294,7 @@ In both:
 								scaleHandle.setAttributeNS(null,"visibility","hidden");
 							</script>
 						</onexit>
-						<target id="ready_to_rotate" event="TOGGLE_TRANSFORM"/>
+						<transition target="ready_to_rotate" event="TOGGLE_TRANSFORM"/>
 					</state>
 
 					<transition target="no_nodes_selected" event="CHECK_NODES" cond="selectedNodes.length
=== 0"/>

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/backends/js/AbstractStatechartGenerator.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/backends/js/AbstractStatechartGenerator.xsl?rev=984042&r1=984041&r2=984042&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/backends/js/AbstractStatechartGenerator.xsl
(original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/backends/js/AbstractStatechartGenerator.xsl
Tue Aug 10 14:21:16 2010
@@ -665,12 +665,20 @@
 				
 			</if>
 
-			<value-of select="$historyStateReference"/>.lastConfiguration.forEach(function(state){
-				<call-template name="genHistoryTriggerDispatcherInnerForEach">
-					<with-param name="isDeep" select="$isDeep"/>
-					<with-param name="isChildOfParallel" select="$isChildOfParallel"/>
-				</call-template>
+			var historyStateParent = <value-of select="$historyStateReference"/>.parent;
+
+			<value-of select="$historyStateReference"/>.lastConfiguration
+				.filter(function(n){return n.ancestors.indexOf(historyStateParent)!=-1})
+				.forEach(function(state){
+					<call-template name="genHistoryTriggerDispatcherInnerForEach">
+						<with-param name="isDeep" select="$isDeep"/>
+						<with-param name="isChildOfParallel" select="$isChildOfParallel"/>
+					</call-template>
 			});
+
+			newConfiguration = newConfiguration.concat(currentConfiguration.filter(function(n) {
+				return n.ancestors.indexOf(historyStateParent) == -1
+			}))
 			
 			<choose>
 				<when test="$isDeep">

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/copyEnumeratedEventTransitions.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/copyEnumeratedEventTransitions.xsl?rev=984042&r1=984041&r2=984042&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/copyEnumeratedEventTransitions.xsl
(original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/copyEnumeratedEventTransitions.xsl
Tue Aug 10 14:21:16 2010
@@ -36,5 +36,18 @@
 		</xsl:copy>
 	</xsl:template>
 
+	<xsl:template match="*[s:send]">
+		<xsl:copy>
+			<xsl:apply-templates select="@*|node()"/>
+
+			<c:enumeratedSendElements>
+				<xsl:for-each select="s:send[@event and not(contains(@event,'.'))]">
+					<c:enumeratedSend>
+						<xsl:apply-templates select="@*|node()"/>
+					</c:enumeratedSend>
+				</xsl:for-each>
+			</c:enumeratedSendElements>
+		</xsl:copy>
+	</xsl:template>
 
 </xsl:stylesheet>

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/enumerateEvents.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/enumerateEvents.xsl?rev=984042&r1=984041&r2=984042&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/enumerateEvents.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/enumerateEvents.xsl Tue
Aug 10 14:21:16 2010
@@ -26,8 +26,8 @@ source document under the namespaced <ev
 	version="1.0">
 	<xsl:output method="xml"/>
 
-	<xsl:key name="enumeratedEvents" match="c:enumeratedTransition" use="@event"/>	<!--
used for generating unique list -->
-	<xsl:key name="allEvents" match="s:transition" use="@event"/>	<!-- used for generating
unique list -->
+	<xsl:key name="enumeratedEvents" match="c:enumeratedTransition | c:enumeratedSend" use="@event"/>
<!-- used for generating unique list -->
+	<xsl:key name="allEvents" match="s:transition | s:send" use="@event"/>	<!-- used
for generating unique list -->
 
 	<!-- we copy them, so that we can use their positions as identifiers -->
 
@@ -39,8 +39,10 @@ source document under the namespaced <ev
 	</xsl:template>
 
 	<xsl:template match="/s:scxml">
-		<xsl:variable name="uniqueEvents" select="//s:transition[generate-id(.)=generate-id(key('allEvents',@event)[1])]/@event"/>
-		<xsl:variable name="uniqueEnumeratedEvents" select="//c:enumeratedTransition[generate-id(.)=generate-id(key('enumeratedEvents',@event)[1])][not(@event='*')]/@event"/>
+		<xsl:variable name="uniqueEvents" select="//*[(self::s:transition or self::s:send)]
+																								[generate-id(.)=generate-id(key('allEvents',@event)[1])]/@event"/>
+		<xsl:variable name="uniqueEnumeratedEvents" select="//*[self::c:enumeratedTransition
or self::c:enumeratedSend]
+																													[generate-id(.)=generate-id(key('enumeratedEvents',@event)[1])][not(@event='*')]/@event"/>
 
 		<xsl:copy>
 			<xsl:apply-templates select="@*|node()"/>



Mime
View raw message