1 10 11 12 package org.enhydra.jawe.xml; 13 14 import org.enhydra.jawe.xml.panels.XMLPanel; 15 16 import java.util.*; 17 import org.w3c.dom.*; 18 19 23 public class XMLCollectionElement extends XMLComplexElement { 24 25 public static final String ID_DELIMITER="_"; 26 27 protected XMLAttribute attrId=new XMLAttribute("Id"); protected transient XMLCollection myCollection; 29 30 public XMLCollectionElement (XMLCollection myCollection) { 33 super(); 34 35 this.myCollection=myCollection; 36 try { 37 attrId.setValue(myCollection.generateID()); 38 } catch (Exception ex) {} } 40 41 public String getID() { 42 return attrId.value.toString(); 43 } 44 45 public XMLCollection getCollection () { 46 return myCollection; 47 } 48 49 protected void fillStructure () { 50 attrId.setRequired(true); 51 52 complexStructure.add(attrId); 53 attributes.add(attrId); 54 } 55 56 public void fromXML(Node node) { 57 super.fromXML(node); 58 myCollection.updateID(getID()); 59 } 60 61 public boolean isIDUniqueAndValid (XMLPanel p) { 62 return true; 63 } 64 65 public Object clone () { 68 XMLCollectionElement d=(XMLCollectionElement)super.clone(); 69 d.attrId=(XMLAttribute)this.attrId.clone(); 70 d.myCollection=this.myCollection; 71 return d; 72 } 73 74 } 75 76 77 | Popular Tags |