Author: koen.aers(a)jboss.com
Date: 2008-10-16 14:06:45 -0400 (Thu, 16 Oct 2008)
New Revision: 10901
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlSerializer.java
Log:
basic jpdl serialization
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2008-10-16 18:06:11 UTC (rev
10900)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2008-10-16 18:06:45 UTC (rev
10901)
@@ -32,7 +32,7 @@
acceptsElementStrategy="org.jboss.tools.flow.jpdl4.strategy.ProcessAcceptsElementStrategy"></flow>
</element>
<element
- class="org.jboss.tools.flow.common.model.DefaultContainer"
+ class="org.jboss.tools.flow.jpdl4.model.SuperState"
figure="icons/super.gif"
id="org.jboss.tools.flow.jpdl4.superState"
language="org.jboss.tools.flow.jpdl4"
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlSerializer.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlSerializer.java 2008-10-16
18:06:11 UTC (rev 10900)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlSerializer.java 2008-10-16
18:06:45 UTC (rev 10901)
@@ -38,18 +38,21 @@
private static void appendOpening(StringBuffer buffer, Wrapper wrapper, int level) {
Element element = (Element)wrapper.getElement();
- buffer.append("\n");
- appendPadding(buffer, level);
if (element instanceof Transition) {
+ buffer.append("\n");
+ appendPadding(buffer, level);
buffer.append("<transition");
Transition transition = (Transition)element;
if (transition.getTo() != null) {
+ buffer.append(" ");
String value = transition.getTo().getName();
value = value == null ? "" : value;
buffer.append("to=\"" + value + "\"");
}
buffer.append(">");
} else if (element instanceof EndState) {
+ buffer.append("\n\n");
+ appendPadding(buffer, level);
buffer.append("<end-state");
EndState endState = (EndState)element;
if (endState.getName() != null) {
@@ -59,6 +62,8 @@
}
buffer.append(">");
} else if (element instanceof StartState) {
+ buffer.append("\n\n");
+ appendPadding(buffer, level);
buffer.append("<start-state");
StartState startState = (StartState)element;
if (startState.getName() != null) {
@@ -68,6 +73,8 @@
}
buffer.append(">");
} else if (element instanceof SuperState) {
+ buffer.append("\n\n");
+ appendPadding(buffer, level);
buffer.append("<super-state");
SuperState superState = (SuperState)element;
if (superState.getName() != null) {
@@ -77,6 +84,8 @@
}
buffer.append(">");
} else if (element instanceof State) {
+ buffer.append("\n\n");
+ appendPadding(buffer, level);
buffer.append("<state");
State state = (State)element;
if (state.getName() != null) {
@@ -112,19 +121,29 @@
private static void appendClosing(StringBuffer buffer, Wrapper wrapper, int level) {
Element element = (Element)wrapper.getElement();
- buffer.append("\n");
- appendPadding(buffer, level);
if (element instanceof Transition) {
+ buffer.append("\n");
+ appendPadding(buffer, level);
buffer.append("</transition>");
} else if (element instanceof EndState) {
+ buffer.append("\n");
+ appendPadding(buffer, level);
buffer.append("</end-state>");
} else if (element instanceof StartState) {
+ buffer.append("\n");
+ appendPadding(buffer, level);
buffer.append("</start-state>");
} else if (element instanceof SuperState) {
+ buffer.append("\n\n");
+ appendPadding(buffer, level);
buffer.append("</super-state>");
} else if (element instanceof State) {
+ buffer.append("\n");
+ appendPadding(buffer, level);
buffer.append("</state>");
} else if (element instanceof Process) {
+ buffer.append("\n\n");
+ appendPadding(buffer, level);
buffer.append("</process>");
}
}
@@ -134,14 +153,14 @@
ContainerWrapper containerWrapper = (ContainerWrapper)wrapper;
List<NodeWrapper> children = containerWrapper.getElements();
for (NodeWrapper nodeWrapper : children) {
- appendToBuffer(buffer, nodeWrapper, ++level);
+ appendToBuffer(buffer, nodeWrapper, level+1);
}
}
if (wrapper instanceof NodeWrapper) {
NodeWrapper nodeWrapper = (NodeWrapper)wrapper;
List<ConnectionWrapper> children = nodeWrapper.getOutgoingConnections();
for (ConnectionWrapper connectionWrapper : children) {
- appendToBuffer(buffer, connectionWrapper, ++level);
+ appendToBuffer(buffer, connectionWrapper, level+1);
}
}
}
Show replies by date