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

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


    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

    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

    return this;
  }

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

    return this;
  }

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

    return this;
  }

  public FastReportBuilder addImageColumn(String title, String property, int width, boolean fixedWidth, ImageScaleMode imageScaleMode) throws ColumnBuilderException, ClassNotFoundException {
    String className = InputStream.class.getName();
    AbstractColumn column = ColumnBuilder.getInstance()
      .setColumnProperty(property, className)
      .setWidth(new Integer(width))
      .setTitle(title)
      .setFixedWidth(Boolean.valueOf(fixedWidth))
      .setColumnType(ColumnBuilder.COLUMN_TYPE_IMAGE)
View Full Code Here

  }

  protected Object transformEntity(Entity entity) {
    log.debug("transforming group variable...");
    ColumnsGroupVariable columnsGroupVariable = (ColumnsGroupVariable) entity;
    AbstractColumn col = columnsGroupVariable.getColumnToApplyOperation();
    ColumnsGroupVariableOperation 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);
View Full Code Here

  }

  protected void registerEntity(Entity entity) {
//    log.debug("registering column...");
    //A default name is setted if the user didn't specify one.
    AbstractColumn column = (AbstractColumn)entity;
    if (column.getName() == null){
      column.setName(COLUMN_NAME_PREFIX + colCounter++ );
    }
    if (column.getConditionalStyles() != null && !column.getConditionalStyles().isEmpty()){
      new ConditionalStylesRegistrationManager(getDjd(),getDynamicReport(),column.getName()).registerEntities(column.getConditionalStyles());
    }

    if (entity instanceof PropertyColumn) {
      try {
        //addField() will throw an exception only if the column has already been registered.
        PropertyColumn propertyColumn = ((PropertyColumn)entity);
        log.debug("registering column " + column.getName());
        if ( propertyColumn.getColumnProperty() != null && !(entity instanceof ExpressionColumn)){
          getDjd().addField((JRField)transformEntity(entity));
        }
        if (entity instanceof ExpressionColumn) {
          //The Custom Expression parameter must be registered
View Full Code Here

      header.setHeight(columnsGroup.getHeaderHeight().intValue());
      footer.setHeight(columnsGroup.getFooterHeight().intValue());

      if (columnsGroup.getLayout().isPrintHeaders()) {
        for (Iterator iterator =  getVisibleColumns().iterator(); iterator.hasNext();) {
          AbstractColumn col = (AbstractColumn) iterator.next();

          JRDesignTextField designTextField = createColumnNameTextField(columnsGroup, col);
          designTextField.setPositionType(JRDesignElement.POSITION_TYPE_FLOAT); //XXX changeg to see what happens  (must come from the column position property)
          designTextField.setStretchType(JRDesignElement.STRETCH_TYPE_NO_STRETCH); //XXX changeg to see what happens (must come from the column property)
          header.addElement(designTextField);
View Full Code Here

    log.debug("Placing variables in "+type+" band...");
    if ((variables != null)&&(variables.size()>0)) {
      Iterator it = variables.iterator();
      while (it.hasNext()) {
        ColumnsGroupVariable var = (ColumnsGroupVariable) 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() != ColumnsGroupVariableOperation.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.getDefaulHeaderStyle():columnsGroup.getDefaulFooterStyle();

        if (var.getStyle() != null)
          applyStyleToElement(var.getStyle(), textField);
        else if (defStyle != null)
          applyStyleToElement(defStyle, textField);
        else
          applyStyleToElement(col.getStyle(), textField);


        band.addElement(textField);

      }
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.