bckfnn      2004/09/07 13:14:51

  Modified:    src/java/org/apache/fop/fo FOPropertyMapping.java
               src/java/org/apache/fop/fo/pagination
                        RepeatablePageMasterAlternatives.java
                        RepeatablePageMasterReference.java
  Log:
  Make maximum-repeats a number property instead of a string. This add
  support for expression.
  
  Revision  Changes    Path
  1.22      +3 -2      xml-fop/src/java/org/apache/fop/fo/FOPropertyMapping.java
  
  Index: FOPropertyMapping.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOPropertyMapping.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- FOPropertyMapping.java    7 Sep 2004 14:33:47 -0000       1.21
  +++ FOPropertyMapping.java    7 Sep 2004 20:14:50 -0000       1.22
  @@ -2081,8 +2081,9 @@
           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);
   
  
  
  
  1.17      +9 -12     
xml-fop/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
  
  Index: RepeatablePageMasterAlternatives.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- RepeatablePageMasterAlternatives.java     8 Aug 2004 18:39:25 -0000       1.16
  +++ RepeatablePageMasterAlternatives.java     7 Sep 2004 20:14:51 -0000       1.17
  @@ -29,6 +29,7 @@
   // 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 @@
                                      + 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;
               }
           }
       }
  
  
  
  1.19      +8 -12     
xml-fop/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
  
  Index: RepeatablePageMasterReference.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- RepeatablePageMasterReference.java        5 Sep 2004 04:00:52 -0000       1.18
  +++ RepeatablePageMasterReference.java        7 Sep 2004 20:14:51 -0000       1.19
  @@ -26,6 +26,7 @@
   // 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 @@
               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;
               }
           }
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to