Package net.sf.jasperreports.engine.design

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


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


      xmlLoader.addGroupEvaluatedImage(image);

      String groupName = atts.getValue(JRXmlConstants.ATTRIBUTE_evaluationGroup);
      if (groupName != null)
      {
        JRDesignGroup group = new JRDesignGroup();
        group.setName(groupName);
        image.setEvaluationGroup(group);
      }
    }

    image.setLinkType(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkType));
View Full Code Here

      groupBoundDatasets.add(dataset);

      String groupName = atts.getValue(JRXmlConstants.ATTRIBUTE_resetGroup);
      if (groupName != null)
      {
        JRDesignGroup group = new JRDesignGroup();
        group.setName(groupName);
        dataset.setResetGroup(group);
      }
    }

    IncrementTypeEnum incrementType = IncrementTypeEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_incrementType));
    if (incrementType != null)
    {
      dataset.setIncrementType(incrementType);
    }
    if (dataset.getIncrementTypeValue() == IncrementTypeEnum.GROUP)
    {
      groupBoundDatasets.add(dataset);

      String groupName = atts.getValue(JRXmlConstants.ATTRIBUTE_incrementGroup);
      if (groupName != null)
      {
        JRDesignGroup group = new JRDesignGroup();
        group.setName(groupName);
        dataset.setIncrementGroup(group);
      }
    }
  }
View Full Code Here

      xmlLoader.addGroupEvaluatedTextField(textField);
     
      String groupName = atts.getValue(JRXmlConstants.ATTRIBUTE_evaluationGroup);
      if (groupName != null)
      {
        JRDesignGroup group = new JRDesignGroup();
        group.setName(groupName);
        textField.setEvaluationGroup(group);
      }
    }
   
    textField.setPattern(atts.getValue(JRXmlConstants.ATTRIBUTE_pattern));
View Full Code Here

    }

    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);
View Full Code Here

  /**
   *
   */
  public Object createObject(Attributes atts)
  {
    JRDesignGroup group = new JRDesignGroup();
   
    group.setName(atts.getValue(JRXmlConstants.ATTRIBUTE_name));
   
    String isStartNewColumn = atts.getValue(JRXmlConstants.ATTRIBUTE_isStartNewColumn);
    if (isStartNewColumn != null && isStartNewColumn.length() > 0)
    {
      group.setStartNewColumn(Boolean.valueOf(isStartNewColumn).booleanValue());
    }

    String isStartNewPage = atts.getValue(JRXmlConstants.ATTRIBUTE_isStartNewPage);
    if (isStartNewPage != null && isStartNewPage.length() > 0)
    {
      group.setStartNewPage(Boolean.valueOf(isStartNewPage).booleanValue());
    }

    String isResetPageNumber = atts.getValue(JRXmlConstants.ATTRIBUTE_isResetPageNumber);
    if (isResetPageNumber != null && isResetPageNumber.length() > 0)
    {
      group.setResetPageNumber(Boolean.valueOf(isResetPageNumber).booleanValue());
    }

    String isReprintHeaderOnEachPage = atts.getValue(JRXmlConstants.ATTRIBUTE_isReprintHeaderOnEachPage);
    if (isReprintHeaderOnEachPage != null && isReprintHeaderOnEachPage.length() > 0)
    {
      group.setReprintHeaderOnEachPage(Boolean.valueOf(isReprintHeaderOnEachPage).booleanValue());
    }

    String minHeightToStartNewPage = atts.getValue(JRXmlConstants.ATTRIBUTE_minHeightToStartNewPage);
    if (minHeightToStartNewPage != null && minHeightToStartNewPage.length() > 0)
    {
      group.setMinHeightToStartNewPage(Integer.parseInt(minHeightToStartNewPage));
    }

    FooterPositionEnum footerPosition = FooterPositionEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_footerPosition));
    if (footerPosition != null)
    {
      group.setFooterPosition(footerPosition);
    }
   
    String keepTogether = atts.getValue(JRXmlConstants.ATTRIBUTE_keepTogether);
    if (keepTogether != null && keepTogether.length() > 0)
    {
      group.setKeepTogether(Boolean.valueOf(keepTogether).booleanValue());
    }

    return group;
  }
View Full Code Here

    }
   
    String groupName = atts.getValue(JRXmlConstants.ATTRIBUTE_resetGroup);
    if (groupName != null)
    {
      JRDesignGroup group = new JRDesignGroup();
      group.setName(groupName);
      variable.setResetGroup(group);
    }

    IncrementTypeEnum incrementType = IncrementTypeEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_incrementType));
    if (incrementType != null)
    {
      variable.setIncrementType(incrementType);
    }
   
    groupName = atts.getValue(JRXmlConstants.ATTRIBUTE_incrementGroup);
    if (groupName != null)
    {
      JRDesignGroup group = new JRDesignGroup();
      group.setName(groupName);
      variable.setIncrementGroup(group);
    }

    CalculationEnum calculation = CalculationEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_calculation));
    if (calculation != null)
View Full Code Here

      xmlLoader.addGroupEvaluatedChart(chart);

      String groupName = atts.getValue(JRXmlConstants.ATTRIBUTE_evaluationGroup);
      if (groupName != null)
      {
        JRDesignGroup group = new JRDesignGroup();
        group.setName(groupName);
        chart.setEvaluationGroup(group);
      }
    }

    chart.setLinkType(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkType));
View Full Code Here

    //Variables
    JRDesignVariable variable = new JRDesignVariable();
    variable.setName("CityNumber");
    variable.setValueClass(java.lang.Integer.class);
    variable.setResetType(ResetTypeEnum.GROUP);
    JRDesignGroup group = new JRDesignGroup();
    group.setName("CityGroup");
    variable.setResetGroup(group);
    variable.setCalculation(CalculationEnum.SYSTEM);
    JRDesignExpression expression = new JRDesignExpression();
    expression.setValueClass(java.lang.Integer.class);
    expression.setText("($V{CityNumber} != null)?(new Integer($V{CityNumber}.intValue() + 1)):(new Integer(1))");
    variable.setInitialValueExpression(expression);
    jasperDesign.addVariable(variable);

    variable = new JRDesignVariable();
    variable.setName("AllCities");
    variable.setValueClass(java.lang.String.class);
    variable.setResetType(ResetTypeEnum.REPORT);
    variable.setCalculation(CalculationEnum.SYSTEM);
    jasperDesign.addVariable(variable);

    //Groups
    group.setMinHeightToStartNewPage(60);
    expression = new JRDesignExpression();
    expression.setValueClass(java.lang.String.class);
    expression.setText("$F{City}");
    group.setExpression(expression);

    JRDesignBand band = new JRDesignBand();
    band.setHeight(20);
    JRDesignTextField textField = new JRDesignTextField();
    textField.setX(0);
    textField.setY(4);
    textField.setWidth(515);
    textField.setHeight(15);
    textField.setBackcolor(new Color(0xC0, 0xC0, 0xC0));
    textField.setMode(ModeEnum.OPAQUE);
    textField.setHorizontalAlignment(HorizontalAlignEnum.LEFT);
    textField.setStyle(boldStyle);
    expression = new JRDesignExpression();
    expression.setValueClass(java.lang.String.class);
    expression.setText("\"  \" + String.valueOf($V{CityNumber}) + \". \" + String.valueOf($F{City})");
    textField.setExpression(expression);
    band.addElement(textField);
    JRDesignLine line = new JRDesignLine();
    line.setX(0);
    line.setY(19);
    line.setWidth(515);
    line.setHeight(0);
    band.addElement(line);
    ((JRDesignSection)group.getGroupHeaderSection()).addBand(band);

    band = new JRDesignBand();
    band.setHeight(20);
    line = new JRDesignLine();
    line.setX(0);
    line.setY(-1);
    line.setWidth(515);
    line.setHeight(0);
    band.addElement(line);
    JRDesignStaticText staticText = new JRDesignStaticText();
    staticText.setX(400);
    staticText.setY(0);
    staticText.setWidth(60);
    staticText.setHeight(15);
    staticText.setHorizontalAlignment(HorizontalAlignEnum.RIGHT);
    staticText.setStyle(boldStyle);
    staticText.setText("Count : ");
    band.addElement(staticText);
    textField = new JRDesignTextField();
    textField.setX(460);
    textField.setY(0);
    textField.setWidth(30);
    textField.setHeight(15);
    textField.setHorizontalAlignment(HorizontalAlignEnum.RIGHT);
    textField.setStyle(boldStyle);
    expression = new JRDesignExpression();
    expression.setValueClass(java.lang.Integer.class);
    expression.setText("$V{CityGroup_COUNT}");
    textField.setExpression(expression);
    band.addElement(textField);
    ((JRDesignSection)group.getGroupFooterSection()).addBand(band);

    jasperDesign.addGroup(group);

    //Title
    band = new JRDesignBand();
View Full Code Here

    log.debug("Starting groups layout...");
    int i = 0;
    for (Iterator iter = getReport().getColumnsGroups().iterator(); iter.hasNext();) {
      DJGroup columnsGroup = (DJGroup) iter.next();
//      JRDesignGroup jgroup = (JRDesignGroup) getDesign().getGroupsList().get(i++);
      JRDesignGroup jgroup = getJRGroupFromDJGroup(columnsGroup);

      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());

      header.setSplitAllowed(columnsGroup.isAllowHeaderSplit());
      footer.setSplitAllowed(columnsGroup.isAllowFooterSplit());
View Full Code Here

TOP

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

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.