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 08:06:34 UTC
svn commit: r959207 - 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 06:06:34 2010
New Revision: 959207
URL: http://svn.apache.org/viewvc?rev=959207&view=rev
Log:
Finish SCXML 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=959207&r1=959206&r2=959207&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 06:06:34 2010
@@ -247,7 +247,7 @@ public class ModelingImportWizard extend
System.out.println(content);
monitor.worked(1);
content=getTargetList(content);
- monitor.worked(3);
+ monitor.worked(1);
content=content.replace("CONSTANT_org.apache.commons.scxml_CONSTANT", "org.apache.commons.scxml:");
monitor.worked(1);
content=content.replace("CONSTANT_xmi_version_CONSTANT", "xml:version");
@@ -258,6 +258,10 @@ public class ModelingImportWizard extend
monitor.worked(1);
content=content.replace("CONSTANT_xmlns_org.apache.commons.scxml_CONSTANT", "xmlns:org.apache.commons.scxml");
monitor.worked(1);
+ content=content.replace("org.apache.commons.scxml_","org.apache.commons.scxml:");
+ monitor.worked(1);
+ content=content.replace("xsi_type","xsi:type");
+ monitor.worked(1);
xmlFile.setContents(shc.string2InputStream(content), 1, null);
monitor.worked(1);
if (monitor.isCanceled())
@@ -375,6 +379,7 @@ public class ModelingImportWizard extend
int subStateNumber=0;
int parallerNumber=0;
int subParallelNumber=0;
+ int historyState=0;
for(int j = 0; j < children.getLength(); j++)
{
if(children.item(j) instanceof org.w3c.dom.Element){
@@ -402,6 +407,12 @@ public class ModelingImportWizard extend
else if("subParallel".equalsIgnoreCase(elementName)) childElement.setAttribute("tempId", fatherTempId+"/@subParallel."+String.valueOf(subParallelNumber++));
}
}
+ if("historyState".equalsIgnoreCase(elementName)){
+ String fatherTempId=element.getAttribute("tempId");
+ if(fatherTempId!=null){
+ childElement.setAttribute("tempId", fatherTempId+"/@historyState."+String.valueOf(historyState++));
+ }
+ }
convertParseTargetElement(childElement);
}
}
@@ -418,7 +429,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)||"subParallel".equalsIgnoreCase(elementName)||"parallel".equalsIgnoreCase(elementName)){
+ if("stateList".equalsIgnoreCase(elementName)||"subState".equalsIgnoreCase(elementName)||"subParallel".equalsIgnoreCase(elementName)||"parallel".equalsIgnoreCase(elementName)||"historyState".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=959207&r1=959206&r2=959207&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 06:06:34 2010
@@ -102,4 +102,148 @@
</xsl:element>
</xsl:template>
+<xsl:template match="invoke">
+ <xsl:element name="invoke">
+ <xsl:if test="@type"><xsl:attribute name="type"><xsl:value-of select="@type"/></xsl:attribute></xsl:if>
+ <xsl:if test="@typeexpr"><xsl:attribute name="typeexpr"><xsl:value-of select="@typeexpr"/></xsl:attribute></xsl:if>
+ <xsl:if test="@src"><xsl:attribute name="src"><xsl:value-of select="@src"/></xsl:attribute></xsl:if>
+ <xsl:if test="@srcexpr"><xsl:attribute name="srcexpr"><xsl:value-of select="@srcexpr"/></xsl:attribute></xsl:if>
+ <xsl:if test="@id"><xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute></xsl:if>
+ <xsl:if test="@idlocation"><xsl:attribute name="idlocation"><xsl:value-of select="@idlocation"/></xsl:attribute></xsl:if>
+ <xsl:if test="@namelist"><xsl:attribute name="namelist"><xsl:value-of select="@namelist"/></xsl:attribute></xsl:if>
+ <xsl:if test="@autoforward"><xsl:attribute name="autoforward"><xsl:value-of select="@autoforward"/></xsl:attribute></xsl:if>
+ <xsl:apply-templates/>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="history">
+ <xsl:element name="historyState">
+ <xsl:if test="@id"><xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute></xsl:if>
+ <xsl:if test="@type"><xsl:attribute name="type"><xsl:value-of select="@type"/></xsl:attribute></xsl:if>
+ <xsl:apply-templates/>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="donedata">
+ <xsl:element name="donedata">
+ <xsl:apply-templates/>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="log">
+ <xsl:element name="executableContext">
+ <xsl:attribute name="xsi_type">org.apache.commons.scxml_Log</xsl:attribute>
+ <xsl:attribute name="label"><xsl:value-of select="@label"/></xsl:attribute>
+ <xsl:attribute name="expr"><xsl:value-of select="@expr"/></xsl:attribute>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="raise">
+ <xsl:element name="executableContext">
+ <xsl:attribute name="xsi_type">org.apache.commons.scxml_Raise</xsl:attribute>
+ <xsl:attribute name="event"><xsl:value-of select="@event"/></xsl:attribute>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="if">
+ <xsl:element name="executableContext">
+ <xsl:attribute name="xsi_type">org.apache.commons.scxml_If</xsl:attribute>
+ <xsl:attribute name="cond"><xsl:value-of select="@cond"/></xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="assign">
+ <xsl:element name="executableContext">
+ <xsl:attribute name="xsi_type">org.apache.commons.scxml_Assign</xsl:attribute>
+ <xsl:attribute name="location"><xsl:value-of select="@location"/></xsl:attribute>
+ <xsl:attribute name="expr"><xsl:value-of select="@expr"/></xsl:attribute>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="validate">
+ <xsl:element name="executableContext">
+ <xsl:attribute name="xsi_type">org.apache.commons.scxml_Validate</xsl:attribute>
+ <xsl:attribute name="location"><xsl:value-of select="@location"/></xsl:attribute>
+ <xsl:attribute name="schema"><xsl:value-of select="@schema"/></xsl:attribute>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="cancel">
+ <xsl:element name="executableContext">
+ <xsl:attribute name="xsi_type">org.apache.commons.scxml_Cancel</xsl:attribute>
+ <xsl:attribute name="sendid"><xsl:value-of select="@sendid"/></xsl:attribute>
+ <xsl:attribute name="sendidexpr"><xsl:value-of select="@sendidexpr"/></xsl:attribute>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="send">
+ <xsl:element name="executableContext">
+ <xsl:attribute name="xsi_type">org.apache.commons.scxml_Send</xsl:attribute>
+ <xsl:attribute name="event"><xsl:value-of select="@event"/></xsl:attribute>
+ <xsl:attribute name="eventexpr"><xsl:value-of select="@eventexpr"/></xsl:attribute>
+ <xsl:attribute name="target"><xsl:value-of select="@target"/></xsl:attribute>
+ <xsl:attribute name="targetexpr"><xsl:value-of select="@targetexpr"/></xsl:attribute>
+ <xsl:attribute name="type"><xsl:value-of select="@type"/></xsl:attribute>
+ <xsl:attribute name="typeexpr"><xsl:value-of select="@typeexpr"/></xsl:attribute>
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
+ <xsl:attribute name="idlocation"><xsl:value-of select="@idlocation"/></xsl:attribute>
+ <xsl:attribute name="delay"><xsl:value-of select="@delay"/></xsl:attribute>
+ <xsl:attribute name="delayexpr"><xsl:value-of select="@delayexpr"/></xsl:attribute>
+ <xsl:attribute name="namelist"><xsl:value-of select="@namelist"/></xsl:attribute>
+ <xsl:attribute name="hints"><xsl:value-of select="@hints"/></xsl:attribute>
+ <xsl:attribute name="hintsexpr"><xsl:value-of select="@hintsexpr"/></xsl:attribute>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="elseif">
+ <xsl:element name="elseif">
+ <xsl:attribute name="cond"><xsl:value-of select="@cond"/></xsl:attribute>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="else">
+ <xsl:element name="else">
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="param">
+ <xsl:element name="param">
+ <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
+ <xsl:attribute name="expr"><xsl:value-of select="@expr"/></xsl:attribute>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="finalize">
+ <xsl:element name="finalize">
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="datamodel">
+ <xsl:element name="dataModel">
+ <xsl:attribute name="schema"><xsl:value-of select="@schema"/></xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="data">
+ <xsl:element name="data">
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
+ <xsl:attribute name="src"><xsl:value-of select="@src"/></xsl:attribute>
+ <xsl:attribute name="expr"><xsl:value-of select="@expr"/></xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="content">
+ <xsl:element name="content">
+ <xsl:apply-templates/>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="script">
+ <xsl:element name="script">
+ </xsl:element>
+</xsl:template>
+
</xsl:stylesheet>
\ No newline at end of file