Package net.sf.jasperreports.engine.design

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


   */
  public Object createObject(Attributes atts)
  {
    JRXmlLoader xmlLoader = (JRXmlLoader)digester.peek(digester.getCount() - 1);

    JRDesignElement element = (JRDesignElement)digester.peek();

    element.setKey(atts.getValue(JRXmlConstants.ATTRIBUTE_key));

    PositionTypeEnum positionType = PositionTypeEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_positionType));
    if (positionType != null)
    {
      element.setPositionType(positionType);
    }

    StretchTypeEnum stretchType = StretchTypeEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_stretchType));
    if (stretchType != null)
    {
      element.setStretchType(stretchType);
    }

    String isPrintRepeatedValues = atts.getValue(JRXmlConstants.ATTRIBUTE_isPrintRepeatedValues);
    if (isPrintRepeatedValues != null && isPrintRepeatedValues.length() > 0)
    {
      element.setPrintRepeatedValues(Boolean.valueOf(isPrintRepeatedValues).booleanValue());
    }
   
    ModeEnum mode = ModeEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_mode));
    if (mode != null)
    {
      element.setMode(mode);
    }
   
    String x = atts.getValue(JRXmlConstants.ATTRIBUTE_x);
    if (x != null && x.length() > 0)
    {
      element.setX(Integer.parseInt(x));
    }

    String y = atts.getValue(JRXmlConstants.ATTRIBUTE_y);
    if (y != null && y.length() > 0)
    {
      element.setY(Integer.parseInt(y));
    }

    String width = atts.getValue(JRXmlConstants.ATTRIBUTE_width);
    if (width != null && width.length() > 0)
    {
      element.setWidth(Integer.parseInt(width));
    }

    String height = atts.getValue(JRXmlConstants.ATTRIBUTE_height);
    if (height != null && height.length() > 0)
    {
      element.setHeight(Integer.parseInt(height));
    }

    String isRemoveLineWhenBlank = atts.getValue(JRXmlConstants.ATTRIBUTE_isRemoveLineWhenBlank);
    if (isRemoveLineWhenBlank != null && isRemoveLineWhenBlank.length() > 0)
    {
      element.setRemoveLineWhenBlank(Boolean.valueOf(isRemoveLineWhenBlank).booleanValue());
    }

    String isPrintInFirstWholeBand = atts.getValue(JRXmlConstants.ATTRIBUTE_isPrintInFirstWholeBand);
    if (isPrintInFirstWholeBand != null && isPrintInFirstWholeBand.length() > 0)
    {
      element.setPrintInFirstWholeBand(Boolean.valueOf(isPrintInFirstWholeBand).booleanValue());
    }

    String isPrintWhenDetailOverflows = atts.getValue(JRXmlConstants.ATTRIBUTE_isPrintWhenDetailOverflows);
    if (isPrintWhenDetailOverflows != null && isPrintWhenDetailOverflows.length() > 0)
    {
      element.setPrintWhenDetailOverflows(Boolean.valueOf(isPrintWhenDetailOverflows).booleanValue());
    }

    String groupName = atts.getValue(JRXmlConstants.ATTRIBUTE_printWhenGroupChanges);
    if (groupName != null)
    {
      JRDesignGroup group = new JRDesignGroup();
      group.setName(groupName);
      element.setPrintWhenGroupChanges(group);
      xmlLoader.addGroupReprintedElement(element);
    }

    String forecolor = atts.getValue(JRXmlConstants.ATTRIBUTE_forecolor);
    if (forecolor != null && forecolor.length() > 0)
    {
      element.setForecolor(JRColorUtil.getColor(forecolor, null));
    }

    String backcolor = atts.getValue(JRXmlConstants.ATTRIBUTE_backcolor);
    if (backcolor != null && backcolor.length() > 0)
    {
      element.setBackcolor(JRColorUtil.getColor(backcolor, null));
    }
   
    String styleName = atts.getValue(JRXmlConstants.ATTRIBUTE_style);
    if (styleName != null)
    {
      JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2);
      Map stylesMap = jasperDesign.getStylesMap();

      if (stylesMap.containsKey(styleName))
      {
        JRStyle style = (JRStyle) stylesMap.get(styleName);
        element.setStyle(style);
      }
      else
      {
        element.setStyleNameReference(styleName);
      }
    }

    return element;
  }
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

   */
  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

   * @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

  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

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.