Package net.sf.jasperreports.engine.design

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


    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


    log.debug("transforming group variable...");
    DJGroupVariable columnsGroupVariable = (DJGroupVariable) entity;
    AbstractColumn col = columnsGroupVariable.getColumnToApplyOperation();
    DJCalculation op = columnsGroupVariable.getOperation();

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

    JRDesignVariable variable = new JRDesignVariable();
    variable.setExpression(expression);
    variable.setCalculation(columnsGroupVariable.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

   * - Use a property of the current row.
   * @param sr
   * @return
   */
  public static JRDesignExpression getParameterExpression(Subreport sr) {
    JRDesignExpression exp = new JRDesignExpression();
    exp.setValueClassName(java.util.Map.class.getName());
    if (sr.isUseParentReportParameters()){
      exp.setText(REPORT_PARAMETERS_MAP);
      return exp;
    }

    if (sr.getParametersExpression() == null)
      return null;

    if (sr.getParametersMapOrigin() == DJConstants.SUBREPORT_PARAMETER_MAP_ORIGIN_PARAMETER){
      exp.setText(REPORT_PARAMETERS_MAP + ".get( \""+ sr.getParametersExpression() +"\" )");
      return exp;
    }

    if (sr.getParametersMapOrigin() == DJConstants.SUBREPORT_PARAMETER_MAP_ORIGIN_FIELD){
      exp.setText("$F{"+ sr.getParametersExpression() +"}");
      return exp;
    }

    return null;
  }
View Full Code Here

   * Returns the expression string required
   * @param ds
   * @return
   */
  public static JRDesignExpression getDataSourceExpression(DJDataSource ds) {
    JRDesignExpression exp = new JRDesignExpression();
    exp.setValueClass(JRDataSource.class);

    String dsType = getDataSourceTypeStr(ds.getDataSourceType());
    String expText = null;
    if (ds.getDataSourceOrigin() == DJConstants.DATA_SOURCE_ORIGIN_FIELD){
      expText = dsType + "$F{" + ds.getDataSourceExpression() + "})";
    } else if (ds.getDataSourceOrigin() == DJConstants.DATA_SOURCE_ORIGIN_PARAMETER){
      expText = dsType + REPORT_PARAMETERS_MAP + ".get( \""+ ds.getDataSourceExpression() +"\" ) )";
    } else if (ds.getDataSourceOrigin() == DJConstants.DATA_SOURCE_TYPE_SQL_CONNECTION) {
      expText = dsType + REPORT_PARAMETERS_MAP + ".get( \""+ ds.getDataSourceExpression() +"\" ) )";
    }

    exp.setText(expText);

    return exp;
  }
View Full Code Here

    exp.setText(expText);

    return exp;
  }
  public static JRDesignExpression getConnectionExpression(DJDataSource ds) {
    JRDesignExpression exp = new JRDesignExpression();
    exp.setValueClass(Connection.class);

    String dsType = getDataSourceTypeStr(ds.getDataSourceType());
    String expText = dsType + REPORT_PARAMETERS_MAP + ".get( \""+ ds.getDataSourceExpression() +"\" ) )";

    exp.setText(expText);

    return exp;
  }
View Full Code Here

  /**
   * Returns a JRDesignExpression that points to the main report connection
   * @return
   */
  public static JRDesignExpression getReportConnectionExpression() {
    JRDesignExpression connectionExpression = new JRDesignExpression();
    connectionExpression.setText("$P{"+JRDesignParameter.REPORT_CONNECTION+"}");
    connectionExpression.setValueClass(Connection.class);
    return connectionExpression;
  }
View Full Code Here

    }
    return dsType;
  }

  public static JRDesignExpression createStringExpression(String text) {
    JRDesignExpression exp = new JRDesignExpression();
    exp.setValueClass(String.class);
    exp.setText(text);
    return exp;
  }
View Full Code Here

    exp.setValueClass(String.class);
    exp.setText(text);
    return exp;
  }
  public static JRDesignExpression createExpression(String text, Class clazz) {
    JRDesignExpression exp = new JRDesignExpression();
    exp.setValueClass(clazz);
    exp.setText(text);
    return exp;
  }
View Full Code Here

    exp.setValueClass(clazz);
    exp.setText(text);
    return exp;
  }
  public static JRDesignExpression createExpression(String text, String className) {
    JRDesignExpression exp = new JRDesignExpression();
    exp.setValueClassName(className);
    exp.setText(text);
    return exp;
  }
View Full Code Here

    exp.setText(text);
    return exp;
  }

  public static JRDesignExpression createExpression(SubreportParameter sp) {
    JRDesignExpression exp = new JRDesignExpression();
    exp.setValueClassName(sp.getClassName());
    String text = null;
    if (sp.getParameterOrigin()== DJConstants.SUBREPORT_PARAM_ORIGIN_FIELD){
      text = "$F{" + sp.getExpression() + "}";
    } else if (sp.getParameterOrigin()== DJConstants.SUBREPORT_PARAM_ORIGIN_PARAMETER){
      text = REPORT_PARAMETERS_MAP + ".get( \""+ sp.getExpression() +"\")";
    } else if (sp.getParameterOrigin()== DJConstants.SUBREPORT_PARAM_ORIGIN_VARIABLE){
      text = "$V{" + sp.getExpression() + "}";
    } else { //CUSTOM
      text = sp.getExpression();
    }
    exp.setText(text);
    return exp;
  }
View Full Code Here

TOP

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

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.