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

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


    Style defaultDetailStyle = getReport().getOptions().getDefaultDetailStyle();

      Style defaultHeaderStyle = getReport().getOptions().getDefaultHeaderStyle();
  //    Style defaultFooterStyle = getReport().getOptions().getDefaultFooterStyle();
      for (Iterator iter = report.getColumns().iterator(); iter.hasNext();) {
        AbstractColumn column = (AbstractColumn) iter.next();
        if (column.getStyle() == null)
          column.setStyle(defaultDetailStyle);
        if (column.getHeaderStyle() == null)
          column.setHeaderStyle(defaultHeaderStyle);
  //      if (column.getFooterStyle() == null) column.setFooterStyle(defaulyFooterStyle);

//        addStyleToDesign(column.getStyle().transform());
//        addStyleToDesign(column.getHeaderStyle().transform());
      }
View Full Code Here


      decorateOddRows(detail);
    }

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

      AbstractColumn column = (AbstractColumn)iter.next();

      /**
       * Barcode column
       */
      if (column instanceof BarCodeColumn) {
        BarCodeColumn barcodeColumn = (BarCodeColumn)column;
        JRDesignImage image = new JRDesignImage(new JRDesignStyle().getDefaultStyleProvider());
        JRDesignExpression imageExp = new JRDesignExpression();
//        imageExp.setText("ar.com.fdvs.dj.core.BarcodeHelper.getBarcodeImage("+barcodeColumn.getBarcodeType() + ", "+ column.getTextForExpression()+ ", "+ barcodeColumn.isShowText() + ", " + barcodeColumn.isCheckSum() + ", " + barcodeColumn.getApplicationIdentifier() + ","+ column.getWidth() +", "+ report.getOptions().getDetailHeight().intValue() + " )" );

        //Do not pass column height and width mecause barbecue
        //generates the image with wierd dimensions. Pass 0 in both cases
        String applicationIdentifier = barcodeColumn.getApplicationIdentifier();
        if (applicationIdentifier != null && !"".equals(applicationIdentifier.trim()) ){
          applicationIdentifier = "$F{" + applicationIdentifier + "}";
        } else {
          applicationIdentifier = "\"\"";
        }
        imageExp.setText("ar.com.fdvs.dj.core.BarcodeHelper.getBarcodeImage("+barcodeColumn.getBarcodeType() + ", "+ column.getTextForExpression()+ ", "+ barcodeColumn.isShowText() + ", " + barcodeColumn.isCheckSum() + ", " + applicationIdentifier + ",0,0 )" );


        imageExp.setValueClass(java.awt.Image.class);
        image.setExpression(imageExp);
        image.setHeight(getReport().getOptions().getDetailHeight().intValue());
        image.setWidth(column.getWidth().intValue());
        image.setX(column.getPosX().intValue());
        image.setScaleImage(barcodeColumn.getScaleMode().getValue());

        image.setOnErrorType(JRDesignImage.ON_ERROR_TYPE_ICON); //FIXME should we provide control of this to the user?

        applyStyleToElement(column.getStyle(), image);

        detail.addElement(image);
      }
      /**
       * Image columns
       */
      else if (column instanceof ImageColumn) {
        ImageColumn imageColumn = (ImageColumn)column;
        JRDesignImage image = new JRDesignImage(new JRDesignStyle().getDefaultStyleProvider());
        JRDesignExpression imageExp = new JRDesignExpression();
        imageExp.setText(column.getTextForExpression());

        imageExp.setValueClassName(imageColumn.getColumnProperty().getValueClassName());
        image.setExpression(imageExp);
        image.setHeight(getReport().getOptions().getDetailHeight().intValue());
        image.setWidth(column.getWidth().intValue());
        image.setX(column.getPosX().intValue());
        image.setScaleImage(imageColumn.getScaleMode().getValue());

        applyStyleToElement(column.getStyle(), image);

        detail.addElement(image);
      }
      /**
       * Regular Column
       */
      else {
        if (column.getConditionalStyles() != null && !column.getConditionalStyles().isEmpty() ){
          for (Iterator iterator = column.getConditionalStyles().iterator(); iterator.hasNext();) {
            ConditionalStyle condition = (ConditionalStyle) iterator.next();
            JRDesignTextField textField = generateTextFieldFromColumn(column, getReport().getOptions().getDetailHeight().intValue(), null);
            transformDetailBandTextField(column, textField);
            applyStyleToElement(condition.getStyle(), textField);
            textField.setPrintWhenExpression(getExpressionForConditionalStyle(condition.getName(), column.getTextForExpression()));
            detail.addElement(textField);
          }
        } else {
          JRDesignTextField textField = generateTextFieldFromColumn(column, getReport().getOptions().getDetailHeight().intValue(), null);
          transformDetailBandTextField(column, textField);
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

    Style defaultDetailStyle = getReport().getOptions().getDefaultDetailStyle();

      Style defaultHeaderStyle = getReport().getOptions().getDefaultHeaderStyle();
      for (Iterator iter = report.getColumns().iterator(); iter.hasNext();) {
        AbstractColumn column = (AbstractColumn) iter.next();
        if (column.getStyle() == null)
          column.setStyle(defaultDetailStyle);
        if (column.getHeaderStyle() == null)
          column.setHeaderStyle(defaultHeaderStyle);
      }
  }
View Full Code Here

    }
    detail.setHeight(report.getOptions().getDetailHeight().intValue());

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

      AbstractColumn column = (AbstractColumn)iter.next();

      /**
       * Barcode column
       */
      if (column instanceof BarCodeColumn) {
        BarCodeColumn barcodeColumn = (BarCodeColumn)column;
        JRDesignImage image = new JRDesignImage(new JRDesignStyle().getDefaultStyleProvider());
        JRDesignExpression imageExp = new JRDesignExpression();
//        imageExp.setText("ar.com.fdvs.dj.core.BarcodeHelper.getBarcodeImage("+barcodeColumn.getBarcodeType() + ", "+ column.getTextForExpression()+ ", "+ barcodeColumn.isShowText() + ", " + barcodeColumn.isCheckSum() + ", " + barcodeColumn.getApplicationIdentifier() + ","+ column.getWidth() +", "+ report.getOptions().getDetailHeight().intValue() + " )" );

        //Do not pass column height and width mecause barbecue
        //generates the image with wierd dimensions. Pass 0 in both cases
        String applicationIdentifier = barcodeColumn.getApplicationIdentifier();
        if (applicationIdentifier != null && !"".equals(applicationIdentifier.trim()) ){
          applicationIdentifier = "$F{" + applicationIdentifier + "}";
        } else {
          applicationIdentifier = "\"\"";
        }
        imageExp.setText("ar.com.fdvs.dj.core.BarcodeHelper.getBarcodeImage("+barcodeColumn.getBarcodeType() + ", "+ column.getTextForExpression()+ ", "+ barcodeColumn.isShowText() + ", " + barcodeColumn.isCheckSum() + ", " + applicationIdentifier + ",0,0 )" );


        imageExp.setValueClass(java.awt.Image.class);
        image.setExpression(imageExp);
        image.setHeight(getReport().getOptions().getDetailHeight().intValue());
        image.setWidth(column.getWidth().intValue());
        image.setX(column.getPosX().intValue());
        image.setScaleImage(barcodeColumn.getScaleMode().getValue());

        image.setOnErrorType(JRDesignImage.ON_ERROR_TYPE_ICON); //FIXME should we provide control of this to the user?

        if (column.getLink() != null) {
          String name = "column_" + getReport().getColumns().indexOf(column);
          HyperLinkUtil.applyHyperLinkToElement((DynamicJasperDesign) getDesign(), column.getLink(),image,name);
        }       
       
        applyStyleToElement(column.getStyle(), image);

        detail.addElement(image);
      }
      /**
       * Image columns
       */
      else if (column instanceof ImageColumn) {
        ImageColumn imageColumn = (ImageColumn)column;
        JRDesignImage image = new JRDesignImage(new JRDesignStyle().getDefaultStyleProvider());
        JRDesignExpression imageExp = new JRDesignExpression();
        imageExp.setText(column.getTextForExpression());

        imageExp.setValueClassName(imageColumn.getColumnProperty().getValueClassName());
        image.setExpression(imageExp);
        image.setHeight(getReport().getOptions().getDetailHeight().intValue());
        image.setWidth(column.getWidth().intValue());
        image.setX(column.getPosX().intValue());
        image.setScaleImage(imageColumn.getScaleMode().getValue());

        applyStyleToElement(column.getStyle(), image);
       
        if (column.getLink() != null) {
          String name = "column_" + getReport().getColumns().indexOf(column);
          HyperLinkUtil.applyHyperLinkToElement((DynamicJasperDesign) getDesign(),column.getLink(), image,name);
        }       

        detail.addElement(image);
      }
      /**
       * Regular Column
       */
      else {
        if (getReport().getOptions().isShowDetailBand()){
          JRDesignTextField textField = generateTextFieldFromColumn(column, getReport().getOptions().getDetailHeight().intValue(), null);

          if (column.getLink() != null) {
            String name = "column_" + getReport().getColumns().indexOf(column);
            HyperLinkUtil.applyHyperLinkToElement((DynamicJasperDesign) getDesign(),column.getLink(),textField,name);
          }
         
          transformDetailBandTextField(column, textField);
         
          if (textField.getExpression() != null)
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

  }

  protected Object transformEntity(Entity entity) {
    log.debug("transforming group variable...");
    DJGroupVariable columnsGroupVariable = (DJGroupVariable) entity;
    AbstractColumn col = columnsGroupVariable.getColumnToApplyOperation();
    DJCalculation 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);

    if (col instanceof ExpressionColumn && ((ExpressionColumn)col).getExpressionForCalculation() != null){
      ExpressionColumn expcol = (ExpressionColumn)col;
      expression.setText(expcol.getTextForExpressionForCalculartion());
      expression.setValueClassName(expcol.getExpressionForCalculation().getClassName());
    } else {
      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

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.