1 10 11 package org.enhydra.jawe.xml.elements; 12 13 import javax.swing.*; 14 15 import org.enhydra.jawe.xml.*; 16 import org.enhydra.jawe.xml.panels.*; 17 18 23 public class EnumerationValue extends XMLComplexElement { 24 private XMLAttribute attrName=new XMLAttribute("Name"); 26 29 public EnumerationValue () { 30 super(); 31 32 fillStructure(); 33 } 34 35 39 protected void fillStructure () { 40 attrName.setRequired(true); 41 complexStructure.add(attrName); 42 attributes.add(attrName); 43 } 44 45 51 public Object toValue () { 52 return attrName.toValue(); 53 } 54 55 63 public String toString () { 64 return attrName.toString(); 65 } 66 67 70 public boolean isValidEnter (XMLPanel p) { 71 XMLGroupPanel gp=(XMLGroupPanel)p; 72 try { 73 XMLTextPanel tp=(XMLTextPanel)gp.getPanel(0); 74 String nameToCheck=tp.getText(); 75 if (!XMLCollection.isIdValid(nameToCheck)) { 76 String message=XMLUtil.getLanguageDependentString("ErrorValueIsNotValid"); 77 String dialogTitle=XMLUtil.getLanguageDependentString("Title"); 78 XMLPanel.errorMessage(p.getDialog(),dialogTitle,attrName.toLabel()+": ",message); 79 ((JTextField)tp.getComponent(2)).requestFocus(); 80 return false; 81 } 82 } catch (Exception ex){} 83 84 return true; 85 } 86 87 } 88 | Popular Tags |