Package net.sf.jasperreports.engine.design

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


            headerBand.addElement(colHeaderField);

            // Add fields to the detailBand
            if (this.converters.isEmpty()) {
                // if no converters are used, create a field depending on the type
                JRDesignElement designElement;
                if (RenderedImage.class.isAssignableFrom(valueClass)) {
                    designElement = createImageElement(templateDesign, columnName);
                    addElement(detailBand, designElement, detailPosX, detailPosY,
                            columnWidth, detailHeight, columnDetailStyle);
                } else {
                    JRDesignTextField textField = createTextField(columnName);
                    addElement(detailBand, textField, detailPosX, detailPosY,
                            columnWidth, detailHeight, columnDetailStyle);
                }
            } else {
                // image element
                JRDesignElement imageElement = createImageElement(templateDesign, columnName);
                // condition: use this element for images
                JRDesignExpression printWhenExpression = new JRDesignExpression();
                printWhenExpression.setText("new Boolean($F{" + columnName + "}.getClass().equals(java.awt.image.BufferedImage.class))");
                imageElement.setPrintWhenExpression(printWhenExpression);

                addElement(detailBand, imageElement, detailPosX, detailPosY,
                        columnWidth, detailHeight, columnDetailStyle);

                // text field element
View Full Code Here


  private void moveBandsElemnts(int yOffset, JRDesignBand band) {
    if (band == null)
      return;

    for (Iterator iterator = band.getChildren().iterator(); iterator.hasNext();) {
      JRDesignElement elem = (JRDesignElement) iterator.next();
      elem.setY(elem.getY()+yOffset);
    }
  }
View Full Code Here

    }

    if (band != null){
      //move everything down
      for (Iterator iter =band.getChildren().iterator(); iter.hasNext();) {
        JRDesignElement element = (JRDesignElement) iter.next();
        element.setY(element.getY() + maxHeight);
      }

      for (Iterator iter = imageBanners.iterator(); iter.hasNext();) {
        ImageBanner imageBanner = (ImageBanner) iter.next();
        String path = "\"" + imageBanner.getImagePath().replaceAll("\\\\", "/") + "\"";
View Full Code Here

   * @param sourceBand
   */
  private void copyBandElements(JRDesignBand destBand, JRBand sourceBand) {
    int offset = findVerticalOffset(destBand);
    for (Iterator iterator = sourceBand.getChildren().iterator(); iterator.hasNext();) {
      JRDesignElement element = (JRDesignElement) iterator.next();
      JRDesignElement dest = null;
      try {
        dest = (JRDesignElement) element.getClass().newInstance();
        BeanUtils.copyProperties(dest, element);
        dest.setY(dest.getY() + offset);
      } catch (Exception e) {
        e.printStackTrace();
      }
      destBand.addElement((JRDesignElement) dest);
    }
View Full Code Here

   */
  protected int findVerticalOffset(JRDesignBand band) {
    int finalHeight = 0;
    if (band != null) {
      for (Iterator iter = band.getChildren().iterator(); iter.hasNext();) {
        JRDesignElement element = (JRDesignElement) iter.next();
        int currentHeight = element.getY() + element.getHeight();
        if (currentHeight > finalHeight) finalHeight = currentHeight;
      }
      return finalHeight;
    }
    return finalHeight;
View Full Code Here

    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

   */
  public static int findVerticalOffset(JRDesignBand band) {
    int finalHeight = 0;
    if (band != null) {
      for (Iterator iter = band.getChildren().iterator(); iter.hasNext();) {
        JRDesignElement element = (JRDesignElement) iter.next();
        int currentHeight = element.getY() + element.getHeight();
        if (currentHeight > finalHeight) finalHeight = currentHeight;
      }
      return finalHeight;
    }
    return finalHeight;
View Full Code Here

   * @param sourceBand
   */
  public static void copyBandElements(JRDesignBand destBand, JRBand sourceBand) {
    int offset = findVerticalOffset(destBand);
    for (Iterator iterator = sourceBand.getChildren().iterator(); iterator.hasNext();) {
      JRDesignElement element = (JRDesignElement) iterator.next();
      JRDesignElement dest = null;
      try {
        dest = (JRDesignElement) element.getClass().newInstance();
        BeanUtils.copyProperties(dest, element);
        dest.setY(dest.getY() + offset);
      } catch (Exception e) {
        e.printStackTrace();
      }
      destBand.addElement((JRDesignElement) dest);
    }
View Full Code Here

  public static void moveBandsElemnts(int yOffset, JRDesignBand band) {
    if (band == null)
      return;

    for (Iterator iterator = band.getChildren().iterator(); iterator.hasNext();) {
      JRDesignElement elem = (JRDesignElement) iterator.next();
      elem.setY(elem.getY()+yOffset);
    }
  } 
View Full Code Here

    }

    if (band != null){
      //move everything down
      for (Iterator iter =band.getChildren().iterator(); iter.hasNext();) {
        JRDesignElement element = (JRDesignElement) iter.next();
        element.setY(element.getY() + maxHeight);
      }

      for (Iterator iter = imageBanners.iterator(); iter.hasNext();) {
        ImageBanner imageBanner = (ImageBanner) iter.next();
        String path = "\"" + imageBanner.getImagePath().replaceAll("\\\\", "/") + "\"";
View Full Code Here

TOP

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

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.