1 10 11 package org.enhydra.jawe.xml.elements; 12 13 import org.enhydra.jawe.xml.*; 14 import org.enhydra.jawe.xml.panels.*; 15 import org.w3c.dom.*; 16 17 22 public class Implementation extends XMLComplexElement { 23 private XMLComplexChoice refType; 25 26 31 public Implementation (Activity act) { 32 super(); 33 34 38 refType=new XMLComplexChoice("Type",new XMLElement[] { 39 new No(), new Tools(act), new SubFlow(act)},1,true); 40 41 fillStructure (); 42 } 43 44 48 protected void fillStructure () { 49 refType.setRequired(true); 50 complexStructure.add(refType); 51 } 52 53 59 public void fromXML (Node node) { 60 String nameSpacePrefix=node.getPrefix(); 61 if (nameSpacePrefix!=null) { 62 nameSpacePrefix+=":"; 63 } else { 64 nameSpacePrefix=""; 65 } 66 67 Object [] choices=refType.getChoices(); 68 String elContent; 69 String elName; 70 for (int i=0; i<choices.length; i++) { 75 XMLElement chc=(XMLElement)choices[i]; 76 elName=chc.toName(); 77 if (elName.equals("Tools")) { 78 elName="Tool"; 79 } 80 if (node!=null) { 82 Node child=XMLUtil.getChildByName(node,nameSpacePrefix+elName); 83 if (child != null) { 84 if (elName.equals("Tool")) { 85 chc.fromXML(node); 86 } else { 87 chc.fromXML(child); 88 } 89 refType.setValue(chc); 90 break; 91 } 92 } 93 } 94 } 95 96 102 public XMLPanel getPanel () { 103 return refType.getPanel(); 104 } 105 106 113 public Object clone () { 114 Implementation i=(Implementation)super.clone(); 115 116 i.refType=(XMLComplexChoice)this.refType.clone(); 117 i.fillStructure(); 118 119 return i; 120 } 121 122 } 123 | Popular Tags |