]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Make maximum-repeats a number property instead of a string. This add
authorFinn Bock <bckfnn@apache.org>
Tue, 7 Sep 2004 20:14:51 +0000 (20:14 +0000)
committerFinn Bock <bckfnn@apache.org>
Tue, 7 Sep 2004 20:14:51 +0000 (20:14 +0000)
support for expression.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197932 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/FOPropertyMapping.java
src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java

index 67f26fb7c084b110dca0dac1973fa655e63a07bd..8100877991d2a35b8a0608670c810e0edbcdf0e6 100644 (file)
@@ -2081,8 +2081,9 @@ public class FOPropertyMapping implements Constants {
         addPropertyMaker("master-reference", m);
 
         // maximum-repeats
-        m  = new StringProperty.Maker(PR_MAXIMUM_REPEATS);
+        m  = new NumberProperty.Maker(PR_MAXIMUM_REPEATS);
         m.setInherited(false);
+        m.addEnum("no-limit", makeEnumProperty(NO_LIMIT, "NO_LIMIT"));
         m.setDefault("no-limit");
         addPropertyMaker("maximum-repeats", m);
 
index 300d8d8d3016d4eefe19b7a122dfac2bfc83fe85..545d53b82d8610cb11f982555299302f9a5c4c4a 100644 (file)
@@ -29,6 +29,7 @@ import org.xml.sax.SAXParseException;
 // FOP
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.properties.Property;
 
 /**
  * A repeatable-page-master-alternatives formatting object.
@@ -94,20 +95,16 @@ public class RepeatablePageMasterAlternatives extends FObj
                                    + parent.getName(), locator);
         }
 
-        String mr = getProperty(PR_MAXIMUM_REPEATS).getString();
-        if (mr.equals("no-limit")) {
+        Property mr = getProperty(PR_MAXIMUM_REPEATS);
+
+        if (mr.getEnum() == NO_LIMIT) {
             this.maximumRepeats = INFINITE;
         } else {
-            try {
-                this.maximumRepeats = Integer.parseInt(mr);
-                if (this.maximumRepeats < 0) {
-                    getLogger().debug("negative maximum-repeats: "
-                                      + this.maximumRepeats);
-                    this.maximumRepeats = 0;
-                }
-            } catch (NumberFormatException nfe) {
-                throw new SAXParseException("Invalid number for "
-                                       + "'maximum-repeats' property", locator);
+            this.maximumRepeats = mr.getNumber().intValue();
+            if (this.maximumRepeats < 0) {
+                getLogger().debug("negative maximum-repeats: "
+                                  + this.maximumRepeats);
+                this.maximumRepeats = 0;
             }
         }
     }
index 32c8a14b055d24c535b1a5c6417d0f061519a477..4ad7ab0740c9bde8280902feda1feaa1ba69bbd0 100644 (file)
@@ -26,6 +26,7 @@ import org.xml.sax.SAXParseException;
 // FOP
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.properties.Property;
 
 /**
  * A repeatable-page-master-reference formatting object.
@@ -62,21 +63,16 @@ public class RepeatablePageMasterReference extends FObj
             pageSequenceMaster.addSubsequenceSpecifier(this);
         }
 
-        String mr = getPropString(PR_MAXIMUM_REPEATS);
+        Property mr = getProperty(PR_MAXIMUM_REPEATS);
 
-        if (mr.equals("no-limit")) {
+        if (mr.getEnum() == NO_LIMIT) {
             this.maximumRepeats = INFINITE;
         } else {
-            try {
-                this.maximumRepeats = Integer.parseInt(mr);
-                if (this.maximumRepeats < 0) {
-                    getLogger().debug("negative maximum-repeats: "
-                                      + this.maximumRepeats);
-                    this.maximumRepeats = 0;
-                }
-            } catch (NumberFormatException nfe) {
-                throw new SAXParseException("Invalid number for "
-                                       + "'maximum-repeats' property", locator);
+            this.maximumRepeats = mr.getNumber().intValue();
+            if (this.maximumRepeats < 0) {
+                getLogger().debug("negative maximum-repeats: "
+                                  + this.maximumRepeats);
+                this.maximumRepeats = 0;
             }
         }
     }