01: package org.openwfe.gpe.model;
02:
03: import org.eclipse.jface.dialogs.MessageDialog;
04:
05: /**
06: * @author helena
07: */
08: public class NotElement extends OneChild {
09:
10: public static String name = "Not";
11:
12: public String getName() {
13: return name;
14: }
15:
16: public void setName(String s) {
17: name = s;
18: }
19:
20: public void addChild(FlowElement child, int index) {
21:
22: if (index >= 0
23: && maximum < 1
24: && (child instanceof CompareElement
25: || child instanceof DefinedElement
26: || child instanceof UndefinedElement
27: || child instanceof BooleanComposite || child instanceof NotElement)) {
28: children.add(index, child);
29: maximum++;
30: fireStructureChange(CHILDREN, child);
31: } else if (maximum < 1
32: && (child instanceof CompareElement
33: || child instanceof DefinedElement
34: || child instanceof UndefinedElement
35: || child instanceof BooleanComposite || child instanceof NotElement)) {
36: children.add(child);
37: maximum++;
38: fireStructureChange(CHILDREN, child);
39: } else {
40: if (maximum < 1
41: && (!(child instanceof CompareElement
42: || child instanceof DefinedElement
43: || child instanceof UndefinedElement
44: || child instanceof BooleanComposite || child instanceof NotElement)))
45: MessageDialog.openInformation(null, "Alert",
46: "You cannot add this element");
47: else if (maximum == 1)
48: MessageDialog.openInformation(null, "Alert",
49: "No more elements can be added");
50: }
51:
52: }
53:
54: }
|