Package ar.com.fdvs.dj.domain.entities

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


      height = getHeaderVariablesHeight(columnsGroup);
   
    Iterator it = variables.iterator();
    int yOffsetGlabel = 0;
    while (it.hasNext()) {
      DJGroupVariable var = (DJGroupVariable) it.next();
      AbstractColumn col = var.getColumnToApplyOperation();
     
      //Add the group label
      DJGroupLabel label = var.getLabel();
      if (label != null){
       
        JRDesignExpression labelExp = ExpressionUtils.createStringExpression("\""+ label.getText() + "\"");
        JRDesignTextField 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);
       
      }

      //Build the expression for the variable
      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 (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.setEvaluationTime(JRExpression.EVALUATION_TIME_GROUP);

      textField.setEvaluationGroup(jgroup);

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


      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

    }
  }

  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

    globalVariablesGroup.setFooterVariablesHeight(height);
    return this;
  }

  public DynamicReportBuilder addGlobalHeaderVariable(AbstractColumn col, DJCalculation op, Style style) {
    globalVariablesGroup.addHeaderVariable(new DJGroupVariable(col, op, style));
    return this;
  }
View Full Code Here

   * @param col
   * @param op
   * @return
   */
  public DynamicReportBuilder addGlobalFooterVariable(AbstractColumn col, DJCalculation op) {
    globalVariablesGroup.addFooterVariable(new DJGroupVariable(col, op));
    return this;
  }
View Full Code Here

    globalVariablesGroup.addFooterVariable(new DJGroupVariable(col, op));
    return this;
  }

  public DynamicReportBuilder addGlobalFooterVariable(AbstractColumn col, DJCalculation op, Style style) {
    globalVariablesGroup.addFooterVariable(new DJGroupVariable(col, op,style));
    return this;
  }
View Full Code Here

    globalVariablesGroup.addFooterVariable(new DJGroupVariable(col, op,style));
    return this;
  }

  public DynamicReportBuilder addGlobalFooterVariable(AbstractColumn col, DJCalculation op, Style style, DJValueFormatter valueFormatter) {
    globalVariablesGroup.addFooterVariable(new DJGroupVariable(col, op,style,valueFormatter));
    return this;
  }
View Full Code Here

   * @param col
   * @param op
   * @return
   */
  public DynamicReportBuilder addGlobalHeaderVariable(AbstractColumn col, DJCalculation op) {
    globalVariablesGroup.addHeaderVariable(new DJGroupVariable(col, op));
    return this;
  }
View Full Code Here

//      this.globalHeaderVariables = new ArrayList();
    if (style == null)
      style = numberStyle; //XXX Carefree style assignment
//    this.globalHeaderVariables.add(new DJGroupVariable(column, op, style));
   
    this.globalVariablesGroup.addHeaderVariable(new DJGroupVariable(column, op, style));
    return this;
  }
View Full Code Here

    DJGroup group = getGroupByNumber(groupNum);
    PropertyColumn column = (PropertyColumn) report.getColumns().get(colNumber -1);
    if (style == null)
      style = numberStyle;

    DJGroupVariable columnsGroupVariable = new DJGroupVariable(column, op, style);
    group.getHeaderVariables().add(columnsGroupVariable);
    return this;
  }
View Full Code Here

TOP

Related Classes of ar.com.fdvs.dj.domain.entities.DJGroupVariable

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.