001: /*
002: * Created on 7 mai 2005
003: *
004: */
005: package org.openwfe.gpe.model;
006:
007: import org.eclipse.jface.dialogs.MessageDialog;
008: import org.eclipse.ui.views.properties.IPropertyDescriptor;
009: import org.eclipse.ui.views.properties.TextPropertyDescriptor;
010:
011: /**
012: * @author Christelle
013: *
014: */
015: public class WorkflowElement extends Composite {
016:
017: private String privateName = "";
018: public static String name = "Process-Definition";
019: private String revision = "";
020: private String description = "enter a description for this workflow";
021: private String language = "english";
022: private boolean one = false;
023:
024: protected static IPropertyDescriptor[] descriptors;
025:
026: public static final String PRIVATENAME = "privateName";
027: public static final String REVISION = "revision";
028: public static final String DESCRIPTION = "description";
029: public static final String LANGUAGE = "language";
030:
031: static {
032: descriptors = new IPropertyDescriptor[] {
033: new TextPropertyDescriptor(PRIVATENAME, "name"),
034: new TextPropertyDescriptor(REVISION, "revision"),
035: new TextPropertyDescriptor(DESCRIPTION, "description"),
036: new TextPropertyDescriptor(LANGUAGE, "language"), };
037: }
038:
039: public String getPrivateName() {
040: return privateName;
041: }
042:
043: public void setPrivateName(String s) {
044: privateName = s;
045: firePropertyChange(PRIVATENAME, null, s);
046: }
047:
048: public String getName() {
049: return name;
050: }
051:
052: public void setName(String s) {
053: name = s;
054: }
055:
056: public String getRevision() {
057: return revision;
058: }
059:
060: public void setRevision(String s) {
061: revision = s;
062: firePropertyChange(REVISION, null, s);
063: }
064:
065: /**
066: * @return Returns the description.
067: */
068: public String getDescription() {
069: return description;
070: }
071:
072: /**
073: * @param description The description to set.
074: */
075: public void setDescription(String description) {
076: this .description = description;
077: firePropertyChange(DESCRIPTION, null, description);
078: }
079:
080: /**
081: * @return Returns the language.
082: */
083: public String getLanguage() {
084: return language;
085: }
086:
087: /**
088: * @param language The language to set.
089: */
090: public void setLanguage(String language) {
091: this .language = language;
092: firePropertyChange(LANGUAGE, null, language);
093: }
094:
095: public IPropertyDescriptor[] getPropertyDescriptors() {
096: return descriptors;
097: }
098:
099: public Object getPropertyValue(Object propName) {
100: if (PRIVATENAME.equals(propName))
101: return getPrivateName();
102: if (REVISION.equals(propName))
103: return getRevision();
104: if (DESCRIPTION.equals(propName))
105: return getDescription();
106: if (LANGUAGE.equals(propName))
107: return getLanguage();
108: return super .getPropertyValue(propName);
109: }
110:
111: public void setPropertyValue(Object id, Object value) {
112: if (id == PRIVATENAME)
113: setPrivateName((String) value);
114: if (id == REVISION)
115: setRevision((String) value);
116: if (id == DESCRIPTION)
117: setDescription((String) value);
118: if (id == LANGUAGE)
119: setLanguage((String) value);
120: }
121:
122: public void addChild(FlowElement child) {
123: addChild(child, -1);
124: }
125:
126: public void addChild(FlowElement child, int index) {
127: if (!(child instanceof WorkflowElement)) {
128: if (index >= 0) {
129: children.add(index, child);
130: fireStructureChange(CHILDREN, child);
131: one = true;
132: } else {
133: children.add(child);
134: fireStructureChange(CHILDREN, child);
135: one = true;
136: }
137: } else {
138: MessageDialog.openInformation(null, "Alert",
139: "A workflow has already been defined");
140: }
141: }
142: }
|