support for expression. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197932 13f79535-47bb-0310-9956-ffa450edef68tags/Root_Temp_KnuthStylePageBreaking
@@ -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); | |||
@@ -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; | |||
} | |||
} | |||
} |
@@ -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; | |||
} | |||
} | |||
} |