You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by jb...@apache.org on 2010/11/07 10:41:32 UTC

svn commit: r1032248 - in /commons/sandbox/gsoc/2010/scxml-js/trunk/src: python/scxml/cgf/backends/js/AbstractStatechartGenerator.py xslt/backends/js/AbstractStatechartGenerator.xsl

Author: jbeard
Date: Sun Nov  7 09:41:31 2010
New Revision: 1032248

URL: http://svn.apache.org/viewvc?rev=1032248&view=rev
Log:
Changed the listener code in order to fix a bug where onentry listeners were not being called when transitioning from history states. The solution was to move the listeners into the onexit/onentry actions, which I think makes sense.

Modified:
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/python/scxml/cgf/backends/js/AbstractStatechartGenerator.py
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/backends/js/AbstractStatechartGenerator.xsl

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/python/scxml/cgf/backends/js/AbstractStatechartGenerator.py
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/python/scxml/cgf/backends/js/AbstractStatechartGenerator.py?rev=1032248&r1=1032247&r2=1032248&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/python/scxml/cgf/backends/js/AbstractStatechartGenerator.py (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/python/scxml/cgf/backends/js/AbstractStatechartGenerator.py Sun Nov  7 09:41:31 2010
@@ -7,6 +7,7 @@ config = {
 				"xslt/ir-compiler/computeLCA.xsl",
 				"xslt/ir-compiler/transformIf.xsl",
 				"xslt/ir-compiler/appendStateInformation.xsl",
-				"xslt/ir-compiler/appendBasicStateInformation.xsl"],
+				"xslt/ir-compiler/appendBasicStateInformation.xsl",
+				"xslt/ir-compiler/addBasicDescendantsToTransitions.xsl" ],
 	"code" : None
 }

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=1032248&r1=1032247&r2=1032248&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 Sun Nov  7 09:41:31 2010
@@ -444,6 +444,17 @@
 					</if>
 
 					<apply-templates select="$state/s:onentry/*[self::s:if or self::s:raise or self::s:log or self::s:script or self::s:send or self::s:cancel or self::s:invoke or self::s:finalize or self::s:datamodel or self::s:data or self::s:assign or self::s:validate or self::s:param]"/>
+
+					<if test="$genListenerHooks">
+						<call-template name="genForEach">
+							<with-param name="var" select="'listener'"/>
+							<with-param name="in" select="'listeners'"/>
+							<with-param name="do">
+								//to
+								listener.onEntry("<value-of select="$stateName"/>");
+							</with-param>
+						</call-template>
+					</if>
 				}
 
 				this.exitAction = function(){
@@ -456,6 +467,21 @@
 					</if>
 
 					<apply-templates select="$state/s:onexit/*[self::s:if or self::s:raise or self::s:log or self::s:script or self::s:send or self::s:cancel or self::s:invoke or self::s:finalize or self::s:datamodel or self::s:data or self::s:assign or self::s:validate or self::s:param]"/>
+
+
+					<if test="$genListenerHooks">
+						<call-template name="genForEach">
+							<with-param name="var" select="'listener'"/>
+							<with-param name="in" select="'listeners'"/>
+							<with-param name="do">
+								//from
+								listener.onExit("<value-of select="$stateName"/>");
+							</with-param>
+							<!-- inner loop; assign these so we don't have a collision -->
+							<with-param name="iteratorVarName" select="concat(generate-id(),'_iterator')"/>
+							<with-param name="hoistVarName" select="concat(generate-id(),'_hoist')"/>
+						</call-template>
+					</if>
 				}
 
 				<call-template name="genStateHooks">
@@ -1010,20 +1036,6 @@
 			<with-param name="in" select="'statesExited'"/>
 			<with-param name="do">
 				state.exitAction();
-
-				<if test="$genListenerHooks">
-					<call-template name="genForEach">
-						<with-param name="var" select="'listener'"/>
-						<with-param name="in" select="'listeners'"/>
-						<with-param name="do">
-							//from
-							listener.onExit(state.toString());
-						</with-param>
-						<!-- inner loop; assign these so we don't have a collision -->
-						<with-param name="iteratorVarName" select="concat(generate-id(),'_iterator')"/>
-						<with-param name="hoistVarName" select="concat(generate-id(),'_hoist')"/>
-					</call-template>
-				</if>
 			</with-param>
 		</call-template>
 	</template>
@@ -1098,15 +1110,6 @@
 					<when test="$precomputeExit">
 						<for-each select="$t/c:exitpath/c:state">
 							<value-of select="."/>.exitAction();
-
-							<call-template name="genForEach">
-								<with-param name="var" select="'listener'"/>
-								<with-param name="in" select="'listeners'"/>
-								<with-param name="do">
-									//from
-									listener.onExit("<value-of select="."/>");
-								</with-param>
-							</call-template>
 						</for-each>
 					</when>
 					<otherwise>
@@ -1140,18 +1143,6 @@
 					<!-- iterate in reverse order -->
 					<sort select="position()" data-type="number" order="descending"/>
 					<value-of select="."/>.enterAction();
-
-					<if test="$genListenerHooks">
-
-						<call-template name="genForEach">
-							<with-param name="var" select="'listener'"/>
-							<with-param name="in" select="'listeners'"/>
-							<with-param name="do">
-								//to
-								listener.onEntry("<value-of select="."/>");
-							</with-param>
-						</call-template>
-					</if>
 				</for-each>
 
 				//update configuration