Examples of JRDesignExpression


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

      JRDesignSubreport subreport = new JRDesignSubreport(new JRDesignStyle().getDefaultStyleProvider());

      //The data source
      int dataSourceOrigin = sr.getDatasource().getDataSourceOrigin();
      if (DJConstants.DATA_SOURCE_ORIGIN_USE_REPORT_CONNECTION == dataSourceOrigin){
        JRDesignExpression connectionExpression = ExpressionUtils.getReportConnectionExpression();
        subreport.setConnectionExpression(connectionExpression);
      } else if (DJConstants.DATA_SOURCE_TYPE_SQL_CONNECTION == sr.getDatasource().getDataSourceType()) {
        JRDesignExpression connectionExpression = ExpressionUtils.getConnectionExpression(sr.getDatasource());
        subreport.setConnectionExpression(connectionExpression);
      } else {
        JRDesignExpression dataSourceExpression = ExpressionUtils.getDataSourceExpression(sr.getDatasource());
        subreport.setDataSourceExpression(dataSourceExpression);
      }

//      int random_ = subReportRandom.nextInt();
      //the subreport design
      String paramname = sr.getReport().toString(); //TODO ensure this name is unique among all possible subreports
      ((DynamicJasperDesign)getDesign()).getParametersWithValues().put(paramname, sr.getReport());
      String expText = "("+JasperReport.class.getName()+")$P{REPORT_PARAMETERS_MAP}.get( \""+ paramname +"\" )";
      JRDesignExpression srExpression = ExpressionUtils.createExpression(expText, JasperReport.class);
      subreport.setExpression(srExpression );


      //set the parameters
      subreport.setParametersMapExpression(ExpressionUtils.getParameterExpression(sr));
View Full Code Here

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

        DJGroupVariable var = (DJGroupVariable) it.next();
        AbstractColumn col = var.getColumnToApplyOperation();

        String variableName = col.getGroupVariableName(type, columnsGroup.getColumnToGroupBy().getColumnProperty().getProperty());

        JRDesignExpression expression = new JRDesignExpression();
        JRDesignTextField textField = new JRDesignTextField();
        expression.setText("$V{" + variableName + "}");
        expression.setValueClassName(col.getVariableClassName(var.getOperation()));
        if (var.getOperation() != DJCalculation.COUNT)
          textField.setPattern(col.getPattern());

        textField.setKey(variableName);
        textField.setExpression(expression);

        if (DJConstants.FOOTER.equals(type)){
          textField.setPositionType(JRDesignElement.POSITION_TYPE_FIX_RELATIVE_TO_TOP);
        }

        textField.setX(col.getPosX().intValue());
        if (yOffset!=0)
          textField.setY(yOffset);

//        textField.setHeight(columnsGroup.getHeaderHeight().intValue());
        textField.setHeight(2 + getReport().getOptions().getDetailHeight().intValue()); //XXX be carefull with the "2+ ..."
        textField.setWidth(col.getWidth().intValue());

        textField.setEvaluationTime(JRExpression.EVALUATION_TIME_GROUP);

        textField.setEvaluationGroup(jgroup);
        //Assign the style to the element.
        //First we look for the specific element style, then the default style for the group variables
        //and finally the column style.
        Style defStyle = DJConstants.HEADER.equals(type)?columnsGroup.getDefaulHeaderVariableStyle():columnsGroup.getDefaulFooterVariableStyle();

        if (var.getStyle() != null)
          applyStyleToElement(var.getStyle(), textField);
        else if (defStyle != null)
          applyStyleToElement(defStyle, textField);
        else {
          //Last resource is tu use the column style, but a copy of it because
          //the one in the internal cache can get modified by the layout manager (like in the odd row case)
          Style style = col.getStyle();
          try {
            style = (Style) BeanUtils.cloneBean(style);
            style.setName(null); //set to null to make applyStyleToElement(...) assign a name
          } catch (Exception e) {  }
          applyStyleToElement(style, textField);
        }


        band.addElement(textField);

      }

      if (columnsGroup.getColumnToGroupBy() instanceof GlobalGroupColumn) {
        int totalWidth = 0;

        DJGroupVariable leftmostColumn = findLeftMostColumn(variables);
        totalWidth = leftmostColumn.getColumnToApplyOperation().getPosX().intValue();

        GlobalGroupColumn globalCol = (GlobalGroupColumn) columnsGroup.getColumnToGroupBy();

        JRDesignTextField globalTextField = new JRDesignTextField();
        JRDesignExpression globalExp = new JRDesignExpression();
        globalExp.setText(globalCol.getTextForExpression());
        globalExp.setValueClassName(globalCol.getValueClassNameForExpression());
        globalTextField.setExpression(globalExp);

//        globalTextField.setHeight(band.getHeight()); //XXX Changed, see if its ok
        globalTextField.setHeight(2 + getReport().getOptions().getDetailHeight().intValue()); //XXX be carefull with the "2+ ..."
        globalTextField.setWidth(totalWidth);
View Full Code Here

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

    for (Iterator iterator = djcross.getRows().iterator(); iterator.hasNext();) {
      DJCrosstabRow row = (DJCrosstabRow) iterator.next();
      auxWidth += row.getHeaderWidth();
    }

    JRDesignExpression exp = ExpressionUtils.createStringExpression(text);
    element.setExpression(exp);

    element.setWidth(auxWidth);
    element.setHeight(auxHeight);
    element.setStretchWithOverflow(true);
View Full Code Here

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

  private void registerDataSet(DJCrosstab djcrosstab) {
    JRDesignCrosstabDataset dataset = new JRDesignCrosstabDataset();
    dataset.setDataPreSorted(false);
    JRDesignDatasetRun datasetRun = new JRDesignDatasetRun();
//    datasetRun.setDatasetName("sub1");
    JRDesignExpression exp = ExpressionUtils.getDataSourceExpression(djcrosstab.getDatasource());
    datasetRun.setDataSourceExpression(exp);



    dataset.setDatasetRun(datasetRun);
View Full Code Here

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

        JRDesignTextField element = new JRDesignTextField();
        element.setWidth(crosstabColumn.getWidth());
        element.setHeight(crosstabRow.getHeight());

        JRDesignExpression measureExp = new JRDesignExpression();
        DJCrosstabMeasure measure = djcross.getMeasure(0);
        measureExp.setValueClassName(measure.getProperty().getValueClassName());
        measureExp.setText("$V{"+measure.getProperty().getProperty()+"}");

        element.setExpression(measureExp);

        /**
         * Is there any style for this object?
View Full Code Here

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

      JRDesignCrosstabMeasure measure = new JRDesignCrosstabMeasure();
      measure.setName(djmeasure.getProperty().getProperty());
      measure.setCalculation(djmeasure.getOperation().getValue());
      measure.setValueClassName(djmeasure.getProperty().getValueClassName());
      JRDesignExpression valueExp = new JRDesignExpression();
      valueExp.setValueClassName(djmeasure.getProperty().getValueClassName());
      valueExp.setText("$F{"+djmeasure.getProperty().getProperty()+"}");
      measure.setValueExpression(valueExp);

      try {
        jrcross.addMeasure(measure);
      } catch (JRException e) {
View Full Code Here

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

      ctRowGroup.setName(crosstabRow.getProperty().getProperty());

      JRDesignCrosstabBucket rowBucket = new JRDesignCrosstabBucket();
      ctRowGroup.setBucket(rowBucket);

      JRDesignExpression bucketExp = ExpressionUtils.createExpression("$F{"+crosstabRow.getProperty().getProperty()+"}", crosstabRow.getProperty().getValueClassName());
      rowBucket.setExpression(bucketExp);


      JRDesignCellContents rowHeaderContents = new JRDesignCellContents();
      JRDesignTextField rowTitle = new JRDesignTextField();

      JRDesignExpression rowTitExp = new JRDesignExpression();
      rowTitExp.setValueClassName(crosstabRow.getProperty().getValueClassName());
      rowTitExp.setText("$V{"+crosstabRow.getProperty().getProperty()+"}");

      rowTitle.setExpression(rowTitExp);
      rowTitle.setWidth(crosstabRow.getHeaderWidth());

      //The width can be the sum of the with of all the rows starting from the current one, up to the inner most one.
View Full Code Here

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

      ctColGroup.setName(crosstabColumn.getProperty().getProperty());
      ctColGroup.setHeight(crosstabColumn.getHeaderHeight());

      JRDesignCrosstabBucket bucket = new JRDesignCrosstabBucket();

      JRDesignExpression bucketExp = ExpressionUtils.createExpression("$F{"+crosstabColumn.getProperty().getProperty()+"}", crosstabColumn.getProperty().getValueClassName());
      bucket.setExpression(bucketExp);

      ctColGroup.setBucket(bucket);

      JRDesignCellContents colHeaerContent = new JRDesignCellContents();
      JRDesignTextField colTitle = new JRDesignTextField();

      JRDesignExpression colTitleExp = new JRDesignExpression();
      colTitleExp.setValueClassName(crosstabColumn.getProperty().getValueClassName());
      colTitleExp.setText("$V{"+crosstabColumn.getProperty().getProperty()+"}");


      colTitle.setExpression(colTitleExp);
      colTitle.setWidth(crosstabColumn.getWidth());
      colTitle.setHeight(crosstabColumn.getHeaderHeight());
View Full Code Here

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

    totalHeaderContent.setBackcolor(colors[colors.length/2][0]);
    totalHeaderContent.setMode(new Byte(Transparency.OPAQUE.getValue()));

    JRDesignTextField element = new JRDesignTextField();
    JRDesignExpression exp = ExpressionUtils.createExpression("\"Total "+crosstabRow.getTitle()+"\"",String.class);
    element.setExpression(exp);
    element.setHeight(crosstabRow.getHeight());

    if (crosstabRow.getTotalHeaderStyle() != null)
      layoutManager.applyStyleToElement(crosstabRow.getTotalHeaderStyle(), element);
View Full Code Here

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

    ctColGroup.setTotalPosition(BucketDefinition.TOTAL_POSITION_END);

    totalHeaderContent.setBackcolor(colors[colors.length/2][colors[0].length/2]);
    totalHeaderContent.setMode(new Byte(Transparency.OPAQUE.getValue()));

    JRDesignExpression exp = ExpressionUtils.createExpression("\"Total "+crosstabColumn.getTitle()+"\"",String.class);
    JRDesignTextField element = new JRDesignTextField();
    element.setExpression(exp);
    element.setWidth(crosstabColumn.getWidth());

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.