Examples of JRDesignTextField


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

  }

  public static void addCreationDate(int yOffset, final JasperDesign design, final DynamicReport report, JRDesignBand band,  AutoText autoText) {
    int height = autoText.getHeight().intValue();

    JRDesignTextField dateTf = new JRDesignTextField();

    dateTf.setExpression(AutoTextExpressionUtils.getDateExpression(KEY_autotext_created_on, "", report.getReportLocale(),autoText.getPattern()));
    dateTf.setHeight(height);
    if (AutoText.WIDTH_NOT_SET.equals(autoText.getWidth())){
      dateTf.setWidth(report.getOptions().getPrintableWidth());
    } else {
      dateTf.setWidth(autoText.getWidth().intValue());
    }   
    dateTf.setHorizontalAlignment(autoText.getAlignment().getAlignment());
    dateTf.setY(yOffset);
    dateTf.setPositionType(JRDesignTextField.POSITION_TYPE_FLOAT);

    autoText.getAlignment().align(report.getOptions().getPrintableWidth(), 0, band, dateTf);
    band.setHeight(band.getHeight() + height);

  }
View Full Code Here

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

   * @param left
   */
  public static void addMessage(int yOffset, JasperDesign design, DynamicReport report, JRDesignBand band, AutoText autoText) {
    int height = autoText.getHeight().intValue();

    JRDesignTextField textfield = new JRDesignTextField();
    JRDesignExpression expression = new JRDesignExpression();
    expression.setValueClass(String.class);
    expression.setText( "\"" + autoText.getMessageKey() + "\"");
    textfield.setExpression(expression);
    textfield.setHeight(autoText.getHeight().intValue());
    textfield.setStyledText(true);
    if (AutoText.WIDTH_NOT_SET.equals(autoText.getWidth())){
      textfield.setWidth(report.getOptions().getPrintableWidth());
    } else {
      textfield.setWidth(autoText.getWidth().intValue());
    }
    textfield.setY(yOffset);
    autoText.getAlignment().align(report.getOptions().getPrintableWidth(), 0, band, textfield);

    textfield.setHorizontalAlignment(autoText.getAlignment().getAlignment());

    band.setHeight(band.getHeight() + height);

  }
View Full Code Here

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

    if (whenNoDataText == null || "".equals(whenNoDataText))
      return;
    JRDesignBand band = new JRDesignBand();
    getDesign().setNoData(band);

    JRDesignTextField text = new JRDesignTextField();
    JRDesignExpression expression = ExpressionUtils.createStringExpression("\""+whenNoDataText+"\"");
    text.setExpression(expression);

    if (style == null){
      style = getReport().getOptions().getDefaultDetailStyle();
    }

    if (getReport().isWhenNoDataShowTitle())
      LayoutUtils.copyBandElements(band, getDesign().getPageHeader());
    if (getReport().isWhenNoDataShowColumnHeader())
      LayoutUtils.copyBandElements(band, getDesign().getColumnHeader());

    int offset = LayoutUtils.findVerticalOffset(band);
    text.setY(offset);
    applyStyleToElement(style, text);
    text.setWidth(getReport().getOptions().getPrintableWidth());
    text.setHeight(50);
    band.addElement(text);
    log.debug("OK setting up WHEN NO DATA band");

  }
View Full Code Here

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, column));
            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()) //TODO Re check if this condition is ok
        textField.setBlankWhenNull(true);
    }
//    return jrstyle;
    return;
  }
View Full Code Here

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

   * @param int height
   * @param DJGroup group
   * @return JRDesignTextField
   */
  protected JRDesignTextField generateTextFieldFromColumn(AbstractColumn col, int height, DJGroup 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);
        JRDesignStyle jrstyle = (JRDesignStyle) textField.getStyle();

        if (group != null) {
          int index = getReport().getColumnsGroups().indexOf(group);
//            JRDesignGroup previousGroup = (JRDesignGroup) getDesign().getGroupsList().get(index);
            JRDesignGroup previousGroup = getJRGroupFromDJGroup(group);
            textField.setPrintWhenGroupChanges(previousGroup);

            /**
             * Since a group column can share the style with non group columns, if oddRow coloring is enabled,
             * we modified this shared style to have a colored background on odd rows. We dont want that for group
             * columns, that's why we create our own style from the existing one, and remove proper odd-row conditional
             * style if present
             */
            JRDesignStyle groupStyle = new JRDesignStyle();
            try {
              if (jrstyle != null)
                BeanUtils.copyProperties(groupStyle, jrstyle);
      } catch (Exception e) {
        throw new DJException("Could not copy properties for shared group style: " + e.getMessage(),e);
      }

      groupStyle.setName(groupStyle.getFontName() +"_for_group_"+index);
      textField.setStyle(groupStyle);
      try {
        design.addStyle(groupStyle);
      } catch (JRException e) { /**e.printStackTrace(); //Already there, nothing to do **/}

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