]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Added 'Type' to name to circumvent collisions in Properties
authorPeter Bernard West <pbwest@apache.org>
Tue, 9 Jul 2002 06:42:51 +0000 (06:42 +0000)
committerPeter Bernard West <pbwest@apache.org>
Tue, 9 Jul 2002 06:42:51 +0000 (06:42 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@194986 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/datatypes/CountryType.java [new file with mode: 0644]
src/org/apache/fop/datatypes/LanguageType.java [new file with mode: 0644]
src/org/apache/fop/datatypes/ScriptType.java [new file with mode: 0644]

diff --git a/src/org/apache/fop/datatypes/CountryType.java b/src/org/apache/fop/datatypes/CountryType.java
new file mode 100644 (file)
index 0000000..e3fb1de
--- /dev/null
@@ -0,0 +1,56 @@
+
+package org.apache.fop.datatypes;
+
+import org.apache.fop.fo.expr.PropertyException;
+import org.apache.fop.fo.PropertyConsts;
+import org.apache.fop.fo.Properties;
+import org.apache.fop.configuration.Configuration;
+
+/*
+ * $Id$
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources.
+ * @author <a href="mailto:pbwest@powerup.com.au">Peter B. West</a>
+ * @version $Revision$ $Name$
+ */
+/**
+ * A class for <tt>country</tt> specifiers. 
+ */
+
+public class CountryType extends NCName {
+
+    private static final String tag = "$Name$";
+    private static final String revision = "$Revision$";
+
+    public CountryType(int property, String countryCode)
+        throws PropertyException
+    {
+        super(property, countryCode);
+        // Validate the code
+        if (Configuration.getHashMapEntry("countriesMap", countryCode)
+            == null) throw new PropertyException
+                             ("Invalid country code: " + countryCode);
+    }
+
+    public CountryType(String propertyName, String countryCode)
+        throws PropertyException
+    {
+        this(PropertyConsts.getPropertyIndex(propertyName), countryCode);
+    }
+
+    /**
+     * @return the <tt>String</tt> country code.
+     */
+    public String getCountry() {
+        return string;
+    }
+
+    /**
+     * Validate the <i>CountryType</i> against the associated property.
+     */
+    public void validate() throws PropertyException {
+        super.validate(Properties.COUNTRY_T);
+    }
+
+}
diff --git a/src/org/apache/fop/datatypes/LanguageType.java b/src/org/apache/fop/datatypes/LanguageType.java
new file mode 100644 (file)
index 0000000..cd8153d
--- /dev/null
@@ -0,0 +1,59 @@
+
+package org.apache.fop.datatypes;
+
+import org.apache.fop.fo.expr.PropertyException;
+import org.apache.fop.fo.PropertyConsts;
+import org.apache.fop.fo.Properties;
+import org.apache.fop.configuration.Configuration;
+
+/*
+ * LanguageType.java
+ * $Id$
+ *
+ * Created: Mon Nov 26 22:46:05 2001
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources.
+ * @author <a href="mailto:pbwest@powerup.com.au">Peter B. West</a>
+ * @version $Revision$ $Name$
+ */
+/**
+ * A class for <tt>language</tt> specifiers.
+ */
+
+public class LanguageType extends NCName {
+
+    private static final String tag = "$Name$";
+    private static final String revision = "$Revision$";
+
+    public LanguageType(int property, String languageCode)
+        throws PropertyException
+    {
+        super(property, languageCode);
+        // Validate the code
+        if (Configuration.getHashMapEntry("languagesMap", languageCode)
+            == null) throw new PropertyException
+                             ("Invalid language code: " + languageCode);
+    }
+
+    public LanguageType(String propertyName, String languageCode)
+        throws PropertyException
+    {
+        this(PropertyConsts.getPropertyIndex(propertyName), languageCode);
+    }
+
+    /**
+     * Validate the <i>LanguageType</i> against the associated property.
+     */
+    public void validate() throws PropertyException {
+        super.validate(Properties.LANGUAGE_T);
+    }
+
+    /**
+     * @return the <tt>String</tt> language code.
+     */
+    public String getLanguage() {
+        return string;
+    }
+
+}
diff --git a/src/org/apache/fop/datatypes/ScriptType.java b/src/org/apache/fop/datatypes/ScriptType.java
new file mode 100644 (file)
index 0000000..db504c7
--- /dev/null
@@ -0,0 +1,58 @@
+
+package org.apache.fop.datatypes;
+
+import org.apache.fop.fo.expr.PropertyException;
+import org.apache.fop.fo.PropertyConsts;
+import org.apache.fop.fo.Properties;
+import org.apache.fop.configuration.Configuration;
+
+/*
+ * ScriptType.java
+ * $Id$
+ *
+ * Created: Mon Nov 26 22:46:05 2001
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources.
+ * @author <a href="mailto:pbwest@powerup.com.au">Peter B. West</a>
+ * @version $Revision$ $Name$
+ */
+/**
+ * A class for <tt>script</tt> specifiers.
+ */
+
+public class ScriptType extends NCName {
+
+    private static final String tag = "$Name$";
+    private static final String revision = "$Revision$";
+
+    public ScriptType(int property, String scriptCode) throws PropertyException
+    {
+        super(property, scriptCode);
+        // Validate the code
+        if (Configuration.getHashMapEntry("scriptsMap", scriptCode)
+            == null) throw new PropertyException
+                             ("Invalid script code: " + scriptCode);
+    }
+
+    public ScriptType(String propertyName, String scriptCode)
+        throws PropertyException
+    {
+        this(PropertyConsts.getPropertyIndex(propertyName), scriptCode);
+    }
+
+    /**
+     * @return the <tt>String</tt> script code.
+     */
+    public String getScript() {
+        return string;
+    }
+
+    /**
+     * Validate the <i>ScriptType</i> against the associated property.
+     */
+    public void validate() throws PropertyException {
+        super.validate(Properties.SCRIPT_T);
+    }
+
+}