Пример #1
0
 /** layout page footer area */
 protected void layoutFooter() {
   IContent footerContent = pageContent.getPageFooter();
   if (footerContent != null) {
     DimensionType h = pageContent.getFooterHeight();
     if (h == null) {
       h = new DimensionType(0.5f, DimensionType.UNITS_IN);
     }
     footerContent.setHeight(h);
     footer.content = footerContent;
     boolean autoPageBreak = context.isAutoPageBreak();
     context.setAutoPageBreak(false);
     RegionLayoutEngine rle = new RegionLayoutEngine(footer, context);
     try {
       rle.layout(footerContent);
     } catch (BirtException e) {
       logger.log(Level.WARNING, e.getMessage(), e);
     }
     context.setAutoPageBreak(autoPageBreak);
   }
 }
Пример #2
0
  protected IReportItemExecutor prepareChildExecutor() throws Exception {
    // prepare the offset of the next content
    if (prepareFirstChild) {
      if (fragment == null && nextOffset == -1) {
        DocumentExtension docExt =
            (DocumentExtension) content.getExtension(IContent.DOCUMENT_EXTENSION);
        if (docExt != null) {
          nextOffset = docExt.getFirstChild();
        }
      }
      if (fragment != null) {
        if (sections == null) {
          sections = fragment.getSections();
          nextSection = -1;
          useNextSection = true;
        }
      }
      prepareFirstChild = false;
    }

    if (fragment != null) {
      if (useNextSection) {
        useNextSection = false;
        nextSection++;
        if (sections == null || nextSection >= sections.length) {
          // this is the last one
          return null;
        }

        Object leftEdge = sections[nextSection][0];
        if (leftEdge == Segment.LEFT_MOST_EDGE) {
          DocumentExtension docExt =
              (DocumentExtension) content.getExtension(IContent.DOCUMENT_EXTENSION);
          if (docExt != null) {
            nextOffset = docExt.getFirstChild();
          }
        } else {
          InstanceIndex leftIndex = (InstanceIndex) leftEdge;
          InstanceID leftId = leftIndex.getInstanceID();
          long leftOffset = leftIndex.getOffset();

          if (leftOffset == -1) {
            DocumentExtension docExt =
                (DocumentExtension) content.getExtension(IContent.DOCUMENT_EXTENSION);
            if (docExt != null) {
              leftOffset = docExt.getFirstChild();
            }
          }

          while (leftOffset != -1) {
            IContent leftContent = reader.loadContent(leftOffset);
            InstanceID contentId = leftContent.getInstanceID();
            if (compare(leftId, contentId) <= 0) {
              break;
            }
            reader.unloadContent(leftOffset);
            DocumentExtension docExt =
                (DocumentExtension) leftContent.getExtension(IContent.DOCUMENT_EXTENSION);
            assert docExt != null;
            leftOffset = docExt.getNext();
          }

          nextOffset = leftOffset;
          doSkipToExecutor(leftId, nextOffset);
          uniqueId = leftId.getUniqueID();
        }
      }
    }

    // nextOffset points to the offset of next child in the document
    // nextInstanceID points to the instance id of the next child

    ReportItemExecutor childExecutor = doCreateExecutor(nextOffset);
    if (childExecutor != null) {
      IContent childContent = childExecutor.execute();
      if (childContent != null) {
        // find fragment for the child.
        if (fragment != null) {
          InstanceID childId = childContent.getInstanceID();
          Fragment childFragment = fragment.getFragment(childId);
          if (childFragment != null) {
            childExecutor.setFragment(childFragment);
          }
          Object rightEdge = sections[nextSection][1];
          if (rightEdge != Segment.RIGHT_MOST_EDGE) {
            InstanceIndex rightIndex = (InstanceIndex) rightEdge;
            InstanceID rightId = rightIndex.getInstanceID();
            if (isSameInstance(rightId, childId)) {
              useNextSection = true;
            }
          }
        }

        DocumentExtension docExt =
            (DocumentExtension) childContent.getExtension(IContent.DOCUMENT_EXTENSION);
        if (docExt != null) {
          if (docExt.getIndex() == nextOffset) {
            nextOffset = docExt.getNext();
          }
        }
      }
    }
    return childExecutor;
  }