1 7 8 package com.calipso.reportgenerator.reportdefinitions; 9 10 14 import java.io.IOException ; 15 import java.io.Reader ; 16 import java.io.Serializable ; 17 import java.io.Writer ; 18 import java.util.Enumeration ; 19 import java.util.Vector ; 20 import org.exolab.castor.xml.MarshalException; 21 import org.exolab.castor.xml.Marshaller; 22 import org.exolab.castor.xml.Unmarshaller; 23 import org.exolab.castor.xml.ValidationException; 24 import org.xml.sax.ContentHandler ; 25 26 31 public class Localization implements java.io.Serializable { 32 33 34 38 41 private java.lang.String _locale; 42 43 46 private java.util.Vector _literalsList; 47 48 49 53 public Localization() { 54 super(); 55 _literalsList = new Vector (); 56 } 58 59 63 68 public void addLiterals(com.calipso.reportgenerator.reportdefinitions.Literals vLiterals) 69 throws java.lang.IndexOutOfBoundsException 70 { 71 _literalsList.addElement(vLiterals); 72 } 74 80 public void addLiterals(int index, com.calipso.reportgenerator.reportdefinitions.Literals vLiterals) 81 throws java.lang.IndexOutOfBoundsException 82 { 83 _literalsList.insertElementAt(vLiterals, index); 84 } 86 89 public java.util.Enumeration enumerateLiterals() 90 { 91 return _literalsList.elements(); 92 } 94 99 public com.calipso.reportgenerator.reportdefinitions.Literals getLiterals(int index) 100 throws java.lang.IndexOutOfBoundsException 101 { 102 if ((index < 0) || (index > _literalsList.size())) { 104 throw new IndexOutOfBoundsException (); 105 } 106 107 return (com.calipso.reportgenerator.reportdefinitions.Literals) _literalsList.elementAt(index); 108 } 110 113 public com.calipso.reportgenerator.reportdefinitions.Literals[] getLiterals() 114 { 115 int size = _literalsList.size(); 116 com.calipso.reportgenerator.reportdefinitions.Literals[] mArray = new com.calipso.reportgenerator.reportdefinitions.Literals[size]; 117 for (int index = 0; index < size; index++) { 118 mArray[index] = (com.calipso.reportgenerator.reportdefinitions.Literals) _literalsList.elementAt(index); 119 } 120 return mArray; 121 } 123 126 public int getLiteralsCount() 127 { 128 return _literalsList.size(); 129 } 131 136 public java.lang.String getLocale() 137 { 138 return this._locale; 139 } 141 144 public boolean isValid() 145 { 146 try { 147 validate(); 148 } 149 catch (org.exolab.castor.xml.ValidationException vex) { 150 return false; 151 } 152 return true; 153 } 155 160 public void marshal(java.io.Writer out) 161 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException 162 { 163 164 Marshaller.marshal(this, out); 165 } 167 172 public void marshal(org.xml.sax.ContentHandler handler) 173 throws java.io.IOException , org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException 174 { 175 176 Marshaller.marshal(this, handler); 177 } 179 182 public void removeAllLiterals() 183 { 184 _literalsList.removeAllElements(); 185 } 187 192 public com.calipso.reportgenerator.reportdefinitions.Literals removeLiterals(int index) 193 { 194 java.lang.Object obj = _literalsList.elementAt(index); 195 _literalsList.removeElementAt(index); 196 return (com.calipso.reportgenerator.reportdefinitions.Literals) obj; 197 } 199 205 public void setLiterals(int index, com.calipso.reportgenerator.reportdefinitions.Literals vLiterals) 206 throws java.lang.IndexOutOfBoundsException 207 { 208 if ((index < 0) || (index > _literalsList.size())) { 210 throw new IndexOutOfBoundsException (); 211 } 212 _literalsList.setElementAt(vLiterals, index); 213 } 215 220 public void setLiterals(com.calipso.reportgenerator.reportdefinitions.Literals[] literalsArray) 221 { 222 _literalsList.removeAllElements(); 224 for (int i = 0; i < literalsArray.length; i++) { 225 _literalsList.addElement(literalsArray[i]); 226 } 227 } 229 234 public void setLocale(java.lang.String locale) 235 { 236 this._locale = locale; 237 } 239 244 public static com.calipso.reportgenerator.reportdefinitions.Localization unmarshal(java.io.Reader reader) 245 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException 246 { 247 return (com.calipso.reportgenerator.reportdefinitions.Localization) Unmarshaller.unmarshal(com.calipso.reportgenerator.reportdefinitions.Localization.class, reader); 248 } 250 253 public void validate() 254 throws org.exolab.castor.xml.ValidationException 255 { 256 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); 257 validator.validate(this); 258 } 260 } 261 | Popular Tags |