JBoss Tools SVN: r14990 - trunk/jbpm/features/org.jboss.tools.flow.jpdl4.feature.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-05-01 07:51:53 -0400 (Fri, 01 May 2009)
New Revision: 14990
Modified:
trunk/jbpm/features/org.jboss.tools.flow.jpdl4.feature/feature.xml
Log:
Modified: trunk/jbpm/features/org.jboss.tools.flow.jpdl4.feature/feature.xml
===================================================================
--- trunk/jbpm/features/org.jboss.tools.flow.jpdl4.feature/feature.xml 2009-05-01 11:51:14 UTC (rev 14989)
+++ trunk/jbpm/features/org.jboss.tools.flow.jpdl4.feature/feature.xml 2009-05-01 11:51:53 UTC (rev 14990)
@@ -2,7 +2,7 @@
<feature
id="org.jboss.tools.flow.jpdl4.feature"
label="%featureName"
- version="1.0.0.beta1"
+ version="1.0.0.beta2"
provider-name="%providerName">
<description>
15 years, 8 months
JBoss Tools SVN: r14989 - trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/META-INF.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-05-01 07:51:14 -0400 (Fri, 01 May 2009)
New Revision: 14989
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/META-INF/MANIFEST.MF
Log:
bump version to 1.0.0.beta2
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/META-INF/MANIFEST.MF
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/META-INF/MANIFEST.MF 2009-05-01 11:50:28 UTC (rev 14988)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/META-INF/MANIFEST.MF 2009-05-01 11:51:14 UTC (rev 14989)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.jboss.tools.flow.jpdl4;singleton:=true
-Bundle-Version: 1.0.0.beta1
+Bundle-Version: 1.0.0.beta2
Bundle-Vendor: %Bundle-Vendor.0
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.jboss.tools.flow.common;bundle-version="1.0.0",
15 years, 8 months
JBoss Tools SVN: r14988 - trunk/flow/features/org.jboss.tools.flow.common.feature.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-05-01 07:50:28 -0400 (Fri, 01 May 2009)
New Revision: 14988
Modified:
trunk/flow/features/org.jboss.tools.flow.common.feature/feature.xml
Log:
bump version to 1.0.0.beta2
Modified: trunk/flow/features/org.jboss.tools.flow.common.feature/feature.xml
===================================================================
--- trunk/flow/features/org.jboss.tools.flow.common.feature/feature.xml 2009-05-01 11:49:55 UTC (rev 14987)
+++ trunk/flow/features/org.jboss.tools.flow.common.feature/feature.xml 2009-05-01 11:50:28 UTC (rev 14988)
@@ -2,7 +2,7 @@
<feature
id="org.jboss.tools.flow.common.feature"
label="%featureName"
- version="1.0.0.beta1"
+ version="1.0.0.beta2"
provider-name="%providerName">
<description>
15 years, 8 months
JBoss Tools SVN: r14987 - trunk/flow/plugins/org.jboss.tools.flow.common/META-INF.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-05-01 07:49:55 -0400 (Fri, 01 May 2009)
New Revision: 14987
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common/META-INF/MANIFEST.MF
Log:
bump version to 1.0.0.beta2
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/META-INF/MANIFEST.MF
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/META-INF/MANIFEST.MF 2009-05-01 03:22:44 UTC (rev 14986)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/META-INF/MANIFEST.MF 2009-05-01 11:49:55 UTC (rev 14987)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.jboss.tools.flow.common;singleton:=true
-Bundle-Version: 1.0.0.beta1
+Bundle-Version: 1.0.0.beta2
Bundle-Activator: org.jboss.tools.flow.common.Activator
Bundle-Vendor: %Bundle-Vendor.0
Require-Bundle:
15 years, 8 months
JBoss Tools SVN: r14986 - in trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4: src/org/jboss/tools/flow/jpdl4/editor and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-04-30 23:22:44 -0400 (Thu, 30 Apr 2009)
New Revision: 14986
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/JpdlDeserializer.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlPaletteFactory.java
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/editpart/EventListenerListTreeEditPart.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/EventListenerTreeEditPart.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/SwimlaneTreeEditPart.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/TimerTreeEditPart.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddEventListenerHandler.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddTimerHandler.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EventListener.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EventListenerContainer.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Timer.java
Log:
serialization of timers and event listeners for processes
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2009-04-30 17:54:25 UTC (rev 14985)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2009-05-01 03:22:44 UTC (rev 14986)
@@ -217,6 +217,27 @@
label="swimlane"
language="org.jboss.tools.flow.jpdl4">
</element>
+ <element
+ class="org.jboss.tools.flow.jpdl4.model.Timer"
+ figure="icons/16/timer.gif"
+ id="org.jboss.tools.flow.jpdl4.timer"
+ label="timer"
+ language="org.jboss.tools.flow.jpdl4">
+ </element>
+ <element
+ class="org.jboss.tools.flow.jpdl4.model.EventListenerContainer"
+ figure="icons/16/events_multiple.gif"
+ id="org.jboss.tools.flow.jpdl4.eventListenerContainer"
+ label="events"
+ language="org.jboss.tools.flow.jpdl4">
+ </element>
+ <element
+ class="org.jboss.tools.flow.jpdl4.model.EventListener"
+ figure="icons/16/event.gif"
+ id="org.jboss.tools.flow.jpdl4.eventListener"
+ label="event"
+ language="org.jboss.tools.flow.jpdl4">
+ </element>
</extension>
<extension
point="org.eclipse.ui.newWizards">
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlDeserializer.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlDeserializer.java 2009-04-30 17:54:25 UTC (rev 14985)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlDeserializer.java 2009-05-01 03:22:44 UTC (rev 14986)
@@ -2,6 +2,7 @@
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.List;
import java.util.StringTokenizer;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -19,8 +20,11 @@
import org.jboss.tools.flow.jpdl4.Logger;
import org.jboss.tools.flow.jpdl4.model.Assignment;
import org.jboss.tools.flow.jpdl4.model.AssignmentPropertySource;
+import org.jboss.tools.flow.jpdl4.model.EventListener;
+import org.jboss.tools.flow.jpdl4.model.EventListenerContainer;
import org.jboss.tools.flow.jpdl4.model.HumanTask;
import org.jboss.tools.flow.jpdl4.model.Swimlane;
+import org.jboss.tools.flow.jpdl4.model.Timer;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -41,8 +45,23 @@
}
class DefaultAttributeDeserializer implements AttributeDeserializer {
+ protected List<String> getAttributesToRead() {
+ return new ArrayList<String>();
+ }
+ protected String getXmlName(String attributeName) {
+ return null;
+ }
public void deserializeAttributes(Wrapper wrapper, Element element) {
wrapper.getElement().setMetaData("attributes", element.getAttributes());
+ List<String> attributeNames = getAttributesToRead();
+ for (String attributeName : attributeNames) {
+ String xmlName = getXmlName(attributeName);
+ if (xmlName == null) continue;
+ String attribute = element.getAttribute(xmlName);
+ if (!"".equals(attribute) && attribute != null) {
+ wrapper.setPropertyValue(attributeName, attribute);
+ }
+ }
}
}
@@ -86,6 +105,57 @@
}
}
+ class TimerAttributeHandler extends DefaultAttributeDeserializer {
+ protected List<String> getAttributesToRead() {
+ List<String> result = super.getAttributesToRead();
+ result.add(Timer.DUE_DATE);
+ result.add(Timer.REPEAT);
+ result.add(Timer.DUE_DATETIME);
+ return result;
+ }
+ protected String getXmlName(String attributeName) {
+ if (Timer.DUE_DATE.equals(attributeName)) {
+ return "duedate";
+ } else if (Timer.REPEAT.equals(attributeName)) {
+ return "repeat";
+ } else if (Timer.DUE_DATETIME.equals(attributeName)) {
+ return "duedatetime";
+ } else {
+ return super.getXmlName(attributeName);
+ }
+ }
+ }
+
+ class EventListenerContainerAttributeHandler extends DefaultAttributeDeserializer {
+ protected List<String> getAttributesToRead() {
+ ArrayList<String> result = new ArrayList<String>();
+ result.add(EventListenerContainer.EVENT_TYPE);
+ return result;
+ }
+ protected String getXmlName(String attributeName) {
+ if (EventListenerContainer.EVENT_TYPE.equals(attributeName)) {
+ return "event";
+ } else {
+ return super.getXmlName(attributeName);
+ }
+ }
+ }
+
+ class EventListenerAttributeHandler extends DefaultAttributeDeserializer {
+ protected List<String> getAttributesToRead() {
+ ArrayList<String> result = new ArrayList<String>();
+ result.add(EventListener.CLASS_NAME);
+ return result;
+ }
+ protected String getXmlName(String attributeName) {
+ if (EventListener.CLASS_NAME.equals(attributeName)) {
+ return "class";
+ } else {
+ return super.getXmlName(attributeName);
+ }
+ }
+ }
+
class AssignmentAttributeHandler implements AttributeDeserializer {
public void deserializeAttributes(Wrapper wrapper, Element element) {
String assignee = element.getAttribute(Assignment.ASSIGNEE);
@@ -138,12 +208,30 @@
flowWrapper.addElement((NodeWrapper)result);
} else if (result.getElement() instanceof Swimlane) {
flowWrapper.addChild("swimlane", result);
+ } else if (result.getElement() instanceof Timer) {
+ flowWrapper.addChild("timer", result);
+ } else if (result.getElement() instanceof EventListenerContainer) {
+ flowWrapper.addChild("eventListener", result);
}
}
return result;
}
}
+ class EventListenerContainerChildNodeHandler implements ChildNodeDeserializer {
+ public Wrapper deserializeChildNode(Wrapper parent, Node node) {
+ Wrapper result = null;
+ if (node instanceof Element) {
+ result = createWrapper((Element)node);
+ if (result == null) return null;
+ if (result.getElement() instanceof EventListener) {
+ parent.addChild(EventListenerContainer.LISTENERS, result);
+ }
+ }
+ return result;
+ }
+ }
+
class NodeChildNodeHandler implements ChildNodeDeserializer {
@SuppressWarnings("unchecked")
public Wrapper deserializeChildNode(Wrapper parent, Node node) {
@@ -258,7 +346,13 @@
Object element = wrapper.getElement();
if (element instanceof Swimlane) {
return new SwimlaneAttributeHandler();
- }
+ } else if (element instanceof Timer) {
+ return new TimerAttributeHandler();
+ } else if (element instanceof EventListenerContainer) {
+ return new EventListenerContainerAttributeHandler();
+ } else if (element instanceof EventListener) {
+ return new EventListenerAttributeHandler();
+ }
return null;
}
@@ -276,9 +370,18 @@
return new ProcessChildNodeHandler();
} else if (wrapper instanceof NodeWrapper) {
return new NodeChildNodeHandler();
+ } else if (wrapper instanceof DefaultWrapper) {
+ return getDefaultChildNodeHandler(wrapper);
}
return null;
}
+
+ private ChildNodeDeserializer getDefaultChildNodeHandler(Wrapper wrapper) {
+ if (wrapper.getElement() != null && wrapper.getElement() instanceof EventListenerContainer) {
+ return new EventListenerContainerChildNodeHandler();
+ }
+ return null;
+ }
private String getElementId(String nodeName) {
if ("process".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.process";
@@ -298,6 +401,9 @@
else if ("fork".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.parallelForkGateway";
else if ("transition".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.sequenceFlow";
else if ("swimlane".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.swimlane";
+ else if ("timer".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.timer";
+ else if ("on".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.eventListenerContainer";
+ else if ("event-listener".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.eventListener";
else return null;
}
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlPaletteFactory.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlPaletteFactory.java 2009-04-30 17:54:25 UTC (rev 14985)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlPaletteFactory.java 2009-05-01 03:22:44 UTC (rev 14986)
@@ -107,12 +107,12 @@
protected List<PaletteEntry> createTaskEntries() {
List<PaletteEntry> entries = new ArrayList<PaletteEntry>();
CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
- "wait",
- "Create a new Wait State Task",
+ "state",
+ "Create a new State Task",
"org.jboss.tools.flow.jpdl4.waitTask",
ElementRegistry.getCreationFactory("org.jboss.tools.flow.jpdl4.waitTask"),
- ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/16/task_wait.png")),
- ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/32/task_wait.png"))
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/16/task_empty.png")),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/32/task_empty.png"))
);
entries.add(combined);
combined = new CombinedTemplateCreationEntry(
@@ -120,8 +120,8 @@
"Create a new HQL Task",
"org.jboss.tools.flow.jpdl4.hqlTask",
ElementRegistry.getCreationFactory("org.jboss.tools.flow.jpdl4.hqlTask"),
- ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/16/task_hql.png")),
- ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/32/task_hql.png"))
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/16/task_empty.png")),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/32/task_empty.png"))
);
entries.add(combined);
combined = new CombinedTemplateCreationEntry(
@@ -129,8 +129,8 @@
"Create a new SQL Task",
"org.jboss.tools.flow.jpdl4.sqlTask",
ElementRegistry.getCreationFactory("org.jboss.tools.flow.jpdl4.sqlTask"),
- ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/16/task_sql.png")),
- ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/32/task_sql.png"))
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/16/task_empty.png")),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/32/task_empty.png"))
);
entries.add(combined);
combined = new CombinedTemplateCreationEntry(
@@ -138,8 +138,8 @@
"Create a new Java Task",
"org.jboss.tools.flow.jpdl4.javaTask",
ElementRegistry.getCreationFactory("org.jboss.tools.flow.jpdl4.javaTask"),
- ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/16/task_java.png")),
- ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/32/task_java.png"))
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/16/task_empty.png")),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/32/task_empty.png"))
);
entries.add(combined);
combined = new CombinedTemplateCreationEntry(
@@ -175,8 +175,8 @@
protected List<PaletteEntry> createGatewayEntries() {
List<PaletteEntry> entries = new ArrayList<PaletteEntry>();
CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
- "exclusive",
- "Create a new Exclusive Gateway",
+ "decision",
+ "Create a new Decision",
"org.jboss.tools.flow.jpdl4.exclusiveGateway",
ElementRegistry.getCreationFactory("org.jboss.tools.flow.jpdl4.exclusiveGateway"),
ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/16/gateway_exclusive.png")),
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 2009-04-30 17:54:25 UTC (rev 14985)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlSerializer.java 2009-05-01 03:22:44 UTC (rev 14986)
@@ -32,6 +32,8 @@
import org.jboss.tools.flow.jpdl4.model.Assignment;
import org.jboss.tools.flow.jpdl4.model.CancelEndEvent;
import org.jboss.tools.flow.jpdl4.model.ErrorEndEvent;
+import org.jboss.tools.flow.jpdl4.model.EventListener;
+import org.jboss.tools.flow.jpdl4.model.EventListenerContainer;
import org.jboss.tools.flow.jpdl4.model.ExclusiveGateway;
import org.jboss.tools.flow.jpdl4.model.ForkParallelGateway;
import org.jboss.tools.flow.jpdl4.model.HqlTask;
@@ -48,6 +50,7 @@
import org.jboss.tools.flow.jpdl4.model.SuperState;
import org.jboss.tools.flow.jpdl4.model.Swimlane;
import org.jboss.tools.flow.jpdl4.model.TerminateEndEvent;
+import org.jboss.tools.flow.jpdl4.model.Timer;
import org.jboss.tools.flow.jpdl4.model.WaitTask;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -118,7 +121,14 @@
abstract class AbstractWrapperSerializer implements WrapperSerializer {
protected abstract List<String> getAttributesToSave();
- protected abstract void appendAttributeToSave(String nodeName, StringBuffer buffer, Wrapper wrapper);
+ protected String getPropertyName(String attributeName) {
+ return attributeName;
+ }
+ protected void appendAttributeToSave(String attributeName, StringBuffer buffer, Wrapper wrapper) {
+ String value = (String)wrapper.getPropertyValue(getPropertyName(attributeName));
+ if (value == null || "".equals(value)) return;
+ buffer.append(" " + attributeName + "=\"" + value + "\"");
+ }
@SuppressWarnings("unchecked")
protected void appendLeadingNodes(StringBuffer buffer, Wrapper wrapper, int level) {
ArrayList<Node> leadingNodeList = (ArrayList<Node>)wrapper.getElement().getMetaData("leadingNodes");
@@ -183,6 +193,9 @@
else if ("org.jboss.tools.flow.jpdl4.parallelForkGateway".equals(elementId)) return "fork";
else if ("org.jboss.tools.flow.jpdl4.sequenceFlow".equals(elementId)) return "transition";
else if ("org.jboss.tools.flow.jpdl4.swimlane".equals(elementId)) return "swimlane";
+ else if ("org.jboss.tools.flow.jpdl4.timer".equals(elementId)) return "timer";
+ else if ("org.jboss.tools.flow.jpdl4.eventListenerContainer".equals(elementId)) return "on";
+ else if ("org.jboss.tools.flow.jpdl4.eventListener".equals(elementId)) return "event-listener";
else return null;
}
@@ -360,6 +373,54 @@
}
}
+ class TimerWrapperSerializer extends AbstractWrapperSerializer {
+ protected List<String> getAttributesToSave() {
+ ArrayList<String> result = new ArrayList<String>();
+ result.add("duedate");
+ result.add("repeat");
+ result.add("duedatetime");
+ return result;
+ }
+ protected String getPropertyName(String attributeName) {
+ if ("duedate".equals(attributeName)) {
+ return Timer.DUE_DATE;
+ } else if ("repeat".equals(attributeName)) {
+ return Timer.REPEAT;
+ } else if ("duedatetime".equals(attributeName)) {
+ return Timer.DUE_DATETIME;
+ }
+ return super.getPropertyName(attributeName);
+ }
+ }
+
+ class EventListenerContainerWrapperSerializer extends AbstractWrapperSerializer {
+ protected List<String> getAttributesToSave() {
+ ArrayList<String> result = new ArrayList<String>();
+ result.add("event");
+ return result;
+ }
+ protected String getPropertyName(String attributeName) {
+ if ("event".equals(attributeName)) {
+ return EventListenerContainer.EVENT_TYPE;
+ }
+ return super.getPropertyName(attributeName);
+ }
+ }
+
+ class EventListenerWrapperSerializer extends AbstractWrapperSerializer {
+ protected List<String> getAttributesToSave() {
+ ArrayList<String> result = new ArrayList<String>();
+ result.add("class");
+ return result;
+ }
+ protected String getPropertyName(String attributeName) {
+ if ("class".equals(attributeName)) {
+ return EventListener.CLASS_NAME;
+ }
+ return super.getPropertyName(attributeName);
+ }
+ }
+
class ProcessWrapperSerializer extends AbstractWrapperSerializer {
public void appendOpening(StringBuffer buffer, Wrapper wrapper, int level) {
buffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n");
@@ -436,6 +497,12 @@
new ProcessWrapperSerializer().appendOpening(buffer, wrapper, level);
} else if (element instanceof Swimlane) {
new SwimlaneWrapperSerializer().appendOpening(buffer, wrapper, level);
+ } else if (element instanceof Timer) {
+ new TimerWrapperSerializer().appendOpening(buffer, wrapper, level);
+ } else if (element instanceof EventListenerContainer) {
+ new EventListenerContainerWrapperSerializer().appendOpening(buffer, wrapper, level);
+ } else if (element instanceof EventListener) {
+ new EventListenerWrapperSerializer().appendOpening(buffer, wrapper, level);
}
}
@@ -451,6 +518,20 @@
appendToBuffer(buffer, (Wrapper)swimlane, level+1);
}
}
+ List<Element> timers = flowWrapper.getChildren("timer");
+ if (timers != null) {
+ for (Element timer : timers) {
+ if (!(timer instanceof Wrapper)) continue;
+ appendToBuffer(buffer, (Wrapper)timer, level+1);
+ }
+ }
+ List<Element> eventListenerContainers = flowWrapper.getChildren("eventListener");
+ if (eventListenerContainers != null) {
+ for (Element eventListenerContainer : eventListenerContainers) {
+ if (!(eventListenerContainer instanceof Wrapper)) continue;
+ appendToBuffer(buffer, (Wrapper)eventListenerContainer, level+1);
+ }
+ }
}
if (wrapper instanceof ContainerWrapper) {
ContainerWrapper containerWrapper = (ContainerWrapper)wrapper;
@@ -467,6 +548,15 @@
}
}
Element element = (Element)wrapper.getElement();
+ if (element instanceof EventListenerContainer) {
+ List<Element> eventListeners = wrapper.getChildren(EventListenerContainer.LISTENERS);
+ if (eventListeners != null) {
+ for (Element eventListener : eventListeners) {
+ if (!(eventListener instanceof Wrapper)) continue;
+ appendToBuffer(buffer, (Wrapper)eventListener, level+1);
+ }
+ }
+ }
ArrayList<Node> trailingNodeList = (ArrayList<Node>)element.getMetaData("trailingNodes");
boolean appendTrailingNodes = trailingNodeList != null && !trailingNodeList.isEmpty();
if (appendTrailingNodes) {
@@ -521,6 +611,12 @@
buffer.append("</process>");
} else if (element instanceof Swimlane) {
buffer.append("</swimlane>");
+ } else if (element instanceof Timer) {
+ buffer.append("</timer>");
+ } else if (element instanceof EventListenerContainer) {
+ buffer.append("</on>");
+ } else if (element instanceof EventListener) {
+ buffer.append("</event-listener>");
}
}
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/EventListenerListTreeEditPart.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/EventListenerListTreeEditPart.java 2009-04-30 17:54:25 UTC (rev 14985)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/EventListenerListTreeEditPart.java 2009-05-01 03:22:44 UTC (rev 14986)
@@ -26,7 +26,9 @@
}
protected String getText() {
- return "event";
+ String eventType = (String)((Wrapper)getModel()).getPropertyValue(EventListenerContainer.EVENT_TYPE);
+ if (eventType != null && !("".equals(eventType))) return eventType;
+ return "event type";
}
protected List<Object> getModelChildren() {
@@ -50,12 +52,16 @@
}
public void modelChanged(ModelEvent event) {
- EditPart parent = getParent();
- if (parent instanceof JpdlTreeEditPart) {
- ModelEvent modelEvent = new ModelEvent(Wrapper.REMOVE_ELEMENT, "eventListener", getModel(), null, null);
- ((JpdlTreeEditPart)parent).modelChanged(modelEvent);
+ if (event.getChangeType() == Wrapper.REMOVE_ELEMENT) {
+ EditPart parent = getParent();
+ if (parent instanceof JpdlTreeEditPart) {
+ ModelEvent modelEvent = new ModelEvent(Wrapper.REMOVE_ELEMENT, "eventListener", getModel(), null, null);
+ ((JpdlTreeEditPart)parent).modelChanged(modelEvent);
+ }
+ refreshChildren();
+ } else if (event.getChangeType() == Wrapper.CHANGE_PROPERTY) {
+ refreshVisuals();
}
- refreshChildren();
}
}
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/EventListenerTreeEditPart.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/EventListenerTreeEditPart.java 2009-04-30 17:54:25 UTC (rev 14985)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/EventListenerTreeEditPart.java 2009-05-01 03:22:44 UTC (rev 14986)
@@ -3,7 +3,9 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.flow.common.wrapper.ModelEvent;
import org.jboss.tools.flow.common.wrapper.Wrapper;
+import org.jboss.tools.flow.jpdl4.model.EventListener;
import org.jboss.tools.flow.jpdl4.util.SharedImages;
public class EventListenerTreeEditPart extends JpdlTreeEditPart implements ElementTreeEditPart {
@@ -20,7 +22,26 @@
}
protected String getText() {
+ String className = (String)((Wrapper)getModel()).getPropertyValue(EventListener.CLASS_NAME);
+ if (className != null && !("".equals(className))) return className;
return "event";
}
+
+ public void activate() {
+ super.activate();
+ ((Wrapper)getModel()).addListener(this);
+ }
+
+ public void deactivate() {
+ ((Wrapper)getModel()).removeListener(this);
+ super.deactivate();
+ }
+
+ public void modelChanged(ModelEvent event) {
+ if (event.getChangeType() == Wrapper.CHANGE_PROPERTY) {
+ refreshVisuals();
+ }
+ }
+
}
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/SwimlaneTreeEditPart.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/SwimlaneTreeEditPart.java 2009-04-30 17:54:25 UTC (rev 14985)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/SwimlaneTreeEditPart.java 2009-05-01 03:22:44 UTC (rev 14986)
@@ -3,6 +3,8 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.flow.common.properties.IPropertyId;
+import org.jboss.tools.flow.common.wrapper.ModelEvent;
import org.jboss.tools.flow.common.wrapper.Wrapper;
import org.jboss.tools.flow.jpdl4.util.SharedImages;
@@ -20,7 +22,23 @@
}
protected String getText() {
- return "swimlane";
+ String name = (String)((Wrapper)getModel()).getPropertyValue(IPropertyId.NAME);
+ return name == null || "".equals(name) ? "swimlane" : name;
}
+ public void modelChanged(ModelEvent event) {
+ if (event.getChangeType() == Wrapper.CHANGE_PROPERTY) {
+ refreshVisuals();
+ }
+ }
+
+ public void activate() {
+ super.activate();
+ ((Wrapper)getModel()).addListener(this);
+ }
+
+ public void deactivate() {
+ ((Wrapper)getModel()).removeListener(this);
+ super.deactivate();
+ }
}
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/TimerTreeEditPart.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/TimerTreeEditPart.java 2009-04-30 17:54:25 UTC (rev 14985)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/TimerTreeEditPart.java 2009-05-01 03:22:44 UTC (rev 14986)
@@ -3,7 +3,9 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.flow.common.wrapper.ModelEvent;
import org.jboss.tools.flow.common.wrapper.Wrapper;
+import org.jboss.tools.flow.jpdl4.model.Timer;
import org.jboss.tools.flow.jpdl4.util.SharedImages;
public class TimerTreeEditPart extends JpdlTreeEditPart implements ElementTreeEditPart {
@@ -20,7 +22,28 @@
}
protected String getText() {
+ String name = (String)((Wrapper)getModel()).getPropertyValue(Timer.DUE_DATE);
+ if (name != null && !("".equals(name))) return name;
+ name = (String)((Wrapper)getModel()).getPropertyValue(Timer.DUE_DATETIME);
+ if (name != null && !("".equals(name))) return name;
+ name = (String)((Wrapper)getModel()).getPropertyValue(Timer.REPEAT);
+ if (name != null && !("".equals(name))) return name;
return "timer";
}
+ public void modelChanged(ModelEvent event) {
+ if (event.getChangeType() == Wrapper.CHANGE_PROPERTY) {
+ refreshVisuals();
+ }
+ }
+
+ public void activate() {
+ super.activate();
+ ((Wrapper)getModel()).addListener(this);
+ }
+
+ public void deactivate() {
+ ((Wrapper)getModel()).removeListener(this);
+ super.deactivate();
+ }
}
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddEventListenerHandler.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddEventListenerHandler.java 2009-04-30 17:54:25 UTC (rev 14985)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddEventListenerHandler.java 2009-05-01 03:22:44 UTC (rev 14986)
@@ -13,9 +13,8 @@
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.handlers.HandlerUtil;
import org.jboss.tools.flow.common.command.AddChildCommand;
-import org.jboss.tools.flow.common.wrapper.DefaultWrapper;
+import org.jboss.tools.flow.common.registry.ElementRegistry;
import org.jboss.tools.flow.common.wrapper.Wrapper;
-import org.jboss.tools.flow.jpdl4.model.EventListener;
import org.jboss.tools.flow.jpdl4.model.EventListenerContainer;
public class AddEventListenerHandler extends AbstractHandler implements IHandler {
@@ -37,17 +36,16 @@
if (object == null || !(object instanceof CommandStack)) return null;
CommandStack commandStack = (CommandStack)object;
Wrapper parent = (Wrapper)model;
- Wrapper child = new DefaultWrapper();
+ Wrapper child;
AddChildCommand addChildCommand = new AddChildCommand();
if (editPart.getParent() != null && editPart.getParent() instanceof RootEditPart) {
- Wrapper wrapper = new DefaultWrapper();
- wrapper.setElement(new EventListener());
+ child = ElementRegistry.createWrapper("org.jboss.tools.flow.jpdl4.eventListenerContainer");
+ Wrapper wrapper = ElementRegistry.createWrapper("org.jboss.tools.flow.jpdl4.eventListener");
addChildCommand.setType("eventListener");
- child.setElement(new EventListenerContainer());
child.addChild(EventListenerContainer.LISTENERS, wrapper);
} else {
+ child = ElementRegistry.createWrapper("org.jboss.tools.flow.jpdl4.eventListener");
addChildCommand.setType(EventListenerContainer.LISTENERS);
- child.setElement(new EventListener());
}
addChildCommand.setChild(child);
addChildCommand.setParent(parent);
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddTimerHandler.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddTimerHandler.java 2009-04-30 17:54:25 UTC (rev 14985)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddTimerHandler.java 2009-05-01 03:22:44 UTC (rev 14986)
@@ -12,10 +12,9 @@
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.handlers.HandlerUtil;
import org.jboss.tools.flow.common.command.AddChildCommand;
-import org.jboss.tools.flow.common.wrapper.DefaultWrapper;
+import org.jboss.tools.flow.common.registry.ElementRegistry;
import org.jboss.tools.flow.common.wrapper.FlowWrapper;
import org.jboss.tools.flow.common.wrapper.Wrapper;
-import org.jboss.tools.flow.jpdl4.model.Timer;
public class AddTimerHandler extends AbstractHandler implements IHandler {
@@ -37,8 +36,7 @@
if (object == null || !(object instanceof CommandStack)) return null;
CommandStack commandStack = (CommandStack)object;
AddChildCommand addChildCommand = new AddChildCommand();
- Wrapper child = new DefaultWrapper();
- child.setElement(new Timer());
+ Wrapper child = ElementRegistry.createWrapper("org.jboss.tools.flow.jpdl4.timer");
addChildCommand.setChild(child);
addChildCommand.setType("timer");
addChildCommand.setParent(flowWrapper);
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EventListener.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EventListener.java 2009-04-30 17:54:25 UTC (rev 14985)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EventListener.java 2009-05-01 03:22:44 UTC (rev 14986)
@@ -60,7 +60,7 @@
public void setPropertyValue(Object id, Object value) {
if (CLASS_NAME.equals(id)) {
- if (value instanceof String) {
+ if (value == null || value instanceof String) {
setClassName((String)value);
}
}
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EventListenerContainer.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EventListenerContainer.java 2009-04-30 17:54:25 UTC (rev 14985)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EventListenerContainer.java 2009-05-01 03:22:44 UTC (rev 14986)
@@ -77,7 +77,7 @@
public void setPropertyValue(Object id, Object value) {
if (EVENT_TYPE.equals(id)) {
- if (value instanceof String) {
+ if (value == null || value instanceof String) {
setEventType((String)value);
}
}
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Timer.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Timer.java 2009-04-30 17:54:25 UTC (rev 14985)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Timer.java 2009-05-01 03:22:44 UTC (rev 14986)
@@ -101,15 +101,15 @@
public void setPropertyValue(Object id, Object value) {
if (DUE_DATE.equals(id)) {
- if (value instanceof String) {
+ if (value == null || value instanceof String) {
setDueDate((String)value);
}
} else if (REPEAT.equals(id)) {
- if (value instanceof String) {
+ if (value == null || value instanceof String) {
setRepeat((String)value);
}
} else if (DUE_DATETIME.equals(id)) {
- if (value instanceof String) {
+ if (value == null || value instanceof String) {
setDueDateTime((String)value);
}
}
15 years, 8 months