01: package org.openwfe.gpe.model;
02:
03: import org.eclipse.jface.dialogs.MessageDialog;
04:
05: public class ActivityDiagram extends ConcurrenceComposite {
06: /**
07: * The class represents the canvas of the editor
08: */
09: private boolean one = false;
10:
11: public ActivityDiagram() {
12: super ();
13: }
14:
15: public void addChild(FlowElement child) {
16: addChild(child, -1);
17: }
18:
19: public void addChild(FlowElement child, int index) {
20: if (child instanceof WorkflowElement && one == false) {
21: if (index >= 0) {
22: children.add(index, child);
23: fireStructureChange(CHILDREN, child);
24: one = true;
25: } else {
26: children.add(child);
27: fireStructureChange(CHILDREN, child);
28: one = true;
29: }
30: } else if (!(child instanceof WorkflowElement)) {
31: children.add(child);
32: fireStructureChange(CHILDREN, child);
33: } else {
34: MessageDialog.openInformation(null, "Alert",
35: "A workflow has already been defined");
36: }
37: }
38:
39: public void removeChild(FlowElement child) {
40: children.remove(child);
41: fireStructureChange(CHILDREN, child);
42: one = false;
43: }
44: }
|