Package net.sf.jasperreports.engine.design

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


  protected void applyFooterAutotexts() {
    if (getReport().getAutoTexts() == null)
      return;

    JRDesignBand footerband = (JRDesignBand) getDesign().getPageFooter();
    if (footerband == null ) {
      footerband = new JRDesignBand();
      getDesign().setPageFooter(footerband);
    }

    ArrayList positions = new ArrayList();
    positions.add(HorizontalBandAlignment.LEFT);
View Full Code Here


   */
  protected void applyBanners() {
    /**
     * First create image banners for the first page only
     */
    JRDesignBand title = (JRDesignBand) getDesign().getTitle();
    //if there is no title band, but there are banner images for the first page, we create a title band
    if (title == null && !getReport().getOptions().getFirstPageImageBanners().isEmpty()){
      title = new JRDesignBand();
      getDesign().setTitle(title);
    }
    applyImageBannersToBand(title,getReport().getOptions().getFirstPageImageBanners().values(),null);

    /**
     * Now create image banner for the rest of the pages
     */
    JRDesignBand pageHeader = (JRDesignBand) getDesign().getPageHeader();
    //if there is no title band, but there are banner images for the first page, we create a title band
    if (pageHeader == null && !getReport().getOptions().getImageBanners().isEmpty()){
      pageHeader = new JRDesignBand();
      getDesign().setPageHeader(pageHeader);
    }
    JRDesignExpression printWhenExpression = null;
    if (!getReport().getOptions().getFirstPageImageBanners().isEmpty()){
      printWhenExpression = new JRDesignExpression();
View Full Code Here

   * Adds title and subtitle to the TitleBand when it applies.
   * If title is not present then subtitle will be ignored
   */
  private void generateTitleBand() {
    log.debug("Generating title band...");
    JRDesignBand band = (JRDesignBand) getDesign().getPageHeader();
    int yOffset = 0;

    //If title is not present then subtitle will be ignored
    if (getReport().getTitle() == null)
      return;

    if (band != null && !getDesign().isTitleNewPage()){
      //Title and subtitle comes afer the page header
      yOffset = band.getHeight();

    } else {
      band = (JRDesignBand) getDesign().getTitle();
      if (band == null){
        band = new JRDesignBand();
        getDesign().setTitle(band);
      }
    }

    JRDesignExpression printWhenExpression = new JRDesignExpression();
    printWhenExpression.setValueClass(Boolean.class);
    printWhenExpression.setText(EXPRESSION_TRUE_WHEN_FIRST_PAGE);

    JRDesignTextField title = new JRDesignTextField();
    JRDesignExpression exp = new JRDesignExpression();
    exp.setText("\"" + getReport().getTitle() + "\"");
    exp.setValueClass(String.class);
    title.setExpression(exp);
    title.setWidth(getReport().getOptions().getPrintableWidth());
    title.setHeight(getReport().getOptions().getTitleHeight().intValue());
    title.setY(yOffset);
    title.setPrintWhenExpression(printWhenExpression);
    title.setRemoveLineWhenBlank(true);
    applyStyleToElement(getReport().getTitleStyle(), title);
    band.addElement(title);

    JRDesignTextField subtitle = new JRDesignTextField();
    if (getReport().getSubtitle() != null) {
      JRDesignExpression exp2 = new JRDesignExpression();
      exp2.setText("\"" + getReport().getSubtitle() + "\"");
      exp2.setValueClass(String.class);
      subtitle.setExpression(exp2);
      subtitle.setWidth(getReport().getOptions().getPrintableWidth());
      subtitle.setHeight(getReport().getOptions().getSubtitleHeight().intValue());
      subtitle.setY(title.getY() + title.getHeight());
      subtitle.setPrintWhenExpression(printWhenExpression);
      subtitle.setRemoveLineWhenBlank(true);
      applyStyleToElement(getReport().getSubtitleStyle(), subtitle);
      band.addElement(subtitle);
    }

  }
View Full Code Here

      JRDesignGroup jgroup = (JRDesignGroup) getDesign().getGroupsList().get(i++);

      jgroup.setStartNewPage(columnsGroup.getStartInNewPage().booleanValue());
      jgroup.setStartNewColumn(columnsGroup.getStartInNewColumn().booleanValue());

      JRDesignBand header = (JRDesignBand) jgroup.getGroupHeader();
      JRDesignBand footer = (JRDesignBand) jgroup.getGroupFooter();
      header.setHeight(columnsGroup.getHeaderHeight().intValue());
      footer.setHeight(columnsGroup.getFooterHeight().intValue());

      if (columnsGroup.getLayout().isPrintHeaders()) {
        for (Iterator iterator =  getVisibleColumns().iterator(); iterator.hasNext();) {
          AbstractColumn col = (AbstractColumn) iterator.next();
View Full Code Here

      DJCrosstab djcross = (DJCrosstab) iterator.next();

      Dj2JrCrosstabBuilder djcb = new Dj2JrCrosstabBuilder();

      JRDesignCrosstab crosst = djcb.createCrosstab(djcross,this);
      JRDesignBand band = (JRDesignBand) jgroup.getGroupHeader();
      if (djcross.getBottomSpace() != 0){
        JRDesignRectangle rect = createBlankRectableCrosstab(djcross.getBottomSpace(), 0);
        moveBandsElemnts(rect.getHeight(), band);
        band.addElement(rect);
      }
      moveBandsElemnts(crosst.getHeight(), band);
      band.addElement(crosst);
      if (djcross.getTopSpace() != 0){
        moveBandsElemnts(djcross.getTopSpace(), band);
        JRDesignRectangle rect = createBlankRectableCrosstab(djcross.getBottomSpace(), 0);
        band.addElement(rect);
      }

    }

    for (Iterator iterator = columnsGroup.getFooterCrosstabs().iterator(); iterator.hasNext();) {
      DJCrosstab djcross = (DJCrosstab) iterator.next();

      Dj2JrCrosstabBuilder djcb = new Dj2JrCrosstabBuilder();

      JRDesignCrosstab crosst = djcb.createCrosstab(djcross,this);
      JRDesignBand band = (JRDesignBand) jgroup.getGroupFooter();
      int yOffset = findVerticalOffset(band);
      if (djcross.getTopSpace() != 0){
//        moveBandsElemnts(djcross.getTopSpace(), band);
        JRDesignRectangle rect = createBlankRectableCrosstab(djcross.getBottomSpace(), yOffset);
        rect.setPositionType(JRDesignElement.POSITION_TYPE_FIX_RELATIVE_TO_TOP);
        band.addElement(rect);
        crosst.setY(rect.getY() + rect.getHeight());
      }

      band.addElement(crosst);


      if (djcross.getBottomSpace() != 0){
        JRDesignRectangle rect = createBlankRectableCrosstab(djcross.getBottomSpace(), crosst.getY() + crosst.getHeight());
        band.addElement(rect);
      }
    }


  }
View Full Code Here

   * @param columnsGroup
   * @param jgroup
   */
  private void layoutGroupSubreports(ColumnsGroup columnsGroup, JRDesignGroup jgroup) {
    log.debug("Starting subreport layout...");
    JRDesignBand footerBand = (JRDesignBand) jgroup.getGroupFooter();
    JRDesignBand headerBand = (JRDesignBand) jgroup.getGroupHeader();

    layOutSubReportInBand(columnsGroup, headerBand, DJConstants.HEADER);
    layOutSubReportInBand(columnsGroup, footerBand, DJConstants.FOOTER);

  }
View Full Code Here

   * @param JRDesignGroup jgroup
   * @throws LayoutException
   */
  private void layoutGroupVariables(ColumnsGroup group, JRDesignGroup jgroup) {
    log.debug("Starting groups variables layout...");
    JRDesignBand headerBand = (JRDesignBand) jgroup.getGroupHeader();
    JRDesignBand footerBand = (JRDesignBand) jgroup.getGroupFooter();

//    int headerOffset = changeHeaderBandHeightForVariables(headerBand, group);
    int headerOffset = 0;

    //Show the current value above the column name
View Full Code Here

    return result;
  }

  private void generateHeaderBand() {
    log.debug("generating header band...");
    JRDesignBand header = (JRDesignBand) getDesign().getColumnHeader();
    if (header == null) {
      header = new JRDesignBand();
      getDesign().setColumnHeader(header);
    }


    /**
 
View Full Code Here

        design.setLeftMargin(0);
        design.setRightMargin(0);
        design.setTopMargin(0);
        design.setBottomMargin(0);
       
        JRDesignBand band = new JRDesignBand();
        band.setHeight(mapSize.height);

        // add layer graphics to report
        addLayers(layerGraphics, band, mapSize, design);
       
        // note that the images are added to the "NoData" band, this ensures
View Full Code Here

        final JRElement sampleDetailEl = detailSection.getBands()[0].getElements()[0];
        int detailPosX = sampleDetailEl.getX();
        int detailPosY = sampleDetailEl.getY();
        clearFields(templateDesign);
        removeDetailBand(templateDesign);
        JRDesignBand headerBand = new JRDesignBand();
        headerBand.setHeight(headerHeight);
        templateDesign.setColumnHeader(headerBand);

        JRDesignBand detailBand = new JRDesignBand();
        detailBand.setHeight(detailHeight);
        detailSection.addBand(detailBand);

        final int columnWidth;
        final int numColumns = columns.size();
        if (columns.isEmpty()) {
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.