Examples of JRDesignTextField


Examples of net.sf.jasperreports.engine.design.JRDesignTextField

       */
      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);
          if (textField.getExpression() != null)
            detail.addElement(textField);
        }
      }

        }
View Full Code Here

Examples of net.sf.jasperreports.engine.design.JRDesignTextField

      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();
View Full Code Here

Examples of net.sf.jasperreports.engine.design.JRDesignTextField

        textField.setStretchType(style.getStreching().getValue());
      textField.setPositionType(JRTextField.POSITION_TYPE_FLOAT);

    }
    if (designElemen instanceof JRDesignTextField ) {
      JRDesignTextField textField = (JRDesignTextField) designElemen;
      textField.setStretchWithOverflow(style.isStretchWithOverflow());

      if (textField.isBlankWhenNull() == false && style.isBlankWhenNull())
        textField.setBlankWhenNull(true);
    }
  }
View Full Code Here

Examples of net.sf.jasperreports.engine.design.JRDesignTextField

   * @param int height
   * @param ColumnsGroup group
   * @return JRDesignTextField
   */
  protected final JRDesignTextField generateTextFieldFromColumn(AbstractColumn col, int height, ColumnsGroup group) {
    JRDesignTextField textField = new JRDesignTextField();
    JRDesignExpression exp = new JRDesignExpression();

    if (col.getPattern() != null && "".equals(col.getPattern().trim())) {
      textField.setPattern(col.getPattern());
        }

    exp.setText(col.getTextForExpression());
    exp.setValueClassName(col.getValueClassNameForExpression());
    textField.setExpression(exp);
    textField.setWidth(col.getWidth().intValue());
    textField.setX(col.getPosX().intValue());
    textField.setY(col.getPosY().intValue());
    textField.setHeight(height);

    textField.setBlankWhenNull(col.getBlankWhenNull());

    textField.setPattern(col.getPattern());

    textField.setPrintRepeatedValues(col.getPrintRepeatedValues().booleanValue());

        textField.setPrintWhenDetailOverflows(true);

        Style columnStyle = col.getStyle();
        if (columnStyle == null)
          columnStyle = report.getOptions().getDefaultDetailStyle();

    applyStyleToElement(columnStyle, textField);

        if (group != null) {
          int index = getReport().getColumnsGroups().indexOf(group);
            JRDesignGroup previousGroup = (JRDesignGroup) getDesign().getGroupsList().get(index);
            textField.setPrintWhenGroupChanges(previousGroup);
        }
        return textField;
  }
View Full Code Here

Examples of net.sf.jasperreports.engine.design.JRDesignTextField

                field.setValueClass(Object.class);
            }
            templateDesign.addField(field);

            // Add a Header Field to the headerBand
            JRDesignTextField colHeaderField = new JRDesignTextField();
            colHeaderField.setX(headerPosX);
            colHeaderField.setY(headerPosY);
            colHeaderField.setWidth(columnWidth);
            colHeaderField.setHeight(headerHeight);
            colHeaderField.setHorizontalAlignment(HorizontalAlignEnum.LEFT);
            colHeaderField.setStyle(columnHeaderStyle);
            colHeaderField.setStretchWithOverflow(true);
            colHeaderField.setStretchType(StretchTypeEnum.RELATIVE_TO_TALLEST_OBJECT);

            JRDesignExpression headerExpression = new JRDesignExpression();
            headerExpression.setText('"' + columnName + '"');
            colHeaderField.setExpression(headerExpression);
            headerBand.addElement(colHeaderField);

            // Add fields to the detailBand
            if (this.converters.isEmpty()) {
                // if no converters are used, create a field depending on the type
                JRDesignElement designElement;
                if (RenderedImage.class.isAssignableFrom(valueClass)) {
                    designElement = createImageElement(templateDesign, columnName);
                    addElement(detailBand, designElement, detailPosX, detailPosY,
                            columnWidth, detailHeight, columnDetailStyle);
                } else {
                    JRDesignTextField textField = createTextField(columnName);
                    addElement(detailBand, textField, detailPosX, detailPosY,
                            columnWidth, detailHeight, columnDetailStyle);
                }
            } else {
                // image element
                JRDesignElement imageElement = createImageElement(templateDesign, columnName);
                // condition: use this element for images
                JRDesignExpression printWhenExpression = new JRDesignExpression();
                printWhenExpression.setText("new Boolean($F{" + columnName + "}.getClass().equals(java.awt.image.BufferedImage.class))");
                imageElement.setPrintWhenExpression(printWhenExpression);

                addElement(detailBand, imageElement, detailPosX, detailPosY,
                        columnWidth, detailHeight, columnDetailStyle);

                // text field element
                JRDesignTextField textField = createTextField(columnName);
                // condition: use this element for non-images
                printWhenExpression = new JRDesignExpression();
                printWhenExpression.setText("new Boolean(!$F{" + columnName + "}.getClass().equals(java.awt.image.BufferedImage.class))");
                textField.setPrintWhenExpression(printWhenExpression);

                addElement(detailBand, textField, detailPosX, detailPosY,
                        columnWidth, detailHeight, columnDetailStyle);
            }
View Full Code Here

Examples of net.sf.jasperreports.engine.design.JRDesignTextField

        }
        return this.jasperReportBuilder.compileJasperReport(buildFile, jrxmlFile).getAbsolutePath();
    }

    private JRDesignTextField createTextField(final String columnName) {
        JRDesignTextField textField = new JRDesignTextField();
        textField.setHorizontalAlignment(HorizontalAlignEnum.LEFT);
        JRDesignExpression expression = new JRDesignExpression();
        expression.setText("$F{" + columnName + "}");
        textField.setExpression(expression);
        textField.setStretchWithOverflow(true);
        return textField;
    }
View Full Code Here

Examples of net.sf.jasperreports.engine.design.JRDesignTextField

    contents.setBackcolor(colors[colors.length-1][colors[0].length-1]);
    contents.setMode(new Byte(Transparency.OPAQUE.getValue()));

    jrcross.setHeaderCell(contents);

    JRDesignTextField element = new JRDesignTextField();
    String text = "";
    int auxHeight = 0;
    int auxWidth = 0;

    if (djcross.isAutomaticTitle())
      text = createAutomaticMainHeaderTitle();
    else if (djcross.getMainHeaderTitle() != null)
      text = "\"" + djcross.getMainHeaderTitle() "\"";

    for (Iterator iterator = djcross.getColumns().iterator(); iterator.hasNext();) {
      DJCrosstabColumn col = (DJCrosstabColumn) iterator.next();
      auxHeight += col.getHeaderHeight();
    }
    for (Iterator iterator = djcross.getRows().iterator(); iterator.hasNext();) {
      DJCrosstabRow row = (DJCrosstabRow) iterator.next();
      auxWidth += row.getHeaderWidth();
    }

    JRDesignExpression exp = ExpressionUtils.createStringExpression(text);
    element.setExpression(exp);

    element.setWidth(auxWidth);
    element.setHeight(auxHeight);
    element.setStretchWithOverflow(true);

    if (djcross.getHeaderStyle() != null)
      layoutManager.applyStyleToElement(djcross.getHeaderStyle(), element);

    applyCellBorder(contents);
View Full Code Here

Examples of net.sf.jasperreports.engine.design.JRDesignTextField

          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 ){
View Full Code Here

Examples of net.sf.jasperreports.engine.design.JRDesignTextField

      JRDesignExpression bucketExp = ExpressionUtils.createExpression("$F{"+crosstabRow.getProperty().getProperty()+"}", crosstabRow.getProperty().getValueClassName());
      rowBucket.setExpression(bucketExp);


      JRDesignCellContents rowHeaderContents = new JRDesignCellContents();
      JRDesignTextField rowTitle = new JRDesignTextField();

      JRDesignExpression rowTitExp = new JRDesignExpression();
      rowTitExp.setValueClassName(crosstabRow.getProperty().getValueClassName());
      rowTitExp.setText("$V{"+crosstabRow.getProperty().getProperty()+"}");

      rowTitle.setExpression(rowTitExp);
      rowTitle.setWidth(crosstabRow.getHeaderWidth());

      //The width can be the sum of the with of all the rows starting from the current one, up to the inner most one.
      int auxHeight = getRowHeaderMaxHeight(crosstabRow);
//      int auxHeight = crosstabRow.getHeight(); //FIXME getRowHeaderMaxHeight() must be FIXED because it breaks when 1rs row sho total and 2nd doesnt
      rowTitle.setHeight(auxHeight);


      if (crosstabRow.getHeaderStyle() != null)
        layoutManager.applyStyleToElement(crosstabRow.getHeaderStyle(), rowTitle);
View Full Code Here

Examples of net.sf.jasperreports.engine.design.JRDesignTextField

      bucket.setExpression(bucketExp);

      ctColGroup.setBucket(bucket);

      JRDesignCellContents colHeaerContent = new JRDesignCellContents();
      JRDesignTextField colTitle = new JRDesignTextField();

      JRDesignExpression colTitleExp = new JRDesignExpression();
      colTitleExp.setValueClassName(crosstabColumn.getProperty().getValueClassName());
      colTitleExp.setText("$V{"+crosstabColumn.getProperty().getProperty()+"}");


      colTitle.setExpression(colTitleExp);
      colTitle.setWidth(crosstabColumn.getWidth());
      colTitle.setHeight(crosstabColumn.getHeaderHeight());

      //The height can be the sum of the heights of all the columns starting from the current one, up to the inner most one.
      int auxWidth = calculateRowHeaderMaxWidth(crosstabColumn);
      colTitle.setWidth(auxWidth);

      if (crosstabColumn.getHeaderStyle() != null)
        layoutManager.applyStyleToElement(crosstabColumn.getHeaderStyle(),colTitle);

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.