Examples of JRDesignBand


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

  /**
   * For each column, puts the elements in the detail band
   */
  protected void transformDetailBand() {
    log.debug("transforming Detail Band...");
    JRDesignBand detail = (JRDesignBand) design.getDetail();
    detail.setHeight(report.getOptions().getDetailHeight().intValue());

    for (Iterator iter = getVisibleColumns().iterator(); iter.hasNext();) {

      AbstractColumn column = (AbstractColumn)iter.next();

      /**
       * Barcode column
       */
      if (column instanceof BarCodeColumn) {
        BarCodeColumn barcodeColumn = (BarCodeColumn)column;
        JRDesignImage image = new JRDesignImage(new JRDesignStyle().getDefaultStyleProvider());
        JRDesignExpression imageExp = new JRDesignExpression();
//        imageExp.setText("ar.com.fdvs.dj.core.BarcodeHelper.getBarcodeImage("+barcodeColumn.getBarcodeType() + ", "+ column.getTextForExpression()+ ", "+ barcodeColumn.isShowText() + ", " + barcodeColumn.isCheckSum() + ", " + barcodeColumn.getApplicationIdentifier() + ","+ column.getWidth() +", "+ report.getOptions().getDetailHeight().intValue() + " )" );

        //Do not pass column height and width mecause barbecue
        //generates the image with wierd dimensions. Pass 0 in both cases
        String applicationIdentifier = barcodeColumn.getApplicationIdentifier();
        if (applicationIdentifier != null && !"".equals(applicationIdentifier.trim()) ){
          applicationIdentifier = "$F{" + applicationIdentifier + "}";
        } else {
          applicationIdentifier = "\"\"";
        }
        imageExp.setText("ar.com.fdvs.dj.core.BarcodeHelper.getBarcodeImage("+barcodeColumn.getBarcodeType() + ", "+ column.getTextForExpression()+ ", "+ barcodeColumn.isShowText() + ", " + barcodeColumn.isCheckSum() + ", " + applicationIdentifier + ",0,0 )" );


        imageExp.setValueClass(java.awt.Image.class);
        image.setExpression(imageExp);
        image.setHeight(getReport().getOptions().getDetailHeight().intValue());
        image.setWidth(column.getWidth().intValue());
        image.setX(column.getPosX().intValue());
        image.setScaleImage(barcodeColumn.getScaleMode().getValue());

        image.setOnErrorType(JRDesignImage.ON_ERROR_TYPE_ICON); //FIXME should we provide control of this to the user?

        applyStyleToElement(column.getStyle(), image);

        detail.addElement(image);
      }
      /**
       * Image columns
       */
      else if (column instanceof ImageColumn) {
        ImageColumn imageColumn = (ImageColumn)column;
        JRDesignImage image = new JRDesignImage(new JRDesignStyle().getDefaultStyleProvider());
        JRDesignExpression imageExp = new JRDesignExpression();
        imageExp.setText(column.getTextForExpression());

        imageExp.setValueClassName(imageColumn.getColumnProperty().getValueClassName());
        image.setExpression(imageExp);
        image.setHeight(getReport().getOptions().getDetailHeight().intValue());
        image.setWidth(column.getWidth().intValue());
        image.setX(column.getPosX().intValue());
        image.setScaleImage(imageColumn.getScaleMode().getValue());

        applyStyleToElement(column.getStyle(), image);

        detail.addElement(image);
      }
      /**
       * Regular Column
       */
      else {
        if (column.getConditionalStyles() != null && !column.getConditionalStyles().isEmpty() ){
          for (Iterator iterator = column.getConditionalStyles().iterator(); iterator.hasNext();) {
            ConditionalStyle condition = (ConditionalStyle) iterator.next();
            JRDesignTextField textField = generateTextFieldFromColumn(column, getReport().getOptions().getDetailHeight().intValue(), null);
            transformDetailBandTextField(column, textField);
            applyStyleToElement(condition.getStyle(), textField);
            textField.setPrintWhenExpression(getExpressionForConditionalStyle(condition, column));
            detail.addElement(textField);
          }
        } else {
          JRDesignTextField textField = generateTextFieldFromColumn(column, getReport().getOptions().getDetailHeight().intValue(), null);
          transformDetailBandTextField(column, textField);
          if (textField.getExpression() != null)
            detail.addElement(textField);
        }
      }

        }
  }
View Full Code Here

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

      for (int i = l.size(); i > 0; i--) {
        DJChart djChart = (DJChart) l.get(i-1);
        JRDesignChart chart = createChart(djChart);

        //Charts has their own band, so they are added in the band at Y=0
        JRDesignBand band = createGroupForChartAndGetBand(djChart);
        band.addElement(chart);
      }
    }
  }
View Full Code Here

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

    JRDesignGroup jrGroup = getJRGroupFromDJGroup(djChart.getColumnsGroup());
    JRDesignGroup parentGroup = getParent(jrGroup);
    JRDesignGroup jrGroupChart = null;
    try {
      jrGroupChart = (JRDesignGroup) BeanUtils.cloneBean(parentGroup);
      jrGroupChart.setGroupFooter( new JRDesignBand());
      jrGroupChart.setGroupHeader( new JRDesignBand());
      jrGroupChart.setName(jrGroupChart.getName()+"_Chart" + getReport().getCharts().indexOf(djChart));
    } catch (Exception e) {
      throw new DJException("Problem creating band for chart: " + e.getMessage(),e);
    }

    //Charts should be added in its own band (to ensure page break, etc)
    //To achieve that, we create a group and insert it right before to the criteria group.
    //I need to find parent group of the criteria group, clone and insert after.
    //The only precaution is that if parent == child (only one group in the report) the we insert before
    if (jrGroup.equals(parentGroup)){
      getDesign().getGroupsList().add( getDesign().getGroupsList().indexOf(jrGroup) , jrGroupChart);
    } else {
      int index = getDesign().getGroupsList().indexOf(parentGroup);
      getDesign().getGroupsList().add(index, jrGroupChart);
    }

    JRDesignBand band = null;
    switch (djChart.getOptions().getPosition()) {
    case DJChartOptions.POSITION_HEADER:
      band = (JRDesignBand) jrGroupChart.getGroupHeader();
      break;
    case DJChartOptions.POSITION_FOOTER:
View Full Code Here

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

    des.setWhenResourceMissingType(dr.getWhenResourceMissing());
   
    des.setTitleNewPage(false);
    des.setSummaryNewPage(false);

    des.setDetail(new JRDesignBand());
   
    des.getDetail().setSplitAllowed(dr.isAllowDetailSplit());
   
    des.setPageHeader(new JRDesignBand());
    des.setPageFooter(new JRDesignBand());
    des.setSummary(new JRDesignBand());

    des.setTitleNewPage(options.isTitleNewPage());

    des.setIgnorePagination(options.isIgnorePagination());
   
View Full Code Here

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

    log.debug("setting up WHEN NO DATA band");
    String whenNoDataText = getReport().getWhenNoDataText();
    Style style = getReport().getWhenNoDataStyle();
    if (whenNoDataText == null || "".equals(whenNoDataText))
      return;
    JRDesignBand band = new JRDesignBand();
    getDesign().setNoData(band);
   
    JRDesignTextField text = new JRDesignTextField();
    JRDesignExpression expression = ExpressionUtils.createStringExpression("\""+whenNoDataText+"\"");
    text.setExpression(expression);
   
    if (style == null){
      style = getReport().getOptions().getDefaultDetailStyle();
    }
   
    if (getReport().isWhenNoDataShowTitle())
      copyBandElements(band, getDesign().getPageHeader());
    if (getReport().isWhenNoDataShowColumnHeader())
      copyBandElements(band, getDesign().getColumnHeader());
   
    int offset = findVerticalOffset(band);
    text.setY(offset);
    applyStyleToElement(style, text);
    text.setWidth(getReport().getOptions().getPrintableWidth());
    text.setHeight(50);
    band.addElement(text);
    log.debug("OK setting up WHEN NO DATA band");
   
  }
View Full Code Here

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

  /**
   * For each column, puts the elements in the detail band
   */
  protected void transformDetailBand() {
    log.debug("transforming Detail Band...");
    JRDesignBand detail = (JRDesignBand) design.getDetail();
    detail.setHeight(report.getOptions().getDetailHeight().intValue());

    if (getReport().getOptions().isPrintBackgroundOnOddRows()){
      decorateOddRows(detail);
    }

    for (Iterator iter = getVisibleColumns().iterator(); iter.hasNext();) {

      AbstractColumn column = (AbstractColumn)iter.next();

      /**
       * Barcode column
       */
      if (column instanceof BarCodeColumn) {
        BarCodeColumn barcodeColumn = (BarCodeColumn)column;
        JRDesignImage image = new JRDesignImage(new JRDesignStyle().getDefaultStyleProvider());
        JRDesignExpression imageExp = new JRDesignExpression();
//        imageExp.setText("ar.com.fdvs.dj.core.BarcodeHelper.getBarcodeImage("+barcodeColumn.getBarcodeType() + ", "+ column.getTextForExpression()+ ", "+ barcodeColumn.isShowText() + ", " + barcodeColumn.isCheckSum() + ", " + barcodeColumn.getApplicationIdentifier() + ","+ column.getWidth() +", "+ report.getOptions().getDetailHeight().intValue() + " )" );

        //Do not pass column height and width mecause barbecue
        //generates the image with wierd dimensions. Pass 0 in both cases
        String applicationIdentifier = barcodeColumn.getApplicationIdentifier();
        if (applicationIdentifier != null && !"".equals(applicationIdentifier.trim()) ){
          applicationIdentifier = "$F{" + applicationIdentifier + "}";
        } else {
          applicationIdentifier = "\"\"";
        }
        imageExp.setText("ar.com.fdvs.dj.core.BarcodeHelper.getBarcodeImage("+barcodeColumn.getBarcodeType() + ", "+ column.getTextForExpression()+ ", "+ barcodeColumn.isShowText() + ", " + barcodeColumn.isCheckSum() + ", " + applicationIdentifier + ",0,0 )" );


        imageExp.setValueClass(java.awt.Image.class);
        image.setExpression(imageExp);
        image.setHeight(getReport().getOptions().getDetailHeight().intValue());
        image.setWidth(column.getWidth().intValue());
        image.setX(column.getPosX().intValue());
        image.setScaleImage(barcodeColumn.getScaleMode().getValue());

        image.setOnErrorType(JRDesignImage.ON_ERROR_TYPE_ICON); //FIXME should we provide control of this to the user?

        applyStyleToElement(column.getStyle(), image);

        detail.addElement(image);
      }
      /**
       * Image columns
       */
      else if (column instanceof ImageColumn) {
        ImageColumn imageColumn = (ImageColumn)column;
        JRDesignImage image = new JRDesignImage(new JRDesignStyle().getDefaultStyleProvider());
        JRDesignExpression imageExp = new JRDesignExpression();
        imageExp.setText(column.getTextForExpression());

        imageExp.setValueClassName(imageColumn.getColumnProperty().getValueClassName());
        image.setExpression(imageExp);
        image.setHeight(getReport().getOptions().getDetailHeight().intValue());
        image.setWidth(column.getWidth().intValue());
        image.setX(column.getPosX().intValue());
        image.setScaleImage(imageColumn.getScaleMode().getValue());

        applyStyleToElement(column.getStyle(), image);

        detail.addElement(image);
      }
      /**
       * Regular Column
       */
      else {
        if (column.getConditionalStyles() != null && !column.getConditionalStyles().isEmpty() ){
          for (Iterator iterator = column.getConditionalStyles().iterator(); iterator.hasNext();) {
            ConditionalStyle condition = (ConditionalStyle) iterator.next();
            JRDesignTextField textField = generateTextFieldFromColumn(column, getReport().getOptions().getDetailHeight().intValue(), null);
            transformDetailBandTextField(column, textField);
            applyStyleToElement(condition.getStyle(), textField);
            textField.setPrintWhenExpression(getExpressionForConditionalStyle(condition.getName(), column.getTextForExpression()));
            detail.addElement(textField);
          }
        } else {
          JRDesignTextField textField = generateTextFieldFromColumn(column, getReport().getOptions().getDetailHeight().intValue(), null);
          transformDetailBandTextField(column, textField);
          if (textField.getExpression() != null)
            detail.addElement(textField);
        }
      }

        }
  }
View Full Code Here

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

   */
  protected void layoutCharts() {
    for (Iterator iter = getReport().getCharts().iterator(); iter.hasNext();) {
      DJChart djChart = (DJChart) iter.next();
      JRDesignChart chart = createChart(djChart);
      JRDesignBand band = getPositionBand(djChart);
     
      //If it is a HEADER chart, then Y remains 0. If FOOTER chart, need yOffset
      int yOffset = 0;
      if (djChart.getOptions().getPosition() == DJChartOptions.POSITION_FOOTER)
        yOffset = findVerticalOffset(band);     
      chart.setY(yOffset); //The chart will be located at the very end of the band so far
     
      band.addElement(chart);
    }
  }
View Full Code Here

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

   */
  private JRDesignBand getPositionBand(DJChart djChart) {
    JRDesignGroup jgroup = getGroupFromColumnsGroup(djChart.getColumnsGroup());
    JRDesignGroup parentGroup = getParent(jgroup);

    JRDesignBand band = null;
    switch (djChart.getOptions().getPosition()) {
    case DJChartOptions.POSITION_HEADER:
      band = (JRDesignBand) ((parentGroup.equals(jgroup)) ? getDesign().getSummary(): parentGroup.getGroupHeader());
      break;
    case DJChartOptions.POSITION_FOOTER:
View Full Code Here

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

  //TODO: 5's must be replaced by a constant or a configurable number
  private void arrangeBand(DJChart djChart, JRDesignChart chart) {
    int index = getReport().getColumnsGroups().indexOf(djChart.getColumnsGroup());

    if (djChart.getOptions().getPosition() == DJChartOptions.POSITION_HEADER){
      JRDesignBand band = (JRDesignBand) getParent(((JRDesignGroup)getDesign().getGroupsList().get(index))).getGroupHeader();

      for (int i = 0; i < band.getElements().length; i++) {
        JRDesignElement element = (JRDesignElement) band.getElements()[i];
        element.setY(element.getY() + chart.getY() + chart.getHeight() + 5);
      }     
    }
    else {
      JRDesignBand band = (JRDesignBand) getParent(((JRDesignGroup)getDesign().getGroupsList().get(index))).getGroupFooter();
      int max = 0;
      for (int i = 0; i < band.getElements().length; i++) {
        JRDesignElement element = (JRDesignElement) band.getElements()[i];
        if ( (element.getHeight() + element.getY()) > max)
          max = element.getHeight() + element.getY();
      }
      chart.setY(max +5 );
    }
View Full Code Here

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

    if (getReport().getAutoTexts() == null)
      return;
    /**
     * Apply the autotext in footer if any
     */
    JRDesignBand headerband = (JRDesignBand) getDesign().getPageHeader();
    if (headerband == null ) {
      headerband = new JRDesignBand();
      getDesign().setPageHeader(headerband);
    }

    ArrayList positions = new ArrayList();
    positions.add(HorizontalBandAlignment.LEFT);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.