Package ar.com.fdvs.dj.domain

Examples of ar.com.fdvs.dj.domain.Style


   * @throws JRException
   */
  protected void ensureDJStyles()  {
    //first of all, register all parent styles if any
    for (Iterator iterator = getReport().getStyles().values().iterator(); iterator.hasNext();) {
      Style style = (Style) iterator.next();
      addStyleToDesign(style);
    }

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


      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

    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);
            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 {
          if (getReport().getOptions().isPrintBackgroundOnOddRows() &&
              (jrstyle.getConditionalStyles() == null || jrstyle.getConditionalStyles().length == 0)) {
            // No group column so this is a detail text field
          JRDesignExpression expression = new JRDesignExpression();
          expression.setValueClass(Boolean.class);
          expression.setText(EXPRESSION_TRUE_WHEN_ODD);

          Style oddRowBackgroundStyle = getReport().getOptions().getOddRowBackgroundStyle();

          JRDesignConditionalStyle condStyle = new JRDesignConditionalStyle();
          condStyle.setBackcolor(oddRowBackgroundStyle.getBackgroundColor());
          condStyle.setMode(JRDesignElement.MODE_OPAQUE);

          condStyle.setConditionExpression(expression);
          jrstyle.addConditionalStyle(condStyle);
          }
View Full Code Here

        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 {
          //Last resource is tu use the column style, but a copy of it because
          //the one in the internal cache can get modified by the layout manager (like in the odd row case)
          Style style = col.getStyle();
          try {
            style = (Style) BeanUtils.cloneBean(style);
            style.setName(null); //set to null to make applyStyleToElement(...) assign a name
          } catch (Exception e) {  }
          applyStyleToElement(style, textField);
        }

View Full Code Here

    super();

    if (blank)
      style = Style.createBlankStyle(null);
    else
      style = new Style();

  }
View Full Code Here

   * Creates the graphic element to be shown when the datasource is empty
   */
  protected void setWhenNoDataBand() {
    log.debug("setting up WHEN NO DATA band");
    String whenNoDataText = getReport().getWhenNoDataText();
    Style style = getReport().getWhenNoDataStyle();
    if (whenNoDataText == null || "".equals(whenNoDataText))
      return;
    JRDesignBand band = new JRDesignBand();
    getDesign().setNoData(band);

View Full Code Here

   * @throws JRException
   */
  protected void ensureDJStyles()  {
    //first of all, register all parent styles if any
    for (Iterator iterator = getReport().getStyles().values().iterator(); iterator.hasNext();) {
      Style style = (Style) iterator.next();
      addStyleToDesign(style);
    }

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

      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

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

    if (getReport().getOptions().isPrintBackgroundOnOddRows() && Utils.isEmpty(column.getConditionalStyles())){
        JRDesignExpression expression = new JRDesignExpression();
        expression.setValueClass(Boolean.class);
        expression.setText(EXPRESSION_TRUE_WHEN_ODD);

        Style oddRowBackgroundStyle = getReport().getOptions().getOddRowBackgroundStyle();

        JRDesignConditionalStyle condStyle = new JRDesignConditionalStyle();
        condStyle.setBackcolor(oddRowBackgroundStyle.getBackgroundColor());
        condStyle.setMode(JRDesignElement.MODE_OPAQUE);

        condStyle.setConditionExpression(expression);
        jrstyle.addConditionalStyle(condStyle);
       
        return;
    }
     
    if (Utils.isEmpty(column.getConditionalStyles()))
      return;
   
    for (Iterator iterator = column.getConditionalStyles().iterator(); iterator.hasNext();) {
      ConditionalStyle condition = (ConditionalStyle) iterator.next();
     
      if (getReport().getOptions().isPrintBackgroundOnOddRows()
          && JRDesignElement.MODE_TRANSPARENT == jrstyle.getMode().byteValue() ){//condition style + odd row (only if original background is transparent)
       
        JRDesignExpression expressionForConditionalStyle = getExpressionForConditionalStyle(condition, column);
        String expStr = JRExpressionUtil.getExpressionText(expressionForConditionalStyle);
       
        //ODD
        JRDesignExpression expressionOdd = new JRDesignExpression();
        expressionOdd.setValueClass(Boolean.class);
        expressionOdd.setText("new java.lang.Boolean(" +EXPRESSION_TRUE_WHEN_ODD+".booleanValue() && ((java.lang.Boolean)" + expStr + ").booleanValue() )");

        Style oddRowBackgroundStyle = getReport().getOptions().getOddRowBackgroundStyle();

        JRDesignConditionalStyle condStyleOdd = new JRDesignConditionalStyle();
        Utils.copyProperties(condStyleOdd, condition.getStyle().transform());
        condStyleOdd.setBackcolor(oddRowBackgroundStyle.getBackgroundColor());
        condStyleOdd.setMode(JRDesignElement.MODE_OPAQUE);
        condStyleOdd.setConditionExpression(expressionOdd);
       
        jrstyle.addConditionalStyle(condStyleOdd)
       
        //EVEN
        JRDesignExpression expressionEven = new JRDesignExpression();
        expressionEven.setValueClass(Boolean.class);
        expressionEven.setText("new java.lang.Boolean(" +EXPRESSION_TRUE_WHEN_EVEN+".booleanValue() && ((java.lang.Boolean)" + expStr + ").booleanValue() )");

        JRDesignConditionalStyle condStyleEven = new JRDesignConditionalStyle();
        Utils.copyProperties(condStyleEven, condition.getStyle().transform());
        condStyleEven.setBackcolor(jrstyle.getBackcolor());
        condStyleEven.setMode(jrstyle.getMode());
        condStyleEven.setConditionExpression(expressionEven);
       
        jrstyle.addConditionalStyle(condStyleEven);       
       
       
       
      } else { //No odd row, just the conditional style
        JRDesignExpression expression = getExpressionForConditionalStyle(condition, column);
        JRDesignConditionalStyle condStyle = new JRDesignConditionalStyle();
        condStyle.setConditionExpression(expression);
        jrstyle.addConditionalStyle(condStyle);           
      }
     
    }
   
    //The last condition is the basic one
    //ODD
    JRDesignExpression expressionOdd = new JRDesignExpression();
    expressionOdd.setValueClass(Boolean.class);
    expressionOdd.setText(EXPRESSION_TRUE_WHEN_ODD);

    Style oddRowBackgroundStyle = getReport().getOptions().getOddRowBackgroundStyle();

    JRDesignConditionalStyle condStyleOdd = new JRDesignConditionalStyle();
    condStyleOdd.setBackcolor(oddRowBackgroundStyle.getBackgroundColor());
    condStyleOdd.setMode(JRDesignElement.MODE_OPAQUE);
    condStyleOdd.setConditionExpression(expressionOdd);
   
    jrstyle.addConditionalStyle(condStyleOdd)
   
View Full Code Here

TOP

Related Classes of ar.com.fdvs.dj.domain.Style

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.