vmote       2003/08/27 11:35:21

  Modified:    src/java/org/apache/fop/fo/pagination StaticContent.java
               src/java/org/apache/fop/layoutmgr PageLayoutManager.java
  Log:
  make some classes more readable by reversing the sense of some conditional logic
  
  Revision  Changes    Path
  1.5       +1 -2      xml-fop/src/java/org/apache/fop/fo/pagination/StaticContent.java
  
  Index: StaticContent.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/StaticContent.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StaticContent.java        22 Aug 2003 17:42:41 -0000      1.4
  +++ StaticContent.java        27 Aug 2003 18:35:21 -0000      1.5
  @@ -55,7 +55,6 @@
   import org.apache.fop.fo.FOTreeVisitor;
   import org.apache.fop.apps.FOPException;
   import org.apache.fop.layoutmgr.StaticContentLayoutManager;
  -import org.apache.fop.apps.*;
   
   /**
    * Class modelling the fo:static-content object. See Sec. 6.4.19 of the XSL-FO
  
  
  
  1.15      +49 -49    xml-fop/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
  
  Index: PageLayoutManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- PageLayoutManager.java    27 Aug 2003 18:14:46 -0000      1.14
  +++ PageLayoutManager.java    27 Aug 2003 18:35:21 -0000      1.15
  @@ -467,61 +467,61 @@
       }
   
       private void layoutStaticContent(Region region, int regionClass) {
  -        if (region != null) {
  -            StaticContent flow = pageSequence
  -              .getStaticContent(region.getRegionName());
  -            if (flow != null) {
  -                RegionViewport reg = curPage.getPage()
  -                  .getRegion(regionClass);
  -                reg.getRegion().setIPD((int)reg.getViewArea().getWidth());
  -                if (reg == null) {
  -                    getLogger().error("no region viewport: shouldn't happen");
  -                }
  -                StaticContentLayoutManager lm = flow.getLayoutManager();
  -                lm.setUserAgent(getUserAgent());
  -                lm.init();
  -                lm.setRegionReference(reg.getRegion());
  -                lm.setParent(this);
  -                LayoutContext childLC = new LayoutContext(0);
  -                childLC.setStackLimit(new 
MinOptMax((int)curPage.getViewArea().getHeight()));
  -                childLC.setRefIPD((int)reg.getViewArea().getWidth());
  -
  -                while (!lm.isFinished()) {
  -                    BreakPoss bp = lm.getNextBreakPoss(childLC);
  -                    if (bp != null) {
  -                        List vecBreakPoss = new ArrayList();
  -                        vecBreakPoss.add(bp);
  -                        lm.addAreas(new BreakPossPosIter(vecBreakPoss, 0,
  -                                                          vecBreakPoss.size()), 
null);
  -                    } else {
  -                      getLogger().error("bp==null  cls=" + regionClass);
  -                    }
  -                }
  -                //lm.flush();
  -                lm.reset(null);
  +        if (region == null) {
  +            return;
  +        }
  +        StaticContent flow = pageSequence.getStaticContent(region.getRegionName());
  +        if (flow == null) {
  +            return;
  +        }
  +        RegionViewport reg = curPage.getPage().getRegion(regionClass);
  +        reg.getRegion().setIPD((int)reg.getViewArea().getWidth());
  +        if (reg == null) {
  +            getLogger().error("no region viewport: shouldn't happen");
  +        }
  +        StaticContentLayoutManager lm = flow.getLayoutManager();
  +        lm.setUserAgent(getUserAgent());
  +        lm.init();
  +        lm.setRegionReference(reg.getRegion());
  +        lm.setParent(this);
  +        LayoutContext childLC = new LayoutContext(0);
  +        childLC.setStackLimit(new 
MinOptMax((int)curPage.getViewArea().getHeight()));
  +        childLC.setRefIPD((int)reg.getViewArea().getWidth());
  +        while (!lm.isFinished()) {
  +            BreakPoss bp = lm.getNextBreakPoss(childLC);
  +            if (bp != null) {
  +                List vecBreakPoss = new ArrayList();
  +                vecBreakPoss.add(bp);
  +                lm.addAreas(new BreakPossPosIter(vecBreakPoss, 0,
  +                                                  vecBreakPoss.size()), null);
  +            } else {
  +              getLogger().error("bp==null  cls=" + regionClass);
               }
           }
  +        //lm.flush();
  +        lm.reset(null);
       }
   
       private void finishPage() {
  -        if (curPage != null) {
  -            // Layout static content into the regions
  -            // Need help from pageseq for this
  -            layoutStaticContent(currentSimplePageMaster.getRegion(Region.BEFORE),
  -                                Region.BEFORE_CODE);
  -            layoutStaticContent(currentSimplePageMaster.getRegion(Region.AFTER),
  -                                Region.AFTER_CODE);
  -            layoutStaticContent(currentSimplePageMaster.getRegion(Region.START),
  -                                Region.START_CODE);
  -            layoutStaticContent(currentSimplePageMaster.getRegion(Region.END),
  -                                Region.END_CODE);
  -            // Queue for ID resolution and rendering
  -            areaTree.addPage(curPage);
  -            curPage = null;
  -            curBody = null;
  -            curSpan = null;
  -            curFlow = null;
  +        if (curPage == null) {
  +            return;
           }
  +        // Layout static content into the regions
  +        // Need help from pageseq for this
  +        layoutStaticContent(currentSimplePageMaster.getRegion(Region.BEFORE),
  +                            Region.BEFORE_CODE);
  +        layoutStaticContent(currentSimplePageMaster.getRegion(Region.AFTER),
  +                            Region.AFTER_CODE);
  +        layoutStaticContent(currentSimplePageMaster.getRegion(Region.START),
  +                            Region.START_CODE);
  +        layoutStaticContent(currentSimplePageMaster.getRegion(Region.END),
  +                            Region.END_CODE);
  +        // Queue for ID resolution and rendering
  +        areaTree.addPage(curPage);
  +        curPage = null;
  +        curBody = null;
  +        curSpan = null;
  +        curFlow = null;
       }
   
       /**
  
  
  

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

Reply via email to