]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Changes to use CountryLanguageScript for code validation.
authorPeter Bernard West <pbwest@apache.org>
Sat, 2 Nov 2002 00:32:08 +0000 (00:32 +0000)
committerPeter Bernard West <pbwest@apache.org>
Sat, 2 Nov 2002 00:32:08 +0000 (00:32 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@195399 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/datatypes/CountryType.java
src/org/apache/fop/datatypes/LanguageType.java
src/org/apache/fop/datatypes/ScriptType.java
src/org/apache/fop/datatypes/StringType.java

index 99b6bc5e48a2f558dfb87077cdaf6ac7fe214f70..1e77bde33b5ba826e56f2d13b6c87da1663225a7 100644 (file)
@@ -1,11 +1,9 @@
-
 package org.apache.fop.datatypes;
 
 import org.apache.fop.fo.expr.PropertyException;
 import org.apache.fop.fo.PropNames;
 import org.apache.fop.fo.PropertyConsts;
 import org.apache.fop.fo.properties.*;
-import org.apache.fop.configuration.Configuration;
 import org.apache.fop.datatypes.PropertyValue;
 
 /*
@@ -30,9 +28,12 @@ public class CountryType extends NCName {
     {
         super(property, countryCode, PropertyValue.COUNTRY);
         // Validate the code
-        if (Configuration.getHashMapEntry("countriesMap", countryCode)
-            == null) throw new PropertyException
+        String code;
+        if ((code = CountryLanguageScript.canonicalCountryCode(countryCode))
+                == null)
+            throw new PropertyException
                              ("Invalid country code: " + countryCode);
+        setString(code);
     }
 
     public CountryType(String propertyName, String countryCode)
index 38aaf838c09db5e36c88d7da27a0969e911bcc65..90860423c7523d6d5bd60e99cde988b96d5a68b8 100644 (file)
@@ -5,7 +5,6 @@ import org.apache.fop.fo.expr.PropertyException;
 import org.apache.fop.fo.PropNames;
 import org.apache.fop.fo.PropertyConsts;
 import org.apache.fop.fo.properties.*;
-import org.apache.fop.configuration.Configuration;
 import org.apache.fop.datatypes.PropertyValue;
 
 /*
@@ -33,9 +32,12 @@ public class LanguageType extends NCName {
     {
         super(property, languageCode, PropertyValue.LANGUAGE);
         // Validate the code
-        if (Configuration.getHashMapEntry("languagesMap", languageCode)
-            == null) throw new PropertyException
+        String code;
+        if ((code = CountryLanguageScript.canonicalLangCode(languageCode))
+                == null)
+            throw new PropertyException
                              ("Invalid language code: " + languageCode);
+        setString(code);
     }
 
     public LanguageType(String propertyName, String languageCode)
index 56c9a0341353bc98a231098ed8246541faf6379d..22f279c3f2bcac2adf673a6c20e6db517ff92e0c 100644 (file)
@@ -1,11 +1,9 @@
-
 package org.apache.fop.datatypes;
 
 import org.apache.fop.fo.expr.PropertyException;
 import org.apache.fop.fo.PropNames;
 import org.apache.fop.fo.PropertyConsts;
 import org.apache.fop.fo.properties.*;
-import org.apache.fop.configuration.Configuration;
 import org.apache.fop.datatypes.PropertyValue;
 
 /*
@@ -32,9 +30,12 @@ public class ScriptType extends NCName {
     {
         super(property, scriptCode, PropertyValue.SCRIPT);
         // Validate the code
-        if (Configuration.getHashMapEntry("scriptsMap", scriptCode)
-            == null) throw new PropertyException
+        String code;
+        if ((code = CountryLanguageScript.canonicalScriptCode(scriptCode))
+                == null)
+            throw new PropertyException
                              ("Invalid script code: " + scriptCode);
+        setString(code);
     }
 
     public ScriptType(String propertyName, String scriptCode)
index 0b48fa5cc34f3c8f182075a92fa1b40834d342ec..9280684931e4f63a860148f435acd8d174c1a3b3 100644 (file)
@@ -59,6 +59,15 @@ public class StringType extends AbstractPropertyValue {
     }
 
     /**
+     * Set the string value.
+     * @param string - the <tt>String</tt> value.
+     */
+    protected void setString(String string) {
+        this.string = string;
+    }
+
+    /**
+     * Get the string value.
      * @return the String.
      */
     public String getString() {