Examples of JRDesignCrosstabCell


Examples of net.sf.jasperreports.crosstabs.design.JRDesignCrosstabCell

  public static final String ATTRIBUTE_width = "width";
  public static final String ATTRIBUTE_height = "height";
 
  public Object createObject(Attributes attributes)
  {
    JRDesignCrosstabCell cell = new JRDesignCrosstabCell();
   
    cell.setRowTotalGroup(attributes.getValue(ATTRIBUTE_rowTotalGroup));
    cell.setColumnTotalGroup(attributes.getValue(ATTRIBUTE_columnTotalGroup));
   
    String widthAttr = attributes.getValue(ATTRIBUTE_width);
    if (widthAttr != null)
    {
      cell.setWidth(Integer.valueOf(widthAttr));
    }
   
    String heightAttr = attributes.getValue(ATTRIBUTE_height);
    if (heightAttr != null)
    {
      cell.setHeight(Integer.valueOf(heightAttr));
    }

    return cell;
  }
View Full Code Here

Examples of net.sf.jasperreports.crosstabs.design.JRDesignCrosstabCell

    for (int i = auxCols.length-1; i >= 0; i--) {
      for (int j =  auxRows.length-1; j >= 0; j--) {
        DJCrosstabColumn crosstabColumn = auxCols[i];
        DJCrosstabRow crosstabRow = auxRows[j];

        JRDesignCrosstabCell cell = new JRDesignCrosstabCell();

        cell.setWidth(new Integer(crosstabColumn.getWidth()));
        cell.setHeight(new Integer(crosstabRow.getHeight()));

        if (crosstabColumn.getProperty() != null)
          cell.setColumnTotalGroup(crosstabColumn.getProperty().getProperty());

        if (crosstabRow.getProperty() != null)
          cell.setRowTotalGroup(crosstabRow.getProperty().getProperty());


        JRDesignCellContents contents = new JRDesignCellContents();

        JRDesignTextField element = new JRDesignTextField();
        element.setWidth(crosstabColumn.getWidth());
        element.setHeight(crosstabRow.getHeight());

        JRDesignExpression measureExp = new JRDesignExpression();
        DJCrosstabMeasure measure = djcross.getMeasure(0);
        measureExp.setValueClassName(measure.getProperty().getValueClassName());
        measureExp.setText("$V{"+measure.getProperty().getProperty()+"}");

        element.setExpression(measureExp);

        /**
         * Is there any style for this object?
         */
        if (crosstabRow.getProperty() == null && crosstabColumn.getProperty() == null && measure.getStyle() != null ){
          //this is the inner most cell
          layoutManager.applyStyleToElement(measure.getStyle() , element);
        } else if (crosstabRow.getTotalStyle() != null) {
          layoutManager.applyStyleToElement(crosstabRow.getTotalStyle(), element);
        }
        else if (crosstabColumn.getTotalStyle() != null) {
          layoutManager.applyStyleToElement(crosstabColumn.getTotalStyle(), element);
        }

//        if ((i == auxCols.length-1 &&  j != auxRows.length-1) || (i != auxCols.length-1 &&  j != auxRows.length-1)){
//          cell.setWidth(Integer.valueOf( 100));
//        }
//        if (crosstabColumn.getProperty() != null && j != auxRows.length-1 && crosstabRow.getTotalHeaderHeight() != 0){
//          cell.setWidth(Integer.valueOf( crosstabRow.getTotalHeaderHeight() ));
//        }
//        if (i != auxCols.length-1 && j != auxRows.length-1 && crosstabRow.getTotalHeaderHeight() != 0){
//          cell.setWidth(Integer.valueOf( crosstabRow.getTotalHeaderHeight() ));
//        }


        contents.setMode(new Byte(Transparency.OPAQUE.getValue()));
        contents.setBackcolor(colors[i][j]);
        contents.addElement(element);

        applyCellBorder(contents);

        cell.setContents(contents);


        try {
          jrcross.addCell(cell);
        } catch (JRException e) {
View Full Code Here

Examples of net.sf.jasperreports.crosstabs.design.JRDesignCrosstabCell

    for (int i = auxCols.length-1; i >= 0; i--) {
      for (int j =  auxRows.length-1; j >= 0; j--) {
        DJCrosstabColumn crosstabColumn = auxCols[i];
        DJCrosstabRow crosstabRow = auxRows[j];

        JRDesignCrosstabCell cell = new JRDesignCrosstabCell();

        cell.setWidth(new Integer(crosstabColumn.getWidth()));
        cell.setHeight(new Integer(crosstabRow.getHeight()));

        if (crosstabColumn.getProperty() != null)
          cell.setColumnTotalGroup(crosstabColumn.getProperty().getProperty());

        if (crosstabRow.getProperty() != null)
          cell.setRowTotalGroup(crosstabRow.getProperty().getProperty());


        JRDesignCellContents contents = new JRDesignCellContents();

        JRDesignTextField element = new JRDesignTextField();
        element.setWidth(crosstabColumn.getWidth());
        element.setHeight(crosstabRow.getHeight());

        JRDesignExpression measureExp = new JRDesignExpression();
        DJCrosstabMeasure measure = djcross.getMeasure(0);
        measureExp.setValueClassName(measure.getProperty().getValueClassName());
        measureExp.setText("$V{"+measure.getProperty().getProperty()+"}");

        element.setExpression(measureExp);

        /**
         * Is there any style for this object?
         */
        if (crosstabRow.getProperty() == null && crosstabColumn.getProperty() == null && measure.getStyle() != null ){
          //this is the inner most cell
          layoutManager.applyStyleToElement(measure.getStyle() , element);
        } else if (crosstabRow.getTotalStyle() != null) {
          layoutManager.applyStyleToElement(crosstabRow.getTotalStyle(), element);
        }
        else if (crosstabColumn.getTotalStyle() != null) {
          layoutManager.applyStyleToElement(crosstabColumn.getTotalStyle(), element);
        }

//        if ((i == auxCols.length-1 &&  j != auxRows.length-1) || (i != auxCols.length-1 &&  j != auxRows.length-1)){
//          cell.setWidth(Integer.valueOf( 100));
//        }
//        if (crosstabColumn.getProperty() != null && j != auxRows.length-1 && crosstabRow.getTotalHeaderHeight() != 0){
//          cell.setWidth(Integer.valueOf( crosstabRow.getTotalHeaderHeight() ));
//        }
//        if (i != auxCols.length-1 && j != auxRows.length-1 && crosstabRow.getTotalHeaderHeight() != 0){
//          cell.setWidth(Integer.valueOf( crosstabRow.getTotalHeaderHeight() ));
//        }


        contents.setMode(new Byte(Transparency.OPAQUE.getValue()));
        contents.setBackcolor(colors[i][j]);
        contents.addElement(element);

        applyCellBorder(contents);

        cell.setContents(contents);


        try {
          jrcross.addCell(cell);
        } catch (JRException e) {
View Full Code Here

Examples of net.sf.jasperreports.crosstabs.design.JRDesignCrosstabCell

    for (int i = auxCols.length-1; i >= 0; i--) {
      for (int j =  auxRows.length-1; j >= 0; j--) {
        DJCrosstabColumn crosstabColumn = auxCols[i];
        DJCrosstabRow crosstabRow = auxRows[j];

        JRDesignCrosstabCell cell = new JRDesignCrosstabCell();

        cell.setWidth(new Integer(crosstabColumn.getWidth()));
        cell.setHeight(new Integer(crosstabRow.getHeight()));

        if (crosstabColumn.getProperty() != null)
          cell.setColumnTotalGroup(crosstabColumn.getProperty().getProperty());

        if (crosstabRow.getProperty() != null)
          cell.setRowTotalGroup(crosstabRow.getProperty().getProperty());


        JRDesignCellContents contents = new JRDesignCellContents();

        JRDesignTextField element = new JRDesignTextField();
        element.setWidth(crosstabColumn.getWidth());
        element.setHeight(crosstabRow.getHeight());

        JRDesignExpression measureExp = new JRDesignExpression();
        DJCrosstabMeasure measure = djcross.getMeasure(0);
        measureExp.setValueClassName(measure.getProperty().getValueClassName());
        measureExp.setText("$V{"+measure.getProperty().getProperty()+"}");

        element.setExpression(measureExp);

        /**
         * Is there any style for this object?
         */
        if (crosstabRow.getProperty() == null && crosstabColumn.getProperty() == null && measure.getStyle() != null ){
          //this is the inner most cell
          layoutManager.applyStyleToElement(measure.getStyle() , element);
        } else if (crosstabRow.getTotalStyle() != null) {
          layoutManager.applyStyleToElement(crosstabRow.getTotalStyle(), element);
        }
        else if (crosstabColumn.getTotalStyle() != null) {
          layoutManager.applyStyleToElement(crosstabColumn.getTotalStyle(), element);
        }

//        if ((i == auxCols.length-1 &&  j != auxRows.length-1) || (i != auxCols.length-1 &&  j != auxRows.length-1)){
//          cell.setWidth(Integer.valueOf( 100));
//        }
//        if (crosstabColumn.getProperty() != null && j != auxRows.length-1 && crosstabRow.getTotalHeaderHeight() != 0){
//          cell.setWidth(Integer.valueOf( crosstabRow.getTotalHeaderHeight() ));
//        }
//        if (i != auxCols.length-1 && j != auxRows.length-1 && crosstabRow.getTotalHeaderHeight() != 0){
//          cell.setWidth(Integer.valueOf( crosstabRow.getTotalHeaderHeight() ));
//        }


        contents.setMode(new Byte(Transparency.OPAQUE.getValue()));
        contents.setBackcolor(colors[i][j]);
        contents.addElement(element);

        applyCellBorder(contents);

        cell.setContents(contents);


        try {
          jrcross.addCell(cell);
        } catch (JRException e) {
View Full Code Here

Examples of net.sf.jasperreports.crosstabs.design.JRDesignCrosstabCell

    for (int i = auxCols.length-1; i >= 0; i--) {
      for (int j =  auxRows.length-1; j >= 0; j--) {
        DJCrosstabColumn crosstabColumn = auxCols[i];
        DJCrosstabRow crosstabRow = auxRows[j];

        JRDesignCrosstabCell cell = new JRDesignCrosstabCell();

        cell.setWidth(new Integer(crosstabColumn.getWidth()));
        cell.setHeight(new Integer(crosstabRow.getHeight()));

        if (crosstabColumn.getProperty() != null)
          cell.setColumnTotalGroup(crosstabColumn.getProperty().getProperty());

        if (crosstabRow.getProperty() != null)
          cell.setRowTotalGroup(crosstabRow.getProperty().getProperty());


        JRDesignCellContents contents = new JRDesignCellContents();


        int counter = 0;
        int measureHeight = crosstabRow.getHeight() / djcross.getMeasures().size();
        for (Iterator iterator = djcross.getMeasures().iterator(); iterator.hasNext(); counter++) {
          DJCrosstabMeasure djmeasure = (DJCrosstabMeasure) iterator.next();
         
          JRDesignTextField element = new JRDesignTextField();
          element.setWidth(crosstabColumn.getWidth());
          element.setHeight(measureHeight);
          element.setY(counter*measureHeight);
         

          JRDesignExpression measureExp = new JRDesignExpression();
//          DJCrosstabMeasure measure = djcross.getMeasure(0);
          measureExp.setValueClassName(djmeasure.getProperty().getValueClassName());
          measureExp.setText("$V{"+djmeasure.getProperty().getProperty()+"}");
         
          element.setExpression(measureExp);

          /**
           * Is there any style for this object?
           */
          if (crosstabRow.getProperty() == null && crosstabColumn.getProperty() == null && djmeasure.getStyle() != null ){
            //this is the inner most cell
            layoutManager.applyStyleToElement(djmeasure.getStyle() , element);
          } else if (crosstabRow.getTotalStyle() != null) {
            layoutManager.applyStyleToElement(crosstabRow.getTotalStyle(), element);
          }
          else if (crosstabColumn.getTotalStyle() != null) {
            layoutManager.applyStyleToElement(crosstabColumn.getTotalStyle(), element);
          }
         
          if (djmeasure.getLink() != null){
            String name = "cell_" + i + "_" +  j + "_ope" + djmeasure.getOperation().getValue();
            HyperLinkUtil.applyHyperLinkToElement((DynamicJasperDesign)this.design, djmeasure.getLink(), element, name);
          }
 
          contents.addElement(element);
         
        }
       
        contents.setMode(new Byte(Transparency.OPAQUE.getValue()));
       
        applyBackgroundColor(contents,crosstabRow,crosstabColumn,i,j);
       
        applyCellBorder(contents);

        cell.setContents(contents);


        try {
          jrcross.addCell(cell);
        } catch (JRException e) {
View Full Code Here

Examples of net.sf.jasperreports.crosstabs.design.JRDesignCrosstabCell

    for (int i = auxCols.length-1; i >= 0; i--) {
      for (int j =  auxRows.length-1; j >= 0; j--) {
        DJCrosstabColumn crosstabColumn = auxCols[i];
        DJCrosstabRow crosstabRow = auxRows[j];

        JRDesignCrosstabCell cell = new JRDesignCrosstabCell();

        cell.setWidth(new Integer(crosstabColumn.getWidth()));
        cell.setHeight(new Integer(crosstabRow.getHeight()));

        if (crosstabColumn.getProperty() != null)
          cell.setColumnTotalGroup(crosstabColumn.getProperty().getProperty());

        if (crosstabRow.getProperty() != null)
          cell.setRowTotalGroup(crosstabRow.getProperty().getProperty());


        JRDesignCellContents contents = new JRDesignCellContents();


        int counter = 0;
        int measureHeight = crosstabRow.getHeight() / djcross.getMeasures().size();
        for (Iterator iterator = djcross.getMeasures().iterator(); iterator.hasNext(); counter++) {
          DJCrosstabMeasure djmeasure = (DJCrosstabMeasure) iterator.next();
         
          JRDesignTextField element = new JRDesignTextField();
          element.setWidth(crosstabColumn.getWidth());
          element.setHeight(measureHeight);
          element.setY(counter*measureHeight);
         

          JRDesignExpression measureExp = new JRDesignExpression();
//          DJCrosstabMeasure measure = djcross.getMeasure(0);
          measureExp.setValueClassName(djmeasure.getProperty().getValueClassName());
          measureExp.setText("$V{"+djmeasure.getProperty().getProperty()+"}");
         
          element.setExpression(measureExp);

          /*
          JRDesignExpression measureExp = new JRDesignExpression();
          DJCrosstabMeasure measure = djcross.getMeasure(0);
          measureExp.setValueClassName(measure.getProperty().getValueClassName());
          measureExp.setText("$V{"+measure.getProperty().getProperty()+"}");
 
          element.setExpression(measureExp);
  */
          /**
           * Is there any style for this object?
           */
          if (crosstabRow.getProperty() == null && crosstabColumn.getProperty() == null && djmeasure.getStyle() != null ){
            //this is the inner most cell
            layoutManager.applyStyleToElement(djmeasure.getStyle() , element);
          } else if (crosstabRow.getTotalStyle() != null) {
            layoutManager.applyStyleToElement(crosstabRow.getTotalStyle(), element);
          }
          else if (crosstabColumn.getTotalStyle() != null) {
            layoutManager.applyStyleToElement(crosstabColumn.getTotalStyle(), element);
          }
 
  //        if ((i == auxCols.length-1 &&  j != auxRows.length-1) || (i != auxCols.length-1 &&  j != auxRows.length-1)){
  //          cell.setWidth(Integer.valueOf( 100));
  //        }
  //        if (crosstabColumn.getProperty() != null && j != auxRows.length-1 && crosstabRow.getTotalHeaderHeight() != 0){
  //          cell.setWidth(Integer.valueOf( crosstabRow.getTotalHeaderHeight() ));
  //        }
  //        if (i != auxCols.length-1 && j != auxRows.length-1 && crosstabRow.getTotalHeaderHeight() != 0){
  //          cell.setWidth(Integer.valueOf( crosstabRow.getTotalHeaderHeight() ));
  //        }
 
 
          contents.setMode(new Byte(Transparency.OPAQUE.getValue()));
          contents.setBackcolor(colors[i][j]);
          contents.addElement(element);
         
        }

        applyCellBorder(contents);

        cell.setContents(contents);


        try {
          jrcross.addCell(cell);
        } catch (JRException e) {
View Full Code Here

Examples of net.sf.jasperreports.crosstabs.design.JRDesignCrosstabCell

    for (int i = auxCols.length-1; i >= 0; i--) {
      for (int j =  auxRows.length-1; j >= 0; j--) {
        DJCrosstabColumn crosstabColumn = auxCols[i];
        DJCrosstabRow crosstabRow = auxRows[j];

        JRDesignCrosstabCell cell = new JRDesignCrosstabCell();

        cell.setWidth(new Integer(crosstabColumn.getWidth()));
        cell.setHeight(new Integer(crosstabRow.getHeight()));

        boolean isRowTotal = crosstabRow.getProperty() != null;
        boolean isColumnTotal = crosstabColumn.getProperty() != null;
       
        if (isColumnTotal)
          cell.setColumnTotalGroup(crosstabColumn.getProperty().getProperty());

        if (isRowTotal)
          cell.setRowTotalGroup(crosstabRow.getProperty().getProperty());

        JRDesignCellContents contents = new JRDesignCellContents();

        int counter = 0;
        int measureHeight = crosstabRow.getHeight() / djcross.getMeasures().size()
       
        for (Iterator iterator = djcross.getMeasures().iterator(); iterator.hasNext(); counter++) {
          DJCrosstabMeasure djmeasure = (DJCrosstabMeasure) iterator.next();
         
          JRDesignTextField element = new JRDesignTextField();
          element.setWidth(crosstabColumn.getWidth());
          element.setHeight(measureHeight);
          element.setY(counter*measureHeight);
         

          JRDesignExpression measureExp = new JRDesignExpression();
//          DJCrosstabMeasure measure = djcross.getMeasure(0);
         
          boolean isTotalCell = isRowTotal || isColumnTotal;
         
          if (!isTotalCell){
            if (djmeasure.getValueFormatter()== null){
              measureExp.setValueClassName(djmeasure.getProperty().getValueClassName());
              measureExp.setText("$V{"+djmeasure.getProperty().getProperty()+"}");
            } else {
              measureExp.setText(djmeasure.getTextForValueFormatterExpression(djmeasure.getProperty().getProperty()));
              measureExp.setValueClassName(djmeasure.getValueFormatter().getClassName());
            }
          } else { //is a total cell
            if (djmeasure.getValueFormatter()== null){
              if (djmeasure.getPrecalculatedTotalProvider() == null) {
                measureExp.setValueClassName(djmeasure.getProperty().getValueClassName());
                measureExp.setText("$V{"+djmeasure.getProperty().getProperty()+"}");
              } else {
                //call the precalculated value AND the value formatter
                setExpressionForPrecalculatedTotalValue(auxCols, auxRows, measureExp, djmeasure, crosstabColumn, crosstabRow);
              }
            } else { //have value formatter
              if (djmeasure.getPrecalculatedTotalProvider() == null) {
                //no vlue formatter, no total provider
                measureExp.setValueClassName(djmeasure.getProperty().getValueClassName());
                measureExp.setText("$V{"+djmeasure.getProperty().getProperty()+"}");
              } else {
                //no vlue formatter, call the precalculated value only
//                measureExp.setValueClass(String.class);
//                measureExp.setText("\"VF, prec\"");
                setExpressionForPrecalculatedTotalValue(auxCols, auxRows, measureExp, djmeasure, crosstabColumn, crosstabRow);
              }
            }
          }
         
//          measureExp.setValueClassName(djmeasure.getProperty().getValueClassName());
//          measureExp.setText("$V{"+djmeasure.getProperty().getProperty()+"}");
         
          element.setExpression(measureExp);

          /**
           * Is there any style for this object?
           */
          /*if (crosstabRow.getProperty() == null && crosstabColumn.getProperty() == null && djmeasure.getStyle() != null ){
            //this is the inner most cell
            layoutManager.applyStyleToElement(djmeasure.getStyle() , element);
          } else if (crosstabRow.getTotalStyle() != null) {
            layoutManager.applyStyleToElement(crosstabRow.getTotalStyle(), element);
          }
          else if (crosstabColumn.getTotalStyle() != null) {
            layoutManager.applyStyleToElement(crosstabColumn.getTotalStyle(), element);
          }*/
         
          //measure
          if (!isRowTotal && !isColumnTotal && djmeasure.getStyle() != null ){
            //this is the inner most cell
            layoutManager.applyStyleToElement(djmeasure.getStyle() , element);
          }
          //row total only
          if (isRowTotal && !isColumnTotal) {
            Style style = getRowTotalStyle(crosstabRow);
            if (style == null)
              style = djmeasure.getStyle();
            if (style != null)
              layoutManager.applyStyleToElement(style, element);
          }
          //column total only
          if (isColumnTotal && !isRowTotal) {
            Style style = getColumnTotalStyle(crosstabColumn);
            if (style == null)
              style = djmeasure.getStyle();
            if (style != null)
              layoutManager.applyStyleToElement(style, element);
          }
          //row and column total
          if (isRowTotal && isColumnTotal) {
            Style style = getRowTotalStyle(crosstabRow);
            if (style == null)
              style = getColumnTotalStyle(crosstabColumn);
            if (style == null)
              style = djmeasure.getStyle();
            if (style != null)
              layoutManager.applyStyleToElement(style, element);
          }
         
          JRDesignStyle jrstyle = (JRDesignStyle) element.getStyle();
          //FIXME this is a hack
          if (jrstyle == null){
            if (log.isDebugEnabled()){
              log.warn("jrstyle is null in crosstab cell, this should have not happened.");
            }
            layoutManager.applyStyleToElement(null, element);
            jrstyle = (JRDesignStyle)element.getStyle();
            jrstyle.setBlankWhenNull(true);
          }
         
          JRDesignStyle alternateStyle = Utils.cloneStyle(jrstyle);
          alternateStyle.setName(alternateStyle.getFontName() +"_for_column_" + djmeasure.getProperty());
          alternateStyle.getConditionalStyleList().clear();
          element.setStyle(alternateStyle);
          try {
            design.addStyle(alternateStyle);
          } catch (JRException e) { /**e.printStackTrace(); //Already there, nothing to do **/}
          setUpConditionStyles(alternateStyle, djmeasure, measureExp.getText());
         
          if (djmeasure.getLink() != null){
            String name = "cell_" + i + "_" +  j + "_ope" + djmeasure.getOperation().getValue();
            HyperLinkUtil.applyHyperLinkToElement((DynamicJasperDesign)this.design, djmeasure.getLink(), element, name);
          }
 
          contents.addElement(element);
         
        }
       
        contents.setMode(new Byte(Transparency.OPAQUE.getValue()));
       
        applyBackgroundColor(contents,crosstabRow,crosstabColumn,i,j);
       
        applyCellBorder(contents);

        cell.setContents(contents);


        try {
          jrcross.addCell(cell);
        } catch (JRException e) {
View Full Code Here

Examples of net.sf.jasperreports.crosstabs.design.JRDesignCrosstabCell

    for (int i = auxCols.length-1; i >= 0; i--) {
      for (int j =  auxRows.length-1; j >= 0; j--) {
        DJCrosstabColumn crosstabColumn = auxCols[i];
        DJCrosstabRow crosstabRow = auxRows[j];

        JRDesignCrosstabCell cell = new JRDesignCrosstabCell();

        cell.setWidth(new Integer(crosstabColumn.getWidth()));
        cell.setHeight(new Integer(crosstabRow.getHeight()));

        if (crosstabColumn.getProperty() != null)
          cell.setColumnTotalGroup(crosstabColumn.getProperty().getProperty());

        if (crosstabRow.getProperty() != null)
          cell.setRowTotalGroup(crosstabRow.getProperty().getProperty());


        JRDesignCellContents contents = new JRDesignCellContents();

        JRDesignTextField element = new JRDesignTextField();
        element.setWidth(crosstabColumn.getWidth());
        element.setHeight(crosstabRow.getHeight());

        JRDesignExpression measureExp = new JRDesignExpression();
        DJCrosstabMeasure measure = djcross.getMeasure(0);
        measureExp.setValueClassName(measure.getProperty().getValueClassName());
        measureExp.setText("$V{"+measure.getProperty().getProperty()+"}");

        element.setExpression(measureExp);

        /**
         * Is there any style for this object?
         */
        if (crosstabRow.getProperty() == null && crosstabColumn.getProperty() == null && measure.getStyle() != null ){
          //this is the inner most cell
          layoutManager.applyStyleToElement(measure.getStyle() , element);
        } else if (crosstabRow.getTotalStyle() != null) {
          layoutManager.applyStyleToElement(crosstabRow.getTotalStyle(), element);
        }
        else if (crosstabColumn.getTotalStyle() != null) {
          layoutManager.applyStyleToElement(crosstabColumn.getTotalStyle(), element);
        }

//        if ((i == auxCols.length-1 &&  j != auxRows.length-1) || (i != auxCols.length-1 &&  j != auxRows.length-1)){
//          cell.setWidth(Integer.valueOf( 100));
//        }
//        if (crosstabColumn.getProperty() != null && j != auxRows.length-1 && crosstabRow.getTotalHeaderHeight() != 0){
//          cell.setWidth(Integer.valueOf( crosstabRow.getTotalHeaderHeight() ));
//        }
//        if (i != auxCols.length-1 && j != auxRows.length-1 && crosstabRow.getTotalHeaderHeight() != 0){
//          cell.setWidth(Integer.valueOf( crosstabRow.getTotalHeaderHeight() ));
//        }


        contents.setMode(new Byte(Transparency.OPAQUE.getValue()));
        contents.setBackcolor(colors[i][j]);
        contents.addElement(element);

        applyCellBorder(contents);

        cell.setContents(contents);


        try {
          jrcross.addCell(cell);
        } catch (JRException e) {
View Full Code Here

Examples of net.sf.jasperreports.crosstabs.design.JRDesignCrosstabCell

    for (int i = auxCols.length-1; i >= 0; i--) {
      for (int j =  auxRows.length-1; j >= 0; j--) {
        DJCrosstabColumn crosstabColumn = auxCols[i];
        DJCrosstabRow crosstabRow = auxRows[j];

        JRDesignCrosstabCell cell = new JRDesignCrosstabCell();

        cell.setWidth(new Integer(crosstabColumn.getWidth()));
        cell.setHeight(new Integer(crosstabRow.getHeight()));

        if (crosstabColumn.getProperty() != null)
          cell.setColumnTotalGroup(crosstabColumn.getProperty().getProperty());

        if (crosstabRow.getProperty() != null)
          cell.setRowTotalGroup(crosstabRow.getProperty().getProperty());


        JRDesignCellContents contents = new JRDesignCellContents();


        int counter = 0;
        int measureHeight = crosstabRow.getHeight() / djcross.getMeasures().size();
        for (Iterator iterator = djcross.getMeasures().iterator(); iterator.hasNext(); counter++) {
          DJCrosstabMeasure djmeasure = (DJCrosstabMeasure) iterator.next();
         
          JRDesignTextField element = new JRDesignTextField();
          element.setWidth(crosstabColumn.getWidth());
          element.setHeight(measureHeight);
          element.setY(counter*measureHeight);
         

          JRDesignExpression measureExp = new JRDesignExpression();
//          DJCrosstabMeasure measure = djcross.getMeasure(0);
          measureExp.setValueClassName(djmeasure.getProperty().getValueClassName());
          measureExp.setText("$V{"+djmeasure.getProperty().getProperty()+"}");
         
          element.setExpression(measureExp);

          /**
           * Is there any style for this object?
           */
          if (crosstabRow.getProperty() == null && crosstabColumn.getProperty() == null && djmeasure.getStyle() != null ){
            //this is the inner most cell
            layoutManager.applyStyleToElement(djmeasure.getStyle() , element);
          } else if (crosstabRow.getTotalStyle() != null) {
            layoutManager.applyStyleToElement(crosstabRow.getTotalStyle(), element);
          }
          else if (crosstabColumn.getTotalStyle() != null) {
            layoutManager.applyStyleToElement(crosstabColumn.getTotalStyle(), element);
          }
         
          if (djmeasure.getLink() != null){
            String name = "cell_" + i + "_" +  j + "_ope" + djmeasure.getOperation().getValue();
            HyperLinkUtil.applyHyperLinkToElement((DynamicJasperDesign)this.design, djmeasure.getLink(), element, name);
          }
 
          contents.addElement(element);
         
        }
       
        contents.setMode(new Byte(Transparency.OPAQUE.getValue()));
       
        applyBackgroundColor(contents,crosstabRow,crosstabColumn,i,j);
       
        applyCellBorder(contents);

        cell.setContents(contents);


        try {
          jrcross.addCell(cell);
        } catch (JRException e) {
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.