1 10 11 package org.enhydra.jawe.graph; 12 13 import org.enhydra.jawe.*; 14 import org.enhydra.jawe.xml.*; 15 16 import org.jgraph.graph.*; 17 18 import java.util.*; 19 import java.awt.*; 20 import javax.swing.*; 21 22 27 public class Participant extends DefaultGraphCell implements WorkflowElement { 28 29 32 public Participant() { 33 this(null); 34 } 35 36 39 public Participant(Object userObject) { 40 super(userObject); 41 } 42 43 44 47 public boolean hasAnyParticipant () { 48 for (int i=0; i<getChildCount(); i++) { 49 if (getChildAt(i) instanceof Participant) { 50 return true; 51 } 52 } 53 return false; 54 } 55 56 60 public int howManyChildParticipants () { 61 int cd=0; 62 for (int i=0; i<getChildCount(); i++) { 63 if (getChildAt(i) instanceof Participant) { 64 cd++; 65 } 66 } 67 return cd; 68 } 69 70 74 public Set getChildParticipants () { 75 Set childParticipants=new HashSet(); 76 for (int i=0; i<getChildCount(); i++) { 77 Object child=getChildAt(i); 78 if (child instanceof Participant) { 79 childParticipants.add(child); 80 } 81 } 82 return childParticipants; 83 } 84 85 89 public boolean hasAnyActivity () { 90 for (int i=0; i<getChildCount(); i++) { 91 if (getChildAt(i) instanceof Activity) { 92 return true; 93 } 94 } 95 return false; 96 } 97 98 103 public int howManyChildActivities () { 104 int ca=0; 105 for (int i=0; i<getChildCount(); i++) { 106 if (getChildAt(i) instanceof Activity) { 107 ca++; 108 } 109 } 110 return ca; 111 } 112 113 118 public Set getChildActivities () { 119 Set childActivities=new HashSet(); 120 for (int i=0; i<getChildCount(); i++) { 121 Object child=getChildAt(i); 122 if (child instanceof Activity) { 123 childActivities.add(child); 124 } 125 } 126 return childActivities; 127 } 128 129 133 public void showPropertyDialog(Window parentWindow,AbstractGraph graph){ 134 org.enhydra.jawe.xml.elements.Participant p= 136 (org.enhydra.jawe.xml.elements.Participant)userObject; 137 if (p==org.enhydra.jawe.xml.elements.Participant.getFreeTextExpressionParticipant() || 138 p.getCollection().getOwner() instanceof org.enhydra.jawe.xml.elements.Package) { 139 p.setReadOnly(true); 140 } 141 XMLElementDialog xmlED=((ProcessEditor)graph.getEditor()). 142 getElementEditingDialog(); 143 if (xmlED.isShowing()) { 144 xmlED.switchPanel(getPropertyObject().getPanel(), 145 ResourceManager.getLanguageDependentString("DialogParticipantProperties")+ 146 " - "+userObject.toString(),true); 147 } else { 148 xmlED.setTitle(ResourceManager.getLanguageDependentString("DialogParticipantProperties")+ 149 " - "+userObject.toString()); 150 xmlED.editXMLElement(getPropertyObject().getPanel(),true,false); 151 } 152 153 } 154 155 158 public XMLElement getPropertyObject () { 159 return (XMLElement)userObject; 160 } 161 162 163 166 public XMLElement get (String what) { 167 return ((XMLComplexElement)getPropertyObject()).get(what); 168 } 169 170 174 public void set (String what,Object value) { 175 ((XMLComplexElement)getPropertyObject()).set(what,value); 176 } 177 178 181 public String getTooltip () { 182 return ((org.enhydra.jawe.xml.elements.Participant)userObject).getTooltip(); 183 } 184 187 public String toString () { 188 return userObject.toString(); 189 } 190 191 195 protected Object cloneUserObject() { 196 return null; 197 } 198 199 } 200 201 202 | Popular Tags |