1 19 24 25 package org.netbeans.modules.j2ee.sun.sunresources.beans; 26 27 import org.w3c.dom.*; 28 import org.netbeans.modules.schema2beans.*; 29 import java.beans.*; 30 import java.util.*; 31 32 34 public class OptionValuePair extends org.netbeans.modules.schema2beans.BaseBean 35 { 36 37 static Vector comparators = new Vector(); 38 39 static public final String OPTION_NAME = "OptionName"; static public final String CONDITIONAL_VALUE = "ConditionalValue"; 42 public OptionValuePair() { 43 this(Common.USE_DEFAULT_VALUES); 44 } 45 46 public OptionValuePair(int options) 47 { 48 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 49 this.createProperty("option-name", OPTION_NAME, 52 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 53 String .class); 54 this.createProperty("conditional-value", CONDITIONAL_VALUE, 56 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 57 String .class); 58 this.initialize(options); 59 } 60 61 void initialize(int options) 63 { 64 65 } 66 67 public void setOptionName(String value) { 69 this.setValue(OPTION_NAME, value); 70 } 71 72 public String getOptionName() { 74 return (String )this.getValue(OPTION_NAME); 75 } 76 77 public void setConditionalValue(String value) { 79 this.setValue(CONDITIONAL_VALUE, value); 80 } 81 82 public String getConditionalValue() { 84 return (String )this.getValue(CONDITIONAL_VALUE); 85 } 86 87 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 89 comparators.add(c); 90 } 91 92 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 94 comparators.remove(c); 95 } 96 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 97 if (getOptionName() == null) { 99 throw new org.netbeans.modules.schema2beans.ValidateException("getOptionName() == null", "optionName", this); } 101 if (getConditionalValue() == null) { 103 throw new org.netbeans.modules.schema2beans.ValidateException("getConditionalValue() == null", "conditionalValue", this); } 105 } 106 107 public void dump(StringBuffer str, String indent){ 109 String s; 110 str.append(indent); 111 str.append("OptionName"); str.append(indent+"\t"); str.append("<"); s = this.getOptionName(); 115 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(OPTION_NAME, 0, str, indent); 118 119 str.append(indent); 120 str.append("ConditionalValue"); str.append(indent+"\t"); str.append("<"); s = this.getConditionalValue(); 124 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(CONDITIONAL_VALUE, 0, str, indent); 127 128 } 129 public String dumpBeanNode(){ 130 StringBuffer str = new StringBuffer (); 131 str.append("OptionValuePair\n"); this.dump(str, "\n "); return str.toString(); 134 }} 135 136 138 139 159 | Popular Tags |