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 25 public class Transition extends DefaultEdge implements WorkflowElement { 26 27 30 public Transition () { 31 this(null); 32 } 33 34 37 public Transition (Object userObject) { 38 super(userObject); 39 } 40 41 42 45 public Activity getSourceActivity () { 46 return (Activity)((DefaultPort)source).getParent(); 47 } 48 49 52 public Activity getTargetActivity () { 53 return (Activity)((DefaultPort)target).getParent(); 54 } 55 56 59 public void showPropertyDialog(Window parentWindow,AbstractGraph graph){ 60 if (!(((DefaultPort)source).getParent() instanceof Start) && 62 !(((DefaultPort)target).getParent() instanceof End)) { 63 64 XMLElementDialog xmlED=((ProcessEditor)graph.getEditor()). 65 getElementEditingDialog(); 66 if (xmlED.isShowing()) { 67 xmlED.switchPanel(getPropertyObject().getPanel(), 68 ResourceManager.getLanguageDependentString("DialogTransitionProperties")+ 69 " - "+userObject.toString(),true); 70 } else { 71 xmlED.setTitle(ResourceManager.getLanguageDependentString("DialogTransitionProperties")+ 72 " - "+userObject.toString()); 73 xmlED.editXMLElement(getPropertyObject().getPanel(),true,false); 74 } 75 } 76 } 77 78 81 public XMLElement getPropertyObject () { 82 return (XMLElement)userObject; 83 } 84 85 88 public XMLElement get (String what) { 89 return ((XMLComplexElement)getPropertyObject()).get(what); 90 } 91 92 96 public void set (String what,Object value) { 97 ((XMLComplexElement)getPropertyObject()).set(what,value); 98 } 99 100 103 public String getTooltip () { 104 if ((getSourceActivity() instanceof Start) || 105 (getTargetActivity() instanceof End)) { 106 107 return null; 108 } 109 else { 110 return ((org.enhydra.jawe.xml.elements.Transition)userObject).getTooltip(); 111 } 112 } 113 114 117 public String toString () { 118 return ""; 119 } 120 121 protected Object cloneUserObject() { 123 return ((org.enhydra.jawe.xml.elements.Transition)userObject).clone(); 124 } 125 126 public boolean hasCondition () { 127 org.enhydra.jawe.xml.elements.Transition tr= 128 (org.enhydra.jawe.xml.elements.Transition)userObject; 129 if (tr==null) return false; 130 if (tr.get("Condition").toString().trim().equals("")) { 131 return false; 132 } else { 133 return true; 134 } 135 } 136 137 public String getType () { 138 org.enhydra.jawe.xml.elements.Transition tr= 139 (org.enhydra.jawe.xml.elements.Transition)userObject; 140 if (tr==null) { 141 return ""; 142 } else { 143 return ((org.enhydra.jawe.xml.elements.Condition)tr.get("Condition")).get("Type").toValue().toString(); 144 } 145 } 146 147 public String getCondition () { 148 org.enhydra.jawe.xml.elements.Transition tr= 149 (org.enhydra.jawe.xml.elements.Transition)userObject; 150 if (tr==null) { 151 return ""; 152 } else { 153 return ((org.enhydra.jawe.xml.elements.Condition)tr.get("Condition")).toString(); 154 } 155 } 156 157 } 158 159 160 | Popular Tags |