Package net.sf.jasperreports.engine.design

Examples of net.sf.jasperreports.engine.design.JRDesignBand


      // appear before the table footers
      addSummaryGroup(fillColumns, builtinEvaluators);
     
      // use an empty last page footer so that the regular page footer doesn't
      // show on the last page
      this.lastPageFooter = new JRDesignBand();
      this.lastPageFooter.setHeight(0);
    }
    else
    {
      // use the regular page footer
View Full Code Here


    }
  }
 
  protected JRBand createDetailBand(List<FillColumn> fillColumns)
  {
    final JRDesignBand detailBand = new JRDesignBand();
    detailBand.setSplitType(SplitTypeEnum.PREVENT);
   
    ReportBandInfo bandInfo = new ReportBandInfo(detailBand);
    int xOffset = 0;
    for (FillColumn subcolumn : fillColumns)
    {
View Full Code Here

    }
  }

  protected JRDesignBand createColumnHeader(List<FillColumn> fillColumns)
  {
    JRDesignBand columnHeader = new JRDesignBand();
    columnHeader.setSplitType(SplitTypeEnum.PREVENT);
   
    ReportBandInfo bandInfo = new ReportBandInfo(columnHeader);
    int xOffset = 0;
    for (FillColumn subcolumn : fillColumns)
    {
      ColumnHeaderCreator subVisitor = new ColumnHeaderCreator(
          bandInfo, subcolumn, xOffset, 0, 0);
      subVisitor.visit();
      xOffset = subVisitor.xOffset;
    }
   
    if (columnHeader.getHeight() == 0)
    {
      columnHeader = null;
    }
    return columnHeader;
  }
View Full Code Here

    }
  }

  protected JRDesignBand createPageFooter(List<FillColumn> fillColumns)
  {
    JRDesignBand pageFooter = new JRDesignBand();
    pageFooter.setSplitType(SplitTypeEnum.PREVENT);
   
    ReportBandInfo bandInfo = new ReportBandInfo(pageFooter);
    int xOffset = 0;
    for (FillColumn subcolumn : fillColumns)
    {
      PageFooterCreator subVisitor = new PageFooterCreator(
          bandInfo, subcolumn, xOffset, 0, 0);
      subVisitor.visit();
      xOffset = subVisitor.xOffset;
    }
   
    if (pageFooter.getHeight() == 0)
    {
      pageFooter = null;
    }
    return pageFooter;
  }
View Full Code Here

    }
  }

  protected JRDesignBand createTitle(List<FillColumn> fillColumns)
  {
    JRDesignBand title = new JRDesignBand();
    title.setSplitType(SplitTypeEnum.PREVENT);
   
    ReportBandInfo bandInfo = new ReportBandInfo(title);
    int xOffset = 0;
    for (FillColumn subcolumn : fillColumns)
    {
      TitleCreator subVisitor = new TitleCreator(
          bandInfo, subcolumn, xOffset, 0, 0);
      subVisitor.visit();
      xOffset = subVisitor.xOffset;
    }
   
    if (title.getHeight() == 0)
    {
      title = null;
    }
    return title;
  }
View Full Code Here

    }
  }

  protected JRDesignBand createSummary(List<FillColumn> fillColumns)
  {
    JRDesignBand summary = new JRDesignBand();
    summary.setSplitType(SplitTypeEnum.PREVENT);
   
    ReportBandInfo bandInfo = new ReportBandInfo(summary);
    int xOffset = 0;
    for (FillColumn subcolumn : fillColumns)
    {
      SummaryCreator subVisitor = new SummaryCreator(
          bandInfo, subcolumn, xOffset, 0, 0);
      subVisitor.visit();
      xOffset = subVisitor.xOffset;
    }
   
    if (summary.getHeight() == 0)
    {
      summary = null;
    }
    return summary;
  }
View Full Code Here

    }
  }

  protected JRBand createGroupHeader(String groupName, List<FillColumn> fillColumns)
  {
    JRDesignBand header = new JRDesignBand();
    header.setSplitType(SplitTypeEnum.PREVENT);
   
    ReportBandInfo bandInfo = new ReportBandInfo(header);
    int xOffset = 0;
    for (FillColumn subcolumn : fillColumns)
    {
      GroupHeaderCreator subVisitor = new GroupHeaderCreator(groupName,
          bandInfo, subcolumn, xOffset, 0, 0);
      subVisitor.visit();
      xOffset = subVisitor.xOffset;
    }
   
    if (header.getHeight() == 0)
    {
      header = null;
    }
    return header;
  }
View Full Code Here

    }
  }

  protected JRBand createGroupFooter(String groupName, List<FillColumn> fillColumns)
  {
    JRDesignBand footer = new JRDesignBand();
    footer.setSplitType(SplitTypeEnum.PREVENT);
   
    ReportBandInfo bandInfo = new ReportBandInfo(footer);
    int xOffset = 0;
    for (FillColumn subcolumn : fillColumns)
    {
      GroupFooterCreator subVisitor = new GroupFooterCreator(groupName,
          bandInfo, subcolumn, xOffset, 0, 0);
      subVisitor.visit();
      xOffset = subVisitor.xOffset;
    }
   
    if (footer.getHeight() == 0)
    {
      footer = null;
    }
    return footer;
  }
View Full Code Here

  protected void addSummaryGroup(List<FillColumn> fillColumns, Map<JRExpression, BuiltinExpressionEvaluator> builtinEvaluators)
  {
    JRDesignGroup summaryGroup = new JRDesignGroup();
    summaryGroup.setName(SUMMARY_GROUP_NAME);//TODO check for uniqueness
   
    JRDesignBand groupFooter = new JRDesignBand();
    groupFooter.setSplitType(SplitTypeEnum.PREVENT);
    groupFooter.setHeight(pageFooter.getHeight());
   
    // we need to put everything in a frame so that we can tell the frame
    // not to print when there are no detail bands on the current page
    //
    // we can't do that directly to the band since its print when expression
    // is evaluated too soon
    JRDesignFrame footerFrame = new JRDesignFrame();
    footerFrame.setX(0);
    footerFrame.setY(0);
    footerFrame.setWidth(computeTableWidth(fillColumns));
    footerFrame.setHeight(pageFooter.getHeight());
    footerFrame.getLineBox().setPadding(0);
    footerFrame.getLineBox().getPen().setLineWidth(0f);
    footerFrame.setRemoveLineWhenBlank(true);
   
    // we only need an empty expression object here
    // the evaluation logic is separate
    JRDesignExpression footerPrintWhen = new JRDesignExpression();
    builtinEvaluators.put(footerPrintWhen, new SummaryGroupFooterPrintWhenEvaluator());
    footerFrame.setPrintWhenExpression(footerPrintWhen);
   
    // clone the contents of the page footer in the frame
    List footerElements = pageFooter.getChildren();
    for (Iterator iterator = footerElements.iterator(); iterator
        .hasNext();)
    {
      JRChild child = (JRChild) iterator.next();
      JRChild childClone = (JRChild) child.clone(footerFrame);
      if (childClone instanceof JRElement)
      {
        footerFrame.addElement((JRElement) childClone);
      }
      else if (childClone instanceof JRElementGroup)
      {
        footerFrame.addElementGroup((JRElementGroup) childClone);
      }
      else
      {
        throw new JRRuntimeException("Uknown child type "
            + childClone.getClass().getName());
      }
    }
   
    groupFooter.addElement(footerFrame);
    ((JRDesignSection) summaryGroup.getGroupFooterSection()).addBand(groupFooter);
   
    mainDataset.addScriptlet(TABLE_SCRIPTLET_NAME, TableReportScriptlet.class);
    mainDataset.addFirstGroup(summaryGroup);
  }
View Full Code Here

  /**
   *
   */
  public Object createObject(Attributes atts)
  {
    JRDesignBand band = new JRDesignBand();
   
    String height = atts.getValue(JRXmlConstants.ATTRIBUTE_height);
    if (height != null && height.length() > 0)
    {
      band.setHeight(Integer.parseInt(height));
    }

    String isSplitAllowed = atts.getValue(JRXmlConstants.ATTRIBUTE_isSplitAllowed);
    if (isSplitAllowed != null && isSplitAllowed.length() > 0)
    {
      if (log.isWarnEnabled())
      {
        log.warn("The 'isSplitAllowed' attribute is deprecated. Use the 'splitType' attribute instead.");
      }
       
      if (Boolean.valueOf(isSplitAllowed).booleanValue())
      {
        band.setSplitType(SplitTypeEnum.STRETCH);
      }
      else
      {
        band.setSplitType(SplitTypeEnum.PREVENT);
      }
    }

    SplitTypeEnum splitType = SplitTypeEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_splitType));
    if (splitType != null)
    {
      band.setSplitType(splitType);
    }

    return band;
  }
View Full Code Here

TOP

Related Classes of net.sf.jasperreports.engine.design.JRDesignBand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.