Package net.sf.jasperreports.engine.design

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


    log.debug("registering group variable...");
    DJGroupVariable columnsGroupVariable = (DJGroupVariable) entity;
    try {
      String name = columnsGroupVariable.getColumnToApplyOperation().getGroupVariableName(type, columnToGroupByProperty);
      if (columnsGroupVariable.getValueExpression() == null) {     
        JRDesignVariable jrVariable = (JRDesignVariable)transformEntity(entity);
        getDjd().addVariable(jrVariable);
     
        registerValueFormatter( columnsGroupVariable, jrVariable.getName() );
      }
      else
        registerCustomExpressionParameter(name + "_valueExpression", columnsGroupVariable.getValueExpression());
      if (columnsGroupVariable.getPrintWhenExpression() != null)
        registerCustomExpressionParameter(name + "_printWhenExpression", columnsGroupVariable.getPrintWhenExpression())
View Full Code Here


        expression.setValueClassName(col.getValueClassNameForExpression());
      }
    }
   

    JRDesignVariable variable = new JRDesignVariable();
    variable.setExpression(expression);
    variable.setCalculation(groupVariable.getOperation().getValue());
    variable.setName(variableName);   

    variable.setResetType(JRDesignVariable.RESET_TYPE_GROUP);
    variable.setResetGroup(registeredGroup);

    String valueClassName = col.getVariableClassName(op);
    String initialExpression = col.getInitialExpression(op);

    variable.setValueClassName(valueClassName);

    JRDesignExpression initialExp = new JRDesignExpression();
    initialExp.setText(initialExpression);
    initialExp.setValueClassName(valueClassName);
    variable.setInitialValueExpression(initialExp);

    return variable;
  }
View Full Code Here

      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

      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().getNewCharts().indexOf(chart);
      var.setName("CHART_[" + chartIndex +"_s" +serieNum + "+]_" + group.getName() + "_" + col.getTitle() + "_" + chart.getOperation());

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

    JRDesignCategoryDataset data = new JRDesignCategoryDataset(null);

//    for (Iterator iterator = vars.iterator(); iterator.hasNext();) {
      JRDesignCategorySeries serie = new JRDesignCategorySeries();
//      JRDesignVariable var = (JRDesignVariable) iterator.next();
      JRDesignVariable var = (JRDesignVariable) vars.get(0);
      JRDesignVariable var1 = (JRDesignVariable) vars.get(0);
      if (vars.size() > 1)
        var1 = (JRDesignVariable) vars.get(1);
     
      //And use it as value for each bar
      JRDesignExpression varExp = getExpressionFromVariable(var);
      JRExpression varExp1 = var1.getExpression();
      serie.setValueExpression(varExp);
 
      //The key for each bar
      JRExpression exp2 = group.getExpression();
 
View Full Code Here

  protected static JRDesignChartDataset createBarDataset(JRDesignGroup group, JRDesignGroup parentGroup, List vars, DJChart djchart) {
    JRDesignCategoryDataset data = new JRDesignCategoryDataset(null);

    for (Iterator iterator = vars.iterator(); iterator.hasNext();) {
      JRDesignCategorySeries serie = new JRDesignCategorySeries();
      JRDesignVariable var = (JRDesignVariable) iterator.next();
     
      //And use it as value for each bar
      JRDesignExpression varExp = getExpressionFromVariable(var);
      serie.setValueExpression(varExp);
 
View Full Code Here

  protected static JRDesignChartDataset createPieDataset(JRDesignGroup group, JRDesignGroup parentGroup, List vars, DJChart djchart) {   
    JRDesignPieDataset data = new JRDesignPieDataset(null);

    for (Iterator iterator = vars.iterator(); iterator.hasNext();) {
      JRDesignVariable var = (JRDesignVariable) iterator.next();
     
      //And transform it in the value for each pie slice
      JRDesignExpression expression = getExpressionFromVariable(var);
      data.setValueExpression(expression);
View Full Code Here

      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

      group.setName( "group["+groupIndex+"]_for_column_" + columnIndex + "-" +  column.getTitle());
    }
   
    getLayoutManager().getReferencesMap().put(group.getName(), djgroup);

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

    JRDesignExpression jrExpression = new JRDesignExpression();
   
    CustomExpression expressionToGroupBy = column.getExpressionToGroupBy();
    if (expressionToGroupBy != null) { //new in 3.0.7-b5
      String expToGroupByName = group.getName() + "_expression_to_group_by";
      registerCustomExpressionParameter(expToGroupByName, expressionToGroupBy);
      String expText = ExpressionUtils.createCustomExpressionInvocationText(expToGroupByName);
      jrExpression.setText(expText);
      log.debug("Expression for CustomExpression = " + expText);
      jrExpression.setValueClassName(expressionToGroupBy.getClassName());
    } else {
      jrExpression.setText(column.getTextForExpression());
      jrExpression.setValueClassName(column.getValueClassNameForExpression());
    }
   

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

    return group;
  }
View Full Code Here

  protected void registerEntity(Entity entity) {
    log.debug("registering group variable...");
    DJGroupVariable columnsGroupVariable = (DJGroupVariable) entity;
    try {
      JRDesignVariable jrVariable = (JRDesignVariable)transformEntity(entity);
      getDjd().addVariable(jrVariable);
     
      registerValueFormatter( columnsGroupVariable, jrVariable.getName() );
     
    } catch (JRException e) {
      throw new EntitiesRegistrationException(e.getMessage());
    }
  }
View Full Code Here

TOP

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

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.