summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Bernard West <pbwest@apache.org>2004-05-30 06:20:44 +0000
committerPeter Bernard West <pbwest@apache.org>2004-05-30 06:20:44 +0000
commit7e94b283b4b60d85c6fc7b108d886327e7e94280 (patch)
treeaf1793da292d166ea96b44378ebae77d76bbf7b8
parent25708263195ef032f1a3130abf4535385e961875 (diff)
downloadxmlgraphics-fop-7e94b283b4b60d85c6fc7b108d886327e7e94280.tar.gz
xmlgraphics-fop-7e94b283b4b60d85c6fc7b108d886327e7e94280.zip
Added getInitialValue() and constructor with initial value
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197664 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/fo/properties/Country.java24
-rw-r--r--src/java/org/apache/fop/fo/properties/Language.java24
2 files changed, 46 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/fo/properties/Country.java b/src/java/org/apache/fop/fo/properties/Country.java
index c69f1831a..b1f6ab726 100644
--- a/src/java/org/apache/fop/fo/properties/Country.java
+++ b/src/java/org/apache/fop/fo/properties/Country.java
@@ -20,6 +20,13 @@
*/
package org.apache.fop.fo.properties;
+import java.util.Locale;
+
+import org.apache.fop.datatypes.CountryType;
+import org.apache.fop.datatypes.PropertyValue;
+import org.apache.fop.fo.PropNames;
+import org.apache.fop.fo.expr.PropertyException;
+
public class Country extends Property {
public static final int dataTypes = COUNTRY_T | NONE | INHERIT;
@@ -34,7 +41,7 @@ public class Country extends Property {
return traitMapping;
}
- public static final int initialValueType = NONE_IT;
+ public static final int initialValueType = COUNTRY_IT;
public int getInitialValueType() {
return initialValueType;
@@ -46,5 +53,20 @@ public class Country extends Property {
return inherited;
}
+ private CountryType initialValue;
+
+ public PropertyValue getInitialValue(int propindex)
+ throws PropertyException {
+ if (propindex != PropNames.COUNTRY) {
+ throw new PropertyException(
+ "Called in Country with property other than 'country'");
+ }
+ return initialValue;
+ }
+
+ public Country() throws PropertyException {
+ initialValue = new CountryType(
+ PropNames.COUNTRY, Locale.getDefault().getCountry());
+ }
}
diff --git a/src/java/org/apache/fop/fo/properties/Language.java b/src/java/org/apache/fop/fo/properties/Language.java
index 63d3659ad..a996c5fbb 100644
--- a/src/java/org/apache/fop/fo/properties/Language.java
+++ b/src/java/org/apache/fop/fo/properties/Language.java
@@ -20,6 +20,13 @@
*/
package org.apache.fop.fo.properties;
+import java.util.Locale;
+
+import org.apache.fop.datatypes.LanguageType;
+import org.apache.fop.datatypes.PropertyValue;
+import org.apache.fop.fo.PropNames;
+import org.apache.fop.fo.expr.PropertyException;
+
public class Language extends Property {
public static final int dataTypes = LANGUAGE_T | NONE | INHERIT;
@@ -34,7 +41,7 @@ public class Language extends Property {
return traitMapping;
}
- public static final int initialValueType = NONE_IT;
+ public static final int initialValueType = LANGUAGE_IT;
public int getInitialValueType() {
return initialValueType;
@@ -45,6 +52,21 @@ public class Language extends Property {
public int getInherited() {
return inherited;
}
+ private LanguageType initialValue;
+
+ public PropertyValue getInitialValue(int propindex)
+ throws PropertyException {
+ if (propindex != PropNames.COUNTRY) {
+ throw new PropertyException(
+ "Called in Language with property other than 'language'");
+ }
+ return initialValue;
+ }
+
+ public Language() throws PropertyException {
+ initialValue = new LanguageType(
+ PropNames.COUNTRY, Locale.getDefault().getLanguage());
+ }
}