commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gu...@apache.org
Subject svn commit: r955275 - in /commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram: src/org/apache/commons/scxml/modeling/export/ xslt/
Date Wed, 16 Jun 2010 15:41:34 GMT
Author: guixl
Date: Wed Jun 16 15:41:34 2010
New Revision: 955275

URL: http://svn.apache.org/viewvc?rev=955275&view=rev
Log:
Import SCXML document export function

Modified:
    commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/export/ModelingDocumentExportWizard.java
    commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/export/ScxmlExportStreamHandlerAction.java
    commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/xslt/export.xsl

Modified: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/export/ModelingDocumentExportWizard.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/export/ModelingDocumentExportWizard.java?rev=955275&r1=955274&r2=955275&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/export/ModelingDocumentExportWizard.java
(original)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/export/ModelingDocumentExportWizard.java
Wed Jun 16 15:41:34 2010
@@ -196,7 +196,7 @@ public class ModelingDocumentExportWizar
 			int diagramVID = ModelingVisualIDRegistry
 					.getDiagramVisualID(diagramRootElementSelectionPage
 							.getModelElement());
-			monitor.beginTask("SCXML document export progress",7);
+			monitor.beginTask("SCXML document export progress",9);
 			
 			try {
 				
@@ -204,6 +204,8 @@ public class ModelingDocumentExportWizar
 				// get target list by regular expression
 				ScxmlExportStreamHandlerAction shc = new ScxmlExportStreamHandlerAction(
 						modelFile.getContents());
+				shc.contentPreHandler();
+				monitor.worked(1);
 				shc.getTargetList();
 				monitor.worked(1);
 				shc.transferToXpath();
@@ -217,6 +219,8 @@ public class ModelingDocumentExportWizar
 						.getClass().getClassLoader().getResourceAsStream(
 								"xslt/export.xsl"));
 				monitor.worked(1);
+				content=content.replace("xmlns_attribute_url_in_xslt_file", "xmlns");
+				monitor.worked(1);
 				xmlFile.setContents(shc.string2InputStream(content), 1, null);
 				monitor.worked(1);
 				if (monitor.isCanceled()) throw new InterruptedException(

Modified: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/export/ScxmlExportStreamHandlerAction.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/export/ScxmlExportStreamHandlerAction.java?rev=955275&r1=955274&r2=955275&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/export/ScxmlExportStreamHandlerAction.java
(original)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/export/ScxmlExportStreamHandlerAction.java
Wed Jun 16 15:41:34 2010
@@ -74,6 +74,9 @@ public class ScxmlExportStreamHandlerAct
 		inputStream2String(input);
 	}
 
+	public void contentPreHandler(){
+		streamContnet=streamContnet.replace("org.apache.commons.scxml:ServiceTemplate", "ServiceTemplate");
+	}
 	public void getTargetList() {
 		String regx = "targetStatus=\"\\S+\"";
 		Pattern p = Pattern.compile(regx);

Modified: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/xslt/export.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/xslt/export.xsl?rev=955275&r1=955274&r2=955275&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/xslt/export.xsl
(original)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/xslt/export.xsl
Wed Jun 16 15:41:34 2010
@@ -3,9 +3,13 @@
 <xsl:output method="xml" encoding="utf-8"/>
 
 <xsl:template match="/">
-		<scxml version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
+		<xsl:element name="scxml">
+			<xsl:attribute name="initial"><xsl:value-of  select="ServiceTemplate/@initial"/></xsl:attribute>
+			<xsl:attribute name="name"><xsl:value-of  select="ServiceTemplate/@name"/></xsl:attribute>
+			<xsl:attribute name="version">1.0</xsl:attribute>
+			<xsl:attribute name="xmlns_attribute_url_in_xslt_file">http://www.w3.org/2005/07/scxml</xsl:attribute>
 			<xsl:apply-templates/>
-		</scxml>
+		</xsl:element>
 </xsl:template>
 
 <xsl:template match="stateList">
@@ -15,6 +19,13 @@
 	</xsl:element>
 </xsl:template>
 
+<xsl:template match="subState">
+	<xsl:element name="state">
+		<xsl:attribute name="id"><xsl:value-of  select="@id"/></xsl:attribute>
+		<xsl:apply-templates/>
+	</xsl:element>
+</xsl:template>
+
 <xsl:template match="onEntry">
 	<xsl:element name="onEntry">
 	</xsl:element>



Mime
View raw message