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

Examples of ar.com.fdvs.dj.domain.entities.columns.AbstractColumn


    return this;
  }

  public FastReportBuilder addColumn(String title, String property, String className, int width, boolean fixedWidth, String pattern, Style style) throws ColumnBuilderException, ClassNotFoundException {
    AbstractColumn column = ColumnBuilder.getInstance()
    .setColumnProperty(new ColumnProperty(property, className))
    .setWidth(new Integer(width))
    .setTitle(title)
    .setFixedWidth(Boolean.valueOf(fixedWidth))
    .setPattern(pattern)
View Full Code Here


    return this;
  }
 
  public FastReportBuilder addColumn(String title, String property, String className, int width, boolean fixedWidth, String pattern, Style style, String fieldDescription) throws ColumnBuilderException, ClassNotFoundException {
    AbstractColumn column = ColumnBuilder.getInstance()
    .setColumnProperty(new ColumnProperty(property, className))
    .setWidth(new Integer(width))
    .setTitle(title)
    .setFixedWidth(Boolean.valueOf(fixedWidth))
    .setPattern(pattern)
View Full Code Here

        if (groupIdx>0){
          DJGroup prevG =  (DJGroup) getReport().getColumnsGroups().get(groupIdx-1);
          skipPreviousGroupHeaders = !prevG.getLayout().isShowValueForEachRow();
        }
        for (Iterator iterator =  getVisibleColumns().iterator(); iterator.hasNext();) {
          AbstractColumn col = (AbstractColumn) iterator.next();

          //If in a nested group, header for column prior to this groups column
          //depends on configuration

          if (col.equals(columnsGroup.getColumnToGroupBy())) {
            found = true;
          }

          if (!found && skipPreviousGroupHeaders){
            continue;
View Full Code Here

    log.debug("Placing variables in "+type+" band...");
    if ((variables != null) && (!variables.isEmpty())) {
      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();
        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);
View Full Code Here

      //The key for each bar
      JRExpression exp2 = group.getExpression();
 
      JRDesignExpression exp3 = new JRDesignExpression();
      int index = vars.indexOf(var);
      AbstractColumn col = (AbstractColumn) djchart.getColumns().get(index);
      exp3.setText("\"" + col.getTitle() + "\"");
      exp3.setValueClass(String.class);
 
      //Here you can set subgroups of bars
      serie.setCategoryExpression(exp2);
//      serie.setCategoryExpression(varExp1);
View Full Code Here

      //The key for each bar
      JRExpression exp2 = group.getExpression();
 
      JRDesignExpression exp3 = new JRDesignExpression();
      int index = vars.indexOf(var);
      AbstractColumn col = (AbstractColumn) djchart.getColumns().get(index);
      exp3.setText("\"" + col.getTitle() + "\"");
      exp3.setValueClass(String.class);
 
      //Here you can set subgroups of bars
      serie.setCategoryExpression(exp3);
 
View Full Code Here

    log.debug("Generating header band...");
    band.setHeight(report.getOptions().getHeaderHeight().intValue());

    for (Iterator iter = getVisibleColumns().iterator(); iter.hasNext();) {

      AbstractColumn col = (AbstractColumn) iter.next();
      if (col.getTitle() == null)
        continue;

      JRDesignExpression expression = new JRDesignExpression();
      JRDesignTextField textField = new JRDesignTextField();
      expression.setText("\""+ col.getTitle() + "\"");

      expression.setValueClass(String.class);

      textField.setKey("header_"+col.getTitle());
      textField.setExpression(expression);

      textField.setX(col.getPosX().intValue());
      textField.setY(col.getPosY().intValue());
      textField.setHeight(band.getHeight());
      textField.setWidth(col.getWidth().intValue());

      textField.setPrintWhenDetailOverflows(true);
      textField.setBlankWhenNull(true);

      Style headerStyle = col.getHeaderStyle();
      if (headerStyle == null)
        headerStyle = report.getOptions().getDefaultHeaderStyle();

      applyStyleToElement(headerStyle, textField);
View Full Code Here

      int columnsWidth = 0;
      int notRezisableWidth = 0;

      //Store in a variable the total with of all visible columns
      for (Iterator iterator =  visibleColums.iterator(); iterator.hasNext();) {
        AbstractColumn col = (AbstractColumn) iterator.next();
        columnsWidth += col.getWidth().intValue();
        if (col.getFixedWidth().booleanValue())
          notRezisableWidth += col.getWidth().intValue();
      }

      log.debug("columnsWidth = "+ columnsWidth);
      log.debug("notRezisableWidth = "+ notRezisableWidth);

      factor = (float) (printableArea-notRezisableWidth) / (float) (columnsWidth-notRezisableWidth);
      log.debug("factor = "+ factor);
      int acu = 0;
      int colFinalWidth = 0;

      //Select the non-resizable columns
      Collection resizableColumns = CollectionUtils.select( visibleColums,new Predicate() {
        public boolean evaluate(Object arg0) {
          return !((AbstractColumn)arg0).getFixedWidth().booleanValue();
        }

      }) ;

      //Finally, set the new width to the resizable columns
      for (Iterator iter = resizableColumns.iterator(); iter.hasNext();) {
        AbstractColumn col = (AbstractColumn) iter.next();

        if (!iter.hasNext()) {
          col.setWidth(new Integer(printableArea - notRezisableWidth - acu));
        } else {
          colFinalWidth = (new Float(col.getWidth().intValue() * factor)).intValue();
          acu += colFinalWidth;
          col.setWidth(new Integer(colFinalWidth));
        }
      }
    }

    // If the columns width changed, the X position must be setted again.
    int posx = 0;
    for (Iterator iterator =  visibleColums.iterator(); iterator.hasNext();) {
      AbstractColumn col = (AbstractColumn) iterator.next();
      col.setPosX(new Integer(posx));
      posx += col.getWidth().intValue();
    }
  }
View Full Code Here

    JRDesignGroup group = getJRGroupFromDJGroup(chart.getColumnsGroup());
    List vars = new ArrayList();

    int serieNum = 0;
    for (Iterator iterator = chart.getColumns().iterator(); iterator.hasNext();) {
      AbstractColumn col = (AbstractColumn) iterator.next();


      Class clazz = null;
      try { clazz = Class.forName(col.getValueClassNameForExpression());
      } catch (ClassNotFoundException e) {
        throw new DJException("Exeption creating chart variable: " + e.getMessage(),e);
      }

      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

    return super.build();
  }

    public FastReportBuilder addColumn(String title, String property, String className, int width, Style style) throws ColumnBuilderException, ClassNotFoundException {
    AbstractColumn column = ColumnBuilder.getInstance()
      .setColumnProperty(new ColumnProperty(property, className))
      .setWidth(new Integer(width))
      .setTitle(title)
      .build();

    column.setStyle(style);

    addColumn(column);

    return this;
  }
View Full Code Here

TOP

Related Classes of ar.com.fdvs.dj.domain.entities.columns.AbstractColumn

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.