1 10 11 package org.enhydra.jawe.xml.elements; 12 13 14 import org.enhydra.jawe.xml.*; 15 import org.enhydra.jawe.xml.panels.*; 16 17 import java.util.*; 18 import javax.swing.tree.*; 19 import java.awt.*; 20 21 import org.w3c.dom.*; 22 23 26 public class ActivitySet extends XMLCollectionElement { 27 private Activities refActivities; 28 private Transitions refTransitions; 29 30 31 private transient WorkflowProcess myWorkflow=null; 32 33 39 public ActivitySet (ActivitySets ass,WorkflowProcess myWorkflow) { 40 super (ass); 41 ass.decrementID(); 43 44 this.myWorkflow=myWorkflow; 45 46 refActivities=new Activities(this); 47 refTransitions=new Transitions(this); 48 49 fillStructure(); 50 } 51 52 56 protected void fillStructure () { 57 super.fillStructure(); 58 attrId.setReadOnly(true); 59 complexStructure.add(refActivities); 60 complexStructure.add(refTransitions); 61 } 62 63 64 public void setIDPrefixForCollections () { 65 String colPref=getID()+this.ID_DELIMITER; 66 refActivities.setIDPrefix(colPref+"Act"); 67 refTransitions.setIDPrefix(colPref+"Tra"); 68 } 69 70 75 public WorkflowProcess getOwnerProcess () { 76 return myWorkflow; 77 } 78 79 86 protected void afterImporting () { 87 refActivities.afterImporting(); 88 refTransitions.afterImporting(); 89 refActivities.fillOutgoingTransitions(); 90 } 91 92 99 public XMLPanel getPanel () { 100 return new XMLGroupPanel(this, 101 new XMLElement[] { 102 attrId, 103 refActivities, 104 refTransitions 105 },toLabel()); 106 } 107 108 112 protected boolean canRemoveWorkflow (WorkflowProcess toRemove) { 113 return refActivities.canRemoveWorkflow(toRemove); 114 } 115 116 120 protected boolean canRemoveParticipant (Participant toRemove) { 121 return refActivities.canRemoveParticipant(toRemove); 122 } 123 124 127 protected boolean canRemoveApplication (Application toRemove) { 128 return refActivities.canRemoveApplication(toRemove); 129 } 130 131 134 protected boolean canRemoveDataFieldOrFormalParameter (XMLCollectionElement toRemove) { 135 boolean cr=refActivities.canRemoveDataFieldOrFormalParameter(toRemove); 136 if (cr==false) { 137 return false; 138 } 139 return refTransitions.canRemoveDataFieldOrFormalParameter(toRemove); 140 } 141 142 147 protected boolean isDataFieldOrFormalParameterUsedWithinTransitionConditions (XMLCollectionElement toRemove) { 148 return !refTransitions.canRemoveDataFieldOrFormalParameter(toRemove); 149 } 150 151 public String toString () { 152 return attrId.toString(); 153 } 154 155 161 public void toXML (Node parent) throws DOMException { 162 if (parent.getOwnerDocument()!=null) { 163 super.toXML(parent); 164 } else { 166 Node node = ((Document) parent).createElement(name); 167 super.toXML(node); 168 parent.appendChild(node); 169 } 170 } 171 172 public void fromXML(Node node) { 173 processAttributes(node); 174 setIDPrefixForCollections(); 175 processElements(node); 176 177 ((ActivitySets)myCollection).updateID(getID()); 178 } 179 180 } 181 | Popular Tags |