1 6 7 package com.sun.enterprise.tools.common.dd.webapp; 8 9 import org.w3c.dom.*; 10 import org.netbeans.modules.schema2beans.*; 11 import java.beans.*; 12 import java.util.*; 13 14 16 public class LocaleCharsetInfo extends com.sun.enterprise.tools.common.dd.SunBaseBean 17 { 18 19 static Vector comparators = new Vector(); 20 21 static public final String DEFAULTLOCALE = "DefaultLocale"; static public final String LOCALE_CHARSET_MAP = "LocaleCharsetMap"; static public final String PARAMETER_ENCODING = "ParameterEncoding"; static public final String PARAMETERENCODINGFORMHINTFIELD = "ParameterEncodingFormHintField"; static public final String PARAMETERENCODINGDEFAULTCHARSET = "ParameterEncodingDefaultCharset"; 27 public LocaleCharsetInfo() { 28 this(Common.USE_DEFAULT_VALUES); 29 } 30 31 public LocaleCharsetInfo(int options) 32 { 33 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 34 this.createProperty("locale-charset-map", LOCALE_CHARSET_MAP, 37 Common.TYPE_1_N | Common.TYPE_BEAN | Common.TYPE_KEY, 38 LocaleCharsetMap.class); 39 this.createAttribute(LOCALE_CHARSET_MAP, "locale", "Locale", 40 AttrProp.CDATA | AttrProp.REQUIRED, 41 null, null); 42 this.createAttribute(LOCALE_CHARSET_MAP, "agent", "Agent", 43 AttrProp.CDATA | AttrProp.IMPLIED, 44 null, null); 45 this.createAttribute(LOCALE_CHARSET_MAP, "charset", "Charset", 46 AttrProp.CDATA | AttrProp.REQUIRED, 47 null, null); 48 this.createProperty("parameter-encoding", PARAMETER_ENCODING, 50 Common.TYPE_0_1 | Common.TYPE_BOOLEAN | Common.TYPE_KEY, 51 Boolean .class); 52 this.createAttribute(PARAMETER_ENCODING, "form-hint-field", "FormHintField", 53 AttrProp.CDATA | AttrProp.IMPLIED, 54 null, null); 55 this.createAttribute(PARAMETER_ENCODING, "default-charset", "DefaultCharset", 56 AttrProp.CDATA | AttrProp.IMPLIED, 57 null, null); 58 this.initialize(options); 59 } 60 61 void initialize(int options) 63 { 64 65 } 66 67 public void setDefaultLocale(java.lang.String value) { 69 setAttributeValue(DEFAULTLOCALE, value); 70 } 71 72 public java.lang.String getDefaultLocale() { 74 return getAttributeValue(DEFAULTLOCALE); 75 } 76 77 public void setLocaleCharsetMap(int index, LocaleCharsetMap value) { 79 this.setValue(LOCALE_CHARSET_MAP, index, value); 80 } 81 82 public LocaleCharsetMap getLocaleCharsetMap(int index) { 84 return (LocaleCharsetMap)this.getValue(LOCALE_CHARSET_MAP, index); 85 } 86 87 public void setLocaleCharsetMap(LocaleCharsetMap[] value) { 89 this.setValue(LOCALE_CHARSET_MAP, value); 90 } 91 92 public LocaleCharsetMap[] getLocaleCharsetMap() { 94 return (LocaleCharsetMap[])this.getValues(LOCALE_CHARSET_MAP); 95 } 96 97 public int sizeLocaleCharsetMap() { 99 return this.size(LOCALE_CHARSET_MAP); 100 } 101 102 public int addLocaleCharsetMap(com.sun.enterprise.tools.common.dd.webapp.LocaleCharsetMap value) { 104 return this.addValue(LOCALE_CHARSET_MAP, value); 105 } 106 107 public int removeLocaleCharsetMap(com.sun.enterprise.tools.common.dd.webapp.LocaleCharsetMap value) { 112 return this.removeValue(LOCALE_CHARSET_MAP, value); 113 } 114 115 public void setParameterEncoding(boolean value) { 117 this.setValue(PARAMETER_ENCODING, (value ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE)); 118 } 119 120 public boolean isParameterEncoding() { 122 Boolean ret = (Boolean )this.getValue(PARAMETER_ENCODING); 123 if (ret == null) 124 ret = (Boolean )Common.defaultScalarValue(Common.TYPE_BOOLEAN); 125 return ((java.lang.Boolean )ret).booleanValue(); 126 } 127 128 public void setParameterEncodingFormHintField(java.lang.String value) { 130 if (size(PARAMETER_ENCODING) == 0) { 132 setValue(PARAMETER_ENCODING, ""); 133 } 134 setAttributeValue(PARAMETER_ENCODING, "FormHintField", value); 135 } 136 137 public java.lang.String getParameterEncodingFormHintField() { 139 if (size(PARAMETER_ENCODING) == 0) { 141 return null; 142 } else { 143 return getAttributeValue(PARAMETER_ENCODING, "FormHintField"); 144 } 145 } 146 147 public void setParameterEncodingDefaultCharset(java.lang.String value) { 149 if (size(PARAMETER_ENCODING) == 0) { 151 setValue(PARAMETER_ENCODING, ""); 152 } 153 setAttributeValue(PARAMETER_ENCODING, "DefaultCharset", value); 154 } 155 156 public java.lang.String getParameterEncodingDefaultCharset() { 158 if (size(PARAMETER_ENCODING) == 0) { 160 return null; 161 } else { 162 return getAttributeValue(PARAMETER_ENCODING, "DefaultCharset"); 163 } 164 } 165 166 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 168 comparators.add(c); 169 } 170 171 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 173 comparators.remove(c); 174 } 175 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 176 boolean restrictionFailure = false; 177 if (getDefaultLocale() != null) { 179 } 180 if (sizeLocaleCharsetMap() == 0) { 182 throw new org.netbeans.modules.schema2beans.ValidateException("sizeLocaleCharsetMap() == 0", "localeCharsetMap", this); } 184 for (int _index = 0; _index < sizeLocaleCharsetMap(); ++_index) { 185 com.sun.enterprise.tools.common.dd.webapp.LocaleCharsetMap element = getLocaleCharsetMap(_index); 186 if (element != null) { 187 element.validate(); 188 } 189 } 190 if (getParameterEncodingFormHintField() != null) { 193 } 194 if (getParameterEncodingDefaultCharset() != null) { 196 } 197 } 198 199 public void dump(StringBuffer str, String indent){ 201 String s; 202 Object o; 203 org.netbeans.modules.schema2beans.BaseBean n; 204 str.append(indent); 205 str.append("LocaleCharsetMap["+this.sizeLocaleCharsetMap()+"]"); for(int i=0; i<this.sizeLocaleCharsetMap(); i++) 207 { 208 str.append(indent+"\t"); 209 str.append("#"+i+":"); 210 n = (org.netbeans.modules.schema2beans.BaseBean) this.getLocaleCharsetMap(i); 211 if (n != null) 212 n.dump(str, indent + "\t"); else 214 str.append(indent+"\tnull"); this.dumpAttributes(LOCALE_CHARSET_MAP, i, str, indent); 216 } 217 218 str.append(indent); 219 str.append("ParameterEncoding"); str.append(indent+"\t"); str.append((this.isParameterEncoding()?"true":"false")); 222 this.dumpAttributes(PARAMETER_ENCODING, 0, str, indent); 223 224 } 225 public String dumpBeanNode(){ 226 StringBuffer str = new StringBuffer (); 227 str.append("LocaleCharsetInfo\n"); this.dump(str, "\n "); return str.toString(); 230 }} 231 232 234 235 257 | Popular Tags |