You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gu...@apache.org on 2010/06/30 06:19:25 UTC
svn commit: r959186 - in
/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram:
src/org/apache/commons/scxml/modeling/diagram/part/ModelingImportWizard.java
xslt/import.xsl
Author: guixl
Date: Wed Jun 30 04:19:25 2010
New Revision: 959186
URL: http://svn.apache.org/viewvc?rev=959186&view=rev
Log:
Finish parallel and subParallel support for document import function
Modified:
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/part/ModelingImportWizard.java
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/xslt/import.xsl
Modified: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/part/ModelingImportWizard.java
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/part/ModelingImportWizard.java?rev=959186&r1=959185&r2=959186&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/part/ModelingImportWizard.java (original)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/part/ModelingImportWizard.java Wed Jun 30 04:19:25 2010
@@ -359,7 +359,7 @@ public class ModelingImportWizard extend
if(children.item(j) instanceof org.w3c.dom.Element){
childElement = ((Element)children.item(j));
if("state".equalsIgnoreCase(elementName)){
- childElement.setAttribute("state_type", "subState");
+ childElement.setAttribute("state_type", "sub");
}
getSubStateElement(childElement);
}
@@ -373,6 +373,8 @@ public class ModelingImportWizard extend
Element childElement = null;
int stateListNumber=0;
int subStateNumber=0;
+ int parallerNumber=0;
+ int subParallelNumber=0;
for(int j = 0; j < children.getLength(); j++)
{
if(children.item(j) instanceof org.w3c.dom.Element){
@@ -393,6 +395,13 @@ public class ModelingImportWizard extend
else if("subState".equalsIgnoreCase(elementName)) childElement.setAttribute("tempId", fatherTempId+"/@subState."+String.valueOf(subStateNumber++));
}
}
+ if("parallel".equalsIgnoreCase(elementName)||"subParallel".equalsIgnoreCase(elementName)){
+ String fatherTempId=element.getAttribute("tempId");
+ if(fatherTempId!=null){
+ if("parallel".equalsIgnoreCase(elementName)) childElement.setAttribute("tempId", fatherTempId+"/@parallel."+String.valueOf(parallerNumber++));
+ else if("subParallel".equalsIgnoreCase(elementName)) childElement.setAttribute("tempId", fatherTempId+"/@subParallel."+String.valueOf(subParallelNumber++));
+ }
+ }
convertParseTargetElement(childElement);
}
}
@@ -409,7 +418,7 @@ public class ModelingImportWizard extend
if(children.item(j) instanceof org.w3c.dom.Element){
childElement = ((Element)children.item(j));
elementName = childElement.getNodeName();
- if("stateList".equalsIgnoreCase(elementName)||"subState".equalsIgnoreCase(elementName)){
+ if("stateList".equalsIgnoreCase(elementName)||"subState".equalsIgnoreCase(elementName)||"subParallel".equalsIgnoreCase(elementName)||"parallel".equalsIgnoreCase(elementName)){
String tempId=childElement.getAttribute("tempId");
String id=childElement.getAttribute("id");
if(tempId!=null&&id!=null){
Modified: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/xslt/import.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/xslt/import.xsl?rev=959186&r1=959185&r2=959186&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/xslt/import.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/xslt/import.xsl Wed Jun 30 04:19:25 2010
@@ -48,12 +48,34 @@
</xsl:template>
<xsl:template match="parallel">
- <xsl:element name="parallel">
- <xsl:if test="@id">
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
- </xsl:if>
- <xsl:apply-templates/>
- </xsl:element>
+ <xsl:choose>
+ <xsl:when test="@state_type">
+ <xsl:element name="subParallel">
+ <xsl:choose>
+ <xsl:when test="@id">
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="id"><xsl:value-of select="generate-id()"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="parallel">
+ <xsl:choose>
+ <xsl:when test="@id">
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="id"><xsl:value-of select="generate-id()"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
<xsl:template match="onEntry">