Examples of DJGroupVariable


Examples of ar.com.fdvs.dj.domain.entities.DJGroupVariable

    group.getFooterVariables().add(new DJGroupVariable(column3,operation,style));
    return this;
  }

  public GroupBuilder addFooterVariable(AbstractColumn column3, DJCalculation operation, Style style, DJValueFormatter valueFormatter) {
    group.getFooterVariables().add(new DJGroupVariable(column3,operation,style,valueFormatter));
    return this;
  }
View Full Code Here

Examples of ar.com.fdvs.dj.domain.entities.DJGroupVariable

    group.getFooterVariables().add(new DJGroupVariable(column3,operation,style,valueFormatter));
    return this;
  }

  public GroupBuilder addFooterVariable(AbstractColumn column3, DJCalculation operation, Style style, DJValueFormatter valueFormatter, DJGroupLabel label) {
    group.getFooterVariables().add(new DJGroupVariable(column3,operation,style,valueFormatter,label));
    return this;
  }
View Full Code Here

Examples of ar.com.fdvs.dj.domain.entities.DJGroupVariable

            ? columnsGroup.getFooterVariablesHeight()
            :getReport().getOptions().getDetailHeight();
   
    Iterator it = variables.iterator();
    while (it.hasNext()) {
      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();
     
      setTextAndClassToExpression(expression,var,col,variableName);
     
      if (var.getOperation() != DJCalculation.COUNT && var.getOperation() != DJCalculation.DISTINCT_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 + height.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 (col.getStyle() != null) {
        //Last resource is to 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);
      }
      else if (defStyle != null)
        applyStyleToElement(defStyle, 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();
View Full Code Here

Examples of ar.com.fdvs.dj.domain.entities.DJGroupVariable

    }
  }

  protected DJGroupVariable findLeftMostColumn(List variables) {
    int mostLeftX = Integer.MAX_VALUE;
    DJGroupVariable mostLeftColumn =  null;
    for (Iterator iterator = variables.iterator(); iterator.hasNext();) {
      DJGroupVariable currentCol = (DJGroupVariable) iterator.next();
      if (currentCol.getColumnToApplyOperation().getPosX().intValue() <= mostLeftX) {
        mostLeftColumn = currentCol;
                mostLeftX = mostLeftColumn.getColumnToApplyOperation().getPosX().intValue();
            }
        }
    return mostLeftColumn;
View Full Code Here

Examples of ar.com.fdvs.dj.domain.entities.DJGroupVariable

        //max width
        int width = getDesign().getPageWidth() - getDesign().getLeftMargin() - getDesign().getRightMargin();
        int height = label.getHeight();
        int yOffset = 0;
        if (label.getLabelPosition() == LabelPosition.LEFT) {
          DJGroupVariable lmvar = findLeftMostColumn(footerVariables);
       
          x = col.getPosX().intValue(); //label starts in the column-to-group-by x position
          y = findYOffsetForGroupLabel(band);
          if (lmvar != null) {
            AbstractColumn lmColumn = lmvar.getColumnToApplyOperation();
            width = lmColumn.getPosX().intValue() - x;
          }
          else
            width -= x;
          height = getFooterVariableHeight(columnsGroup);
        }
        else if (label.getLabelPosition() == LabelPosition.RIGHT) {
          DJGroupVariable rmvar = findRightMostColumn(footerVariables);         
         
          if (rmvar != null) {
            AbstractColumn rmColumn = rmvar.getColumnToApplyOperation();
            x = rmColumn.getPosX().intValue() + rmColumn.getWidth().intValue();
          }
          else
            x = col.getPosX().intValue(); //label starts in the column-to-group-by x position
          y = findYOffsetForGroupLabel(band);
View Full Code Here

Examples of ar.com.fdvs.dj.domain.entities.DJGroupVariable

     
      //The width will be all the page, except for the width of the header variables
            int headerVariablesWidth = getReport().getOptions().getPrintableWidth();
           
            if (!group.getHeaderVariables().isEmpty()){
              DJGroupVariable leftmostcol = findLeftMostColumn(group.getHeaderVariables());
              headerVariablesWidth = leftmostcol.getColumnToApplyOperation().getPosX().intValue();
              if (groupLabelsPresent(group.getHeaderVariables())){
                currentValue.setY(height.intValue());
                currentValue.setHeight(getHeaderVariablesHeight(group));
              }
            }
View Full Code Here

Examples of ar.com.fdvs.dj.domain.entities.DJGroupVariable

   * @param groupVariables
   * @return
   */
  protected boolean groupLabelsPresent(List groupVariables) {
    for (Iterator iterator = groupVariables.iterator(); iterator.hasNext();) {
      DJGroupVariable var = (DJGroupVariable) iterator.next();
      if (var.getLabel() != null)
        return true;
     
    }
    return false;
  }
View Full Code Here

Examples of ar.com.fdvs.dj.domain.entities.DJGroupVariable

      height = getHeaderVariablesHeight(djGroup);
   
    Iterator it = variables.iterator();
    int yOffsetGlabel = 0;
    while (it.hasNext()) {
      DJGroupVariable var = (DJGroupVariable) it.next();
      AbstractColumn col = var.getColumnToApplyOperation();

      //Build the expression for the variable
      String variableName = col.getGroupVariableName(type, djGroup.getColumnToGroupBy().getColumnProperty().getProperty());
     
      //Add the group label
      DJGroupLabel label = var.getLabel();
      JRDesignTextField labelTf = null;
      if (label != null){
        JRDesignExpression labelExp;
        if (label.isJasperExpression()) //a text with things like "$F{myField}"
          labelExp = ExpressionUtils.createStringExpression(label.getText());
        else if (label.getLabelExpression() != null){
          labelExp = ExpressionUtils.createExpression(variableName + "_labelExpression", label.getLabelExpression());
        } else //a simple text
          //labelExp = ExpressionUtils.createStringExpression("\""+ Utils.escapeTextForExpression(label.getText())+ "\"");
          labelExp = ExpressionUtils.createStringExpression("\""+ label.getText() + "\"");
        labelTf = new JRDesignTextField();
        labelTf.setExpression(labelExp);
        labelTf.setWidth(col.getWidth().intValue());
        labelTf.setHeight(label.getHeight());
        labelTf.setX(col.getPosX().intValue());
        labelTf.setY(yOffset);
        yOffsetGlabel = labelTf.getHeight();       
        if (inFooter){
          labelTf.setPositionType(JRDesignElement.POSITION_TYPE_FIX_RELATIVE_TO_TOP);
        }
        applyStyleToElement(label.getStyle(), labelTf);
        band.addElement(labelTf);
       
      }

      JRDesignExpression expression = new JRDesignExpression();
      JRDesignTextField textField = new JRDesignTextField();
     
      textField.setEvaluationTime(JRExpression.EVALUATION_TIME_GROUP);
     
      if (var.getValueExpression() != null) {
        expression = ExpressionUtils.createExpression(variableName + "_valueExpression", var.getValueExpression());
      }
      else
        setTextAndClassToExpression(expression,var,col,variableName);
     
      if (var.getOperation() != DJCalculation.COUNT && var.getOperation() != DJCalculation.DISTINCT_COUNT )
        textField.setPattern(col.getPattern());
     
      if (col instanceof PercentageColumn) {
        PercentageColumn pcol = (PercentageColumn) col;
        expression.setText(pcol.getTextForExpression(djGroup, djGroup ,type));
        expression.setValueClassName(pcol.getValueClassNameForExpression());
        textField.setEvaluationTime(JRExpression.EVALUATION_TIME_AUTO);
      } else {
        textField.setEvaluationGroup(jgroup);
      }

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

     
      if (inFooter){
        textField.setPositionType(JRDesignElement.POSITION_TYPE_FIX_RELATIVE_TO_TOP);
      }

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

      textField.setHeight(0 + height ); //XXX be carefull with the "2+ ..."

      textField.setWidth(col.getWidth().intValue());


      textField.setKey("variable_for_column_"+ getVisibleColumns().indexOf(col) + "_in_group_" + getDesign().getGroupsList().indexOf(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)
            ? djGroup.getDefaulHeaderVariableStyle()
            : djGroup.getDefaulFooterVariableStyle();

      if (var.getStyle() != null)
        applyStyleToElement(var.getStyle(), textField);
      else if (col.getStyle() != null) {
        //Last resource is to 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) style.clone();
          style.setName(null); //set to null to make applyStyleToElement(...) assign a name
        } catch (Exception e) {  }
        applyStyleToElement(style, textField);
      }
      else if (defStyle != null)
        applyStyleToElement(defStyle, textField);

      if (var.getPrintWhenExpression() != null) {
        JRDesignExpression exp = ExpressionUtils.createExpression(variableName + "_printWhenExpression", var.getPrintWhenExpression());
        textField.setPrintWhenExpression(exp);
        if (labelTf != null)
          labelTf.setPrintWhenExpression(exp);
      }
     
      band.addElement(textField);

    }

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

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

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

      JRDesignTextField globalTextField = new JRDesignTextField();
      JRDesignExpression globalExp = new JRDesignExpression();
View Full Code Here

Examples of ar.com.fdvs.dj.domain.entities.DJGroupVariable

    }
  }

  protected DJGroupVariable findLeftMostColumn(List variables) {
    int mostLeftX = Integer.MAX_VALUE;
    DJGroupVariable mostLeftColumn =  null;
    for (Iterator iterator = variables.iterator(); iterator.hasNext();) {
      DJGroupVariable currentCol = (DJGroupVariable) iterator.next();
      if (currentCol.getColumnToApplyOperation().getPosX().intValue() <= mostLeftX) {
        mostLeftColumn = currentCol;
                mostLeftX = mostLeftColumn.getColumnToApplyOperation().getPosX().intValue();
            }
        }
    return mostLeftColumn;
View Full Code Here

Examples of ar.com.fdvs.dj.domain.entities.DJGroupVariable

    return mostLeftColumn;
  }

  protected DJGroupVariable findRightMostColumn(List variables) {
    int mostRightX = Integer.MIN_VALUE;
    DJGroupVariable mostRightColumn =  null;
    for (Iterator iterator = variables.iterator(); iterator.hasNext();) {
      DJGroupVariable currentCol = (DJGroupVariable) iterator.next();
      if (currentCol.getColumnToApplyOperation().getPosX().intValue() >= mostRightX) {
        mostRightColumn = currentCol;
                mostRightX = mostRightColumn.getColumnToApplyOperation().getPosX().intValue();
            }
        }
    return mostRightColumn;
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.