Author: koen.aers(a)jboss.com
Date: 2009-05-28 14:55:41 -0400 (Thu, 28 May 2009)
New Revision: 15586
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/EventListenerContainerTimerSection.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/SequenceFlowTimerSection.java
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/JpdlSerializer.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/SequenceFlow.java
Log:
Timers on events and transitions (GPD-323)
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2009-05-28 16:11:13 UTC (rev
15585)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2009-05-28 18:55:41 UTC (rev
15586)
@@ -350,7 +350,7 @@
</propertySection>
<propertySection
class="org.jboss.tools.flow.jpdl4.properties.EventTypeSection"
- id="org.jboss.tools.jpdl4.eventType"
+ id="org.jboss.tools.jpdl4.eventListenerContainer.eventType"
tab="org.jboss.tools.jpdl4.general">
<input
type="org.jboss.tools.flow.jpdl4.model.EventListenerContainer"/>
</propertySection>
@@ -423,6 +423,20 @@
tab="org.jboss.tools.jpdl4.general">
<input
type="org.jboss.tools.flow.jpdl4.model.TerminateEndEvent"/>
</propertySection>
+ <propertySection
+
afterSection="org.jboss.tools.jpdl4.eventListenerContainer.eventType"
+
class="org.jboss.tools.flow.jpdl4.properties.EventListenerContainerTimerSection"
+ id="org.jboss.tools.jpdl4.eventListenerContainer.timer"
+ tab="org.jboss.tools.jpdl4.general">
+ <input
type="org.jboss.tools.flow.jpdl4.model.EventListenerContainer"/>
+ </propertySection>
+ <propertySection
+ afterSection="org.jboss.tools.jpdl4.name"
+
class="org.jboss.tools.flow.jpdl4.properties.SequenceFlowTimerSection"
+ id="org.jboss.tools.jpdl4.sequenceFlow.timer"
+ tab="org.jboss.tools.jpdl4.general">
+ <input
type="org.jboss.tools.flow.jpdl4.model.SequenceFlow"/>
+ </propertySection>
</propertySections>
</extension>
<extension
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-05-28
16:11:13 UTC (rev 15585)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlDeserializer.java 2009-05-28
18:55:41 UTC (rev 15586)
@@ -24,6 +24,7 @@
import org.jboss.tools.flow.jpdl4.model.ExclusiveGateway;
import org.jboss.tools.flow.jpdl4.model.HumanTask;
import org.jboss.tools.flow.jpdl4.model.Process;
+import org.jboss.tools.flow.jpdl4.model.SequenceFlow;
import org.jboss.tools.flow.jpdl4.model.SubprocessTask;
import org.jboss.tools.flow.jpdl4.model.Swimlane;
import org.jboss.tools.flow.jpdl4.model.TerminateEndEvent;
@@ -249,6 +250,12 @@
if (!(parent instanceof ConnectionWrapper)) return result;
ConnectionWrapper connectionWrapper = (ConnectionWrapper)parent;
if (node instanceof Element) {
+ if ("timer".equals(node.getNodeName())) {
+ String duedate = ((Element)node).getAttribute("duedate");
+ if (duedate != null && !("".equals(duedate))) {
+ parent.setPropertyValue(SequenceFlow.TIMER, duedate);
+ }
+ }
result = createWrapper((Element)node);
if (result == null) return null;
if (result instanceof Wrapper) {
@@ -286,11 +293,20 @@
class EventListenerContainerChildNodeHandler implements ChildNodeDeserializer {
public Wrapper deserializeChildNode(Wrapper parent, Node node) {
Wrapper result = null;
+ if (!(parent.getElement() instanceof EventListenerContainer)) return result;
if (node instanceof Element) {
- result = createWrapper((Element)node);
- if (result == null) return null;
- if (result.getElement() instanceof EventListener) {
- parent.addChild(EventListenerContainer.LISTENERS, result);
+ if ("timer".equals(node.getNodeName())) {
+ String duedate = ((Element)node).getAttribute("duedate");
+ if (duedate != null && !("".equals(duedate))) {
+ ((EventListenerContainer)parent.getElement()).setTimer(duedate);
+ }
+ } else {
+ result = createWrapper((Element)node);
+ if (result != null) {
+ if (result.getElement() instanceof EventListener) {
+ parent.addChild(EventListenerContainer.LISTENERS, result);
+ }
+ }
}
}
return result;
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-05-28
16:11:13 UTC (rev 15585)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlSerializer.java 2009-05-28
18:55:41 UTC (rev 15586)
@@ -266,6 +266,12 @@
buffer.append("\"");
}
public void appendBody(StringBuffer buffer, Wrapper wrapper, int level) {
+ String timer = (String)wrapper.getPropertyValue(SequenceFlow.TIMER);
+ if (timer != null && !("".equals(timer))) {
+ buffer.append("\n");
+ appendPadding(buffer, level + 1);
+ buffer.append("<timer duedate=\"" + timer +
"\"/>");
+ }
List<Element> eventListeners = wrapper.getChildren("listener");
if (eventListeners != null) {
for (Element eventListener : eventListeners) {
@@ -485,6 +491,13 @@
return super.getPropertyName(attributeName);
}
public void appendBody(StringBuffer buffer, Wrapper wrapper, int level) {
+ EventListenerContainer eventListenerContainer =
(EventListenerContainer)wrapper.getElement();
+ String timer = eventListenerContainer.getTimer();
+ if (timer != null && !"".equals(timer)) {
+ buffer.append("\n");
+ appendPadding(buffer, level + 1);
+ buffer.append("<timer duedate=\"" + timer +
"\"/>");
+ }
List<Element> eventListeners =
wrapper.getChildren(EventListenerContainer.LISTENERS);
if (eventListeners != null) {
for (Element eventListener : eventListeners) {
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-05-28
16:11:13 UTC (rev 15585)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EventListenerContainer.java 2009-05-28
18:55:41 UTC (rev 15586)
@@ -13,7 +13,10 @@
public static final String LISTENERS =
"org.jboss.tools.flow.jpdl4.model.eventListenerContainer.listeners";
public static final String EVENT_TYPE =
"org.jboss.tools.flow.jpdl4.model.eventListenerContainer.eventType";
+ public static final String TIMER =
"org.jboss.tools.flow.jpdl4.model.eventListenerContainer.timer";
+
private String eventType;
+ private String timer;
private List<EventListener> listeners = new ArrayList<EventListener>();
public EventListenerContainer() {
@@ -28,6 +31,14 @@
this.eventType = eventType;
}
+ public String getTimer() {
+ return timer;
+ }
+
+ public void setTimer(String timer) {
+ this.timer = timer;
+ }
+
public List<EventListener> getListeners() {
return listeners;
}
@@ -58,7 +69,9 @@
if (LISTENERS.equals(id)) {
return listeners;
} else if (EVENT_TYPE.equals(id)) {
- return getEventType() != null ? getEventType() : "";
+ return getEventType();
+ } else if (TIMER.equals(id)) {
+ return getTimer();
}
return null;
}
@@ -68,6 +81,8 @@
return true;
} else if (EVENT_TYPE.equals(id)) {
return getEventType() != null;
+ } else if (TIMER.equals(id)) {
+ return getTimer() != null;
}
return false;
}
@@ -77,10 +92,10 @@
public void setPropertyValue(Object id, Object value) {
if (EVENT_TYPE.equals(id)) {
- if (value == null || value instanceof String) {
- setEventType((String)value);
- }
- }
+ setEventType((String)value);
+ } else if (TIMER.equals(id)) {
+ setTimer((String)value);
+ }
}
}
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/SequenceFlow.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/SequenceFlow.java 2009-05-28
16:11:13 UTC (rev 15585)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/SequenceFlow.java 2009-05-28
18:55:41 UTC (rev 15586)
@@ -12,8 +12,11 @@
public class SequenceFlow extends DefaultConnection {
+ public static final String TIMER =
"org.jboss.tools.flow.jpdl4.model.eventListenerContainer.timer";
+
private String name;
private boolean conditional = false;
+ private String timer;
public SequenceFlow() {
this(null, null);
@@ -32,6 +35,14 @@
return name;
}
+ public String getTimer() {
+ return timer;
+ }
+
+ public void setTimer(String timer) {
+ this.timer = timer;
+ }
+
public void setConditional(boolean conditional) {
this.conditional = conditional;
}
@@ -71,7 +82,9 @@
public Object getPropertyValue(Object id) {
if (NAME.equals(id) || LABEL.equals(id)) {
- return getName() != null ? getName() : "";
+ return getName();
+ } else if (TIMER.equals(id)) {
+ return getTimer();
}
return null;
}
@@ -79,6 +92,8 @@
public boolean isPropertySet(Object id) {
if (NAME.equals(id) || LABEL.equals(id)) {
return getName() != null;
+ } else if (TIMER.equals(id)) {
+ return getTimer() != null;
}
return false;
}
@@ -88,10 +103,10 @@
public void setPropertyValue(Object id, Object value) {
if (NAME.equals(id) || LABEL.equals(id)) {
- if (value instanceof String) {
- setName((String)value);
- }
- }
+ setName((String)value);
+ } else if (TIMER.equals(id)) {
+ setTimer((String)value);
+ }
}
}
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/EventListenerContainerTimerSection.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/EventListenerContainerTimerSection.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/EventListenerContainerTimerSection.java 2009-05-28
18:55:41 UTC (rev 15586)
@@ -0,0 +1,11 @@
+package org.jboss.tools.flow.jpdl4.properties;
+
+import org.jboss.tools.flow.jpdl4.model.EventListenerContainer;
+
+public class EventListenerContainerTimerSection extends TextFieldPropertySection {
+
+ public EventListenerContainerTimerSection() {
+ super(EventListenerContainer.TIMER, "Timer");
+ }
+
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/EventListenerContainerTimerSection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/SequenceFlowTimerSection.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/SequenceFlowTimerSection.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/SequenceFlowTimerSection.java 2009-05-28
18:55:41 UTC (rev 15586)
@@ -0,0 +1,11 @@
+package org.jboss.tools.flow.jpdl4.properties;
+
+import org.jboss.tools.flow.jpdl4.model.SequenceFlow;
+
+public class SequenceFlowTimerSection extends TextFieldPropertySection {
+
+ public SequenceFlowTimerSection() {
+ super(SequenceFlow.TIMER, "Timer");
+ }
+
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/SequenceFlowTimerSection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain