Author: koen.aers(a)jboss.com
Date: 2008-07-24 08:54:41 -0400 (Thu, 24 Jul 2008)
New Revision: 9265
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/BaseNodeWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/EndStateWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/ProcessWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StartStateWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StateWrapper.java
Log:
only one start state per process
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/BaseNodeWrapper.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/BaseNodeWrapper.java 2008-07-24
12:53:35 UTC (rev 9264)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/BaseNodeWrapper.java 2008-07-24
12:54:41 UTC (rev 9265)
@@ -3,61 +3,58 @@
import org.eclipse.draw2d.geometry.Rectangle;
import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
import org.jboss.tools.flow.editor.core.AbstractNodeWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
import org.jboss.tools.flow.jpdl4.core.Node;
public abstract class BaseNodeWrapper extends AbstractNodeWrapper {
-
- public void setNode(Node node) {
- setElement(node);
- }
-
- public Node getNode() {
- return (Node) getElement();
- }
-
- public String getId() {
- long id = getNode().getId();
- return id == -1 ? null : getNode().getId() + "";
- }
- public String getName() {
- return getNode().getName();
- }
+ public void setNode(Node node) {
+ setElement(node);
+ }
- public void internalSetName(String name) {
- getNode().setName(name);
- notifyListeners(CHANGE_VISUAL);
- }
-
- protected void internalSetConstraint(Rectangle constraint) {
- Node node = getNode();
- node.setMetaData("x", constraint.x);
- node.setMetaData("y", constraint.y);
- node.setMetaData("width", constraint.width);
- node.setMetaData("height", constraint.height);
- }
-
- public Rectangle internalGetConstraint() {
- Node node = getNode();
- Integer x = (Integer) node.getMetaData("x");
- Integer y = (Integer) node.getMetaData("y");
- Integer width = (Integer) node.getMetaData("width");
- Integer height = (Integer) node.getMetaData("height");
- return new Rectangle(
- x == null ? 0 : x,
- y == null ? 0 : y,
- width == null ? -1 : width,
- height == null ? -1 : height);
- }
+ public Node getNode() {
+ return (Node) getElement();
+ }
- public boolean acceptsIncomingConnection(AbstractConnectionWrapper connection,
BaseNodeWrapper source) {
- return source == null
- || ((BaseNodeWrapper) source).getNode().getNodeContainer() ==
getNode().getNodeContainer();
- }
+ public String getId() {
+ long id = getNode().getId();
+ return id == -1 ? null : getNode().getId() + "";
+ }
- public boolean acceptsOutgoingConnection(AbstractConnectionWrapper connection,
BaseNodeWrapper target) {
- return target == null
- || ((BaseNodeWrapper) target).getNode().getNodeContainer() ==
getNode().getNodeContainer();
- }
-
+ public String getName() {
+ return getNode().getName();
+ }
+
+ public void internalSetName(String name) {
+ getNode().setName(name);
+ notifyListeners(CHANGE_VISUAL);
+ }
+
+ protected void internalSetConstraint(Rectangle constraint) {
+ Node node = getNode();
+ node.setMetaData("x", constraint.x);
+ node.setMetaData("y", constraint.y);
+ node.setMetaData("width", constraint.width);
+ node.setMetaData("height", constraint.height);
+ }
+
+ public Rectangle internalGetConstraint() {
+ Node node = getNode();
+ Integer x = (Integer) node.getMetaData("x");
+ Integer y = (Integer) node.getMetaData("y");
+ Integer width = (Integer) node.getMetaData("width");
+ Integer height = (Integer) node.getMetaData("height");
+ return new Rectangle(x == null ? 0 : x, y == null ? 0 : y,
+ width == null ? -1 : width, height == null ? -1 : height);
+ }
+
+ public boolean acceptsIncomingConnection(
+ AbstractConnectionWrapper connection, NodeWrapper source) {
+ return true;
+ }
+
+ public boolean acceptsOutgoingConnection(
+ AbstractConnectionWrapper connection, NodeWrapper target) {
+ return true;
+ }
}
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/EndStateWrapper.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/EndStateWrapper.java 2008-07-24
12:53:35 UTC (rev 9264)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/EndStateWrapper.java 2008-07-24
12:54:41 UTC (rev 9265)
@@ -15,11 +15,6 @@
return (EndState) getElement();
}
- public boolean acceptsIncomingConnection(AbstractConnectionWrapper connection,
NodeWrapper source) {
- return super.acceptsIncomingConnection(connection, (BaseNodeWrapper)source)
- && getIncomingConnections().isEmpty();
- }
-
public boolean acceptsOutgoingConnection(AbstractConnectionWrapper connection,
NodeWrapper target) {
return false;
}
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/ProcessWrapper.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/ProcessWrapper.java 2008-07-24
12:53:35 UTC (rev 9264)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/ProcessWrapper.java 2008-07-24
12:54:41 UTC (rev 9265)
@@ -4,6 +4,7 @@
import org.jboss.tools.flow.editor.core.NodeWrapper;
import org.jboss.tools.flow.jpdl4.core.Node;
import org.jboss.tools.flow.jpdl4.core.Process;
+import org.jboss.tools.flow.jpdl4.core.StartState;
public class ProcessWrapper extends AbstractRootWrapper {
@@ -53,4 +54,11 @@
getProcess().removeNode(((BaseNodeWrapper) element).getNode());
}
+ public boolean acceptsElement(NodeWrapper element) {
+ if (element.getElement() instanceof StartState) {
+ return getProcess().getStartState() == null;
+ }
+ return super.acceptsElement(element);
+ }
+
}
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StartStateWrapper.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StartStateWrapper.java 2008-07-24
12:53:35 UTC (rev 9264)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StartStateWrapper.java 2008-07-24
12:54:41 UTC (rev 9265)
@@ -21,8 +21,4 @@
return false;
}
- public boolean acceptsOutgoingConnection(AbstractConnectionWrapper connection,
NodeWrapper target) {
- return super.acceptsOutgoingConnection(connection, (BaseNodeWrapper)target)
- && getOutgoingConnections().isEmpty();
- }
}
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StateWrapper.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StateWrapper.java 2008-07-24
12:53:35 UTC (rev 9264)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StateWrapper.java 2008-07-24
12:54:41 UTC (rev 9265)
@@ -1,7 +1,5 @@
package org.jboss.tools.flow.jpdl4.graph.wrapper;
-import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
-import org.jboss.tools.flow.editor.core.NodeWrapper;
import org.jboss.tools.flow.jpdl4.core.State;
public class StateWrapper extends BaseNodeWrapper {
@@ -15,14 +13,5 @@
return (State) getElement();
}
- public boolean acceptsIncomingConnection(AbstractConnectionWrapper connection,
NodeWrapper source) {
- return super.acceptsIncomingConnection(connection, (BaseNodeWrapper)source)
- && getIncomingConnections().isEmpty();
- }
-
- public boolean acceptsOutgoingConnection(AbstractConnectionWrapper connection,
NodeWrapper target) {
- return super.acceptsOutgoingConnection(connection, (BaseNodeWrapper)target)
- && getOutgoingConnections().isEmpty();
- }
}
Show replies by date