1 10 11 package org.enhydra.jawe.xml.elements; 12 13 import org.enhydra.jawe.xml.*; 14 import org.enhydra.jawe.xml.panels.*; 15 16 import java.util.*; 17 18 24 public class FormalParameters extends XMLCollection { 25 26 private transient Package myPackage=null; 27 28 int[] invisibleTableFieldOrdinals; 29 30 36 public FormalParameters (XMLComplexElement myOwner,Package myPackage) { 37 super(myOwner); 38 this.myPackage=myPackage; 39 40 initInvisibleTableFieldOrdinals(); 41 } 42 43 49 public XMLElement generateNewElement() { 50 FormalParameter fp=new FormalParameter(this,myPackage); 51 fp.setRequired(true); 52 return fp; 53 } 54 55 61 public Collection getTableElements () { 62 if (myOwner instanceof WorkflowProcess) { 63 if (!((WorkflowProcess)myOwner).getPackage().isReadOnly()) { 64 Iterator i = refCollectionElements.iterator(); 65 while (i.hasNext()) { 66 FormalParameter fp=(FormalParameter)i.next(); 67 if (!isUsedWithinTransitionConditions(fp)) { 71 fp.get("Id").setReadOnly(false); 72 } else { 73 fp.get("Id").setReadOnly(true); 74 } 75 } 76 } 77 } 78 return super.getTableElements(); 79 } 80 81 92 public FormalParameter getFormalParameter (String ID) { 93 return (FormalParameter)super.getCollectionElement(ID); 94 } 95 96 100 public boolean canRemoveElement (XMLElement el) { 101 boolean remove=true; 102 FormalParameter toRemove=(FormalParameter)el; 103 if (myOwner instanceof WorkflowProcess) { 107 Activities acts=(Activities)myOwner.get("Activities"); 108 remove=acts.canRemoveDataFieldOrFormalParameter(toRemove); 109 if (remove==true) { 111 Transitions ts=(Transitions)myOwner.get("Transitions"); 112 remove=ts.canRemoveDataFieldOrFormalParameter(toRemove); 113 } 114 if (remove==true) { 116 ActivitySets actsts=(ActivitySets)myOwner.get("ActivitySets"); 117 remove=actsts.canRemoveDataFieldOrFormalParameter(toRemove); 118 } 119 } 120 return remove; 121 } 122 123 protected boolean isUsedWithinTransitionConditions (FormalParameter fp) { 124 boolean inUse=false; 125 if (myOwner instanceof WorkflowProcess) { 128 Transitions ts=(Transitions)myOwner.get("Transitions"); 129 inUse=!ts.canRemoveDataFieldOrFormalParameter(fp); 130 if (inUse==false) { 132 ActivitySets actsts=(ActivitySets)myOwner.get("ActivitySets"); 133 inUse=actsts.isDataFieldOrFormalParameterUsedWithinTransitionConditions(fp); 134 } 135 } 136 return inUse; 137 } 138 139 public int[] getInvisibleTableFieldOrdinals () { 140 return invisibleTableFieldOrdinals; 141 } 142 143 public XMLPanel getMiniContentPanel () { 144 invisibleTableFieldOrdinals=new int[2]; 145 invisibleTableFieldOrdinals[0]=1; 146 invisibleTableFieldOrdinals[1]=4; 147 XMLPanel cpMini=new XMLTablePanel(this,toLabel(),false,true,true,coloringTable,true); 148 initInvisibleTableFieldOrdinals(); 149 return cpMini; 150 } 151 152 private void initInvisibleTableFieldOrdinals () { 153 invisibleTableFieldOrdinals=new int[1]; 154 invisibleTableFieldOrdinals[0]=4; 155 } 156 157 } 158 | Popular Tags |