Examples of JRDesignGroup


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

   * @param chart Chart that needs a variable to be generated
   * @return the generated variables
   */
  protected List registerChartVariable(DJChart chart) {
    //FIXME aca hay que iterar por cada columna. Cambiar DJChart para que tome muchas
    JRDesignGroup group = getJRGroupFromDJGroup(chart.getColumnsGroup());
    List vars = new ArrayList();

    int serieNum = 0;
    for (Iterator iterator = chart.getColumns().iterator(); iterator.hasNext();) {
      AbstractColumn col = (AbstractColumn) iterator.next();


      Class clazz = null;
      try { clazz = Class.forName(col.getValueClassNameForExpression());
      } catch (ClassNotFoundException e) {
        throw new DJException("Exeption creating chart variable: " + e.getMessage(),e);
      }

      JRDesignExpression expression = new JRDesignExpression();
      //FIXME Only PropertyColumn allowed?
      expression.setText("$F{" + ((PropertyColumn) col).getColumnProperty().getProperty()  + "}");
      expression.setValueClass(clazz);

      JRDesignVariable var = new JRDesignVariable();
      var.setValueClass(clazz);
      var.setExpression(expression);
      var.setCalculation(chart.getOperation());
      var.setResetGroup(group);
      var.setResetType(JRBaseVariable.RESET_TYPE_GROUP);

      //use the index as part of the name just because I may want 2
      //different types of chart from the very same column (with the same operation also) making the variables name to be duplicated
      int chartIndex = getReport().getCharts().indexOf(chart);
      var.setName("CHART_[" + chartIndex +"_s" +serieNum + "+]_" + group.getName() + "_" + col.getTitle() + "_" + chart.getOperation());

      try {
        getDesign().addVariable(var);
        vars.add(var);
      } catch (JRException e) {
View Full Code Here

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

   * @param group Group for which the parent is needed
   * @return The parent group of the given one. If the given one is the first one, it returns the same group
   */
  protected JRDesignGroup getParent(JRDesignGroup group){
    int index = realGroups.indexOf(group);
    JRDesignGroup parentGroup = (index > 0) ? (JRDesignGroup) realGroups.get(index-1): group;
    return parentGroup;
  }
View Full Code Here

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

    JRDesignExpression expression = new JRDesignExpression();

    //only variables from the last registered group are important now
    List groupsList = getDjd().getGroupsList();
    JRDesignGroup registeredGroup = (JRDesignGroup)groupsList.get(groupsList.size()-1);

    expression.setText(col.getTextForExpression());
    expression.setValueClassName(col.getValueClassNameForExpression());
    String variableName = col.getGroupVariableName(type, columnToGroupByProperty);
View Full Code Here

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

  protected void registerEntity(Entity entity) {
    log.debug("registering group...");
    ColumnsGroup columnsGroup = (ColumnsGroup) entity;
    try {
      JRDesignGroup group = (JRDesignGroup)transformEntity(columnsGroup);
      getDjd().addGroup(group);
      //Variables are registered right after the group where they belong.
      new ColumnsGroupVariablesRegistrationManager(ColumnsGroupVariablesRegistrationManager.HEADER, columnsGroup.getColumnToGroupBy().getColumnProperty().getProperty(), getDjd(),getDynamicReport()).registerEntities(columnsGroup.getHeaderVariables());
      new ColumnsGroupVariablesRegistrationManager(ColumnsGroupVariablesRegistrationManager.FOOTER, columnsGroup.getColumnToGroupBy().getColumnProperty().getProperty(), getDjd(),getDynamicReport()).registerEntities(columnsGroup.getFooterVariables());
    } catch (JRException e) {
View Full Code Here

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

  //PropertyColumn only can be used for grouping (not OperationColumn)
  protected Object transformEntity(Entity entity) {
    log.debug("transforming group...");
    ColumnsGroup columnsGroup = (ColumnsGroup) entity;
    PropertyColumn column = columnsGroup.getColumnToGroupBy();
    JRDesignGroup group = new JRDesignGroup();

    int groupIndex = getDynamicReport().getColumnsGroups().indexOf(columnsGroup);
    int columnIndex = getDynamicReport().getColumns().indexOf(columnsGroup.getColumnToGroupBy());
    if (column instanceof GlobalGroupColumn){
      group.setName("global_column_" + groupIndex);
    } else {
      group.setName( "group["+groupIndex+"]_for_column_" + columnIndex + "-" +  column.getTitle());
    }

    group.setCountVariable(new JRDesignVariable());
    group.setGroupFooter(new JRDesignBand());
    group.setGroupHeader(new JRDesignBand());

    JRDesignExpression jrExpression = new JRDesignExpression();
    jrExpression.setText(column.getTextForExpression());
    jrExpression.setValueClassName(column.getValueClassNameForExpression());

    group.setExpression(jrExpression);
    group.setCountVariable(new JRDesignVariable());

    return group;
  }
View Full Code Here

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

  private void layoutGroups() {
    log.debug("Starting groups layout...");
    int i = 0;
    for (Iterator iter = getReport().getColumnsGroups().iterator(); iter.hasNext();) {
      ColumnsGroup columnsGroup = (ColumnsGroup) iter.next();
      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();) {
View Full Code Here

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

    applyStyleToElement(columnStyle, textField);

        if (group != null) {
          int index = getReport().getColumnsGroups().indexOf(group);
            JRDesignGroup previousGroup = (JRDesignGroup) getDesign().getGroupsList().get(index);
            textField.setPrintWhenGroupChanges(previousGroup);
        }
        return textField;
  }
View Full Code Here

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

   * Calculates and returns the band where the band is to be inserted
   * @param djChart
   * @return
   */
  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:
      band = (JRDesignBand) ((parentGroup.equals(jgroup)) ? getDesign().getSummary(): parentGroup.getGroupFooter());
    }
    return band;
  }
View Full Code Here

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

    return band;
  }

  private JRDesignChart createChart(DJChart djChart){

      JRDesignGroup jrGroup = getGroupFromColumnsGroup(djChart.getColumnsGroup());

      JRDesignChart chart = new JRDesignChart(new JRDesignStyle().getDefaultStyleProvider(), djChart.getType());
      chart.setDataset(DataSetFactory.getDataset(djChart.getType(), jrGroup, getParent(jrGroup), registerChartVariable(djChart)));
      interpeterOptions(djChart, chart);
     
View Full Code Here

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

   * @param chart Chart that needs a variable to be generated
   * @return the generated variable
   */
  private JRDesignVariable registerChartVariable(DJChart chart) {

    JRDesignGroup group = getGroupFromColumnsGroup(chart.getColumnsGroup());

    Class clazz = null;
    try { clazz = Class.forName(chart.getColumn().getValueClassNameForExpression());
    } catch (ClassNotFoundException e) { /*Should never happen*/ }

    JRDesignExpression expression = new JRDesignExpression();
//    expression.setText("$F{" + chart.getColumn().getTitle().toLowerCase() + "}");
    expression.setText("$F{" + ((PropertyColumn) chart.getColumn()).getColumnProperty().getProperty()  + "}");
    expression.setValueClass(clazz);

    JRDesignVariable var = new JRDesignVariable();
    var.setValueClass(clazz);
    var.setExpression(expression);
    var.setCalculation(chart.getOperation());
    var.setResetGroup(group);
    var.setResetType(JRBaseVariable.RESET_TYPE_GROUP);
    int chartIndex = getReport().getCharts().indexOf(chart); //use the index as part of the name just because I may want 2
    //different types of chart from the very same column (with the same operation also) making the variables name to be duplicated
    var.setName("CHART_[" + chartIndex + "+]_" + group.getName() + "_" + chart.getColumn().getTitle() + "_" + chart.getOperation());
//    JRDesignExpression initExp = new JRDesignExpression();
//    initExp.setText("new Float(0)");
//    initExp.setValueClass(clazz);
//    var.setInitialValueExpression(initExp);

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.