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 21 public class UnionType extends XMLCollection { 22 private Package myPackage=null; 23 24 public UnionType (Package p) { 25 super(null); 26 setRequired(true); 27 myPackage=p; 28 } 29 30 36 public XMLElement generateNewElement() { 37 Member m=new Member(myPackage); 38 m.setRequired(true); 39 return m; 40 } 41 42 53 public XMLPanel getPanel () { 54 controlledPanel=new XMLListPanel(this,"",false,true,false) { 55 public boolean checkRequired () { 56 if (isReadOnly || (refCollectionElements.size()>0)) { 57 return true; 58 } else { 59 XMLPanel.errorMessage(this.getDialog(),getOwner().toLabel(),"", 60 XMLUtil.getLanguageDependentString("ErrorTheListMustContainAtLeastOneElement")); 61 controlPanel.getComponent(1).requestFocus(); 62 return false; 63 } 64 } 65 }; 66 controlPanel=new XMLListControlPanel(this,"",true,false,true); 67 return new XMLGroupPanel(this,new XMLPanel[]{ 68 controlledPanel,controlPanel},toLabel(),XMLPanel.BOX_LAYOUT, 69 false,true); 70 } 71 72 } 73 | Popular Tags |