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

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


    //Show the current value above the column name
    int yOffset = 0;
    GroupLayout layout = group.getLayout();
    //Only the value in header
    PropertyColumn column = group.getColumnToGroupBy();

    Integer height = group.getHeaderVariablesHeight()!=null
    ? group.getHeaderVariablesHeight()
        :getReport().getOptions().getDetailHeight();
   
    //VALUE_IN_HEADER,
    //VALUE_IN_HEADER_WITH_HEADERS,
    //VALUE_IN_HEADER_AND_FOR_EACH,
    //VALUE_IN_HEADER_AND_FOR_EACH_WITH_HEADERS
    if (layout.isShowValueInHeader() && layout.isHideColumn() && !layout.isShowColumnName()){
      //textfield for the current value
      JRDesignTextField currentValue = generateTextFieldFromColumn(column, height.intValue(), group);

      //The width will be all the page
      currentValue.setWidth(getReport().getOptions().getPrintableWidth());

      //fix the height depending on the font size
//      currentValue.setHeight(FontHelper.getHeightFor(column.getStyle().getFont())); //XXX CAREFULL
      yOffset += currentValue.getHeight();

      //Move down existing elements in the band.
      LayoutUtils.moveBandsElemnts(yOffset-1, headerBand); //Don't know why, but without the "-1" it wont show the headers

      headerBand.addElement(currentValue);
    }
    //DEFAULT and DEFAULT_WITH_HEADER
    else if (layout.isShowValueInHeader() && !layout.isHideColumn() && !layout.isShowColumnName()){
      headerOffset = changeHeaderBandHeightForVariables(headerBand, group);
      insertValueInHeader(headerBand, group, headerOffset);
    }
    //VALUE_IN_HEADER_WITH_HEADERS_AND_COLUMN_NAME
    else if (layout.isShowValueInHeader() && layout.isHideColumn() && layout.isShowColumnName()){
      //Create the element for the column name
      JRDesignTextField columnNameTf = createColumnNameTextField(group, column);
      columnNameTf.setY(columnNameTf.getY() + headerOffset);

      //textfield for the current value
      JRDesignTextField currentValue = generateTextFieldFromColumn(column, height.intValue(), group);

      //The width will be (width of the page) - (column name width)
      currentValue.setWidth(getReport().getOptions().getPrintableWidth() - columnNameTf.getWidth());
      //The x position for the current value is right next to the column name
      currentValue.setX(columnNameTf.getWidth());

      //fix the height depending on the font size
      currentValue.setHeight(FontHelper.getHeightFor(column.getStyle().getFont()));
      columnNameTf.setHeight(currentValue.getHeight());

      yOffset += currentValue.getHeight();

      //Move down existing elements in the band.
View Full Code Here


        }
      }
      DJGroupLabel label = columnsGroup.getFooterLabel()
      if (label != null /*&& !footerVariables.isEmpty()*/) {
        List footerVariables = columnsGroup.getFooterVariables();
        PropertyColumn col = columnsGroup.getColumnToGroupBy();
        JRDesignBand band = (JRDesignBand)jgroup.getGroupFooter();
        int x = 0, y = 0;
        //max width
        int width = getDesign().getPageWidth() - getDesign().getLeftMargin() - getDesign().getRightMargin();
        int height = label.getHeight();
        int yOffset = 0;
        if (label.getLabelPosition() == LabelPosition.LEFT) {
          DJGroupVariable lmvar = findLeftMostColumn(footerVariables);
       
          x = col.getPosX().intValue(); //label starts in the column-to-group-by x position
          y = findYOffsetForGroupLabel(band);
          if (lmvar != null) {
            AbstractColumn lmColumn = lmvar.getColumnToApplyOperation();
            width = lmColumn.getPosX().intValue() - x;
          }
          else
            width -= x;
          height = getFooterVariableHeight(columnsGroup);
        }
        else if (label.getLabelPosition() == LabelPosition.RIGHT) {
          DJGroupVariable rmvar = findRightMostColumn(footerVariables);         
         
          if (rmvar != null) {
            AbstractColumn rmColumn = rmvar.getColumnToApplyOperation();
            x = rmColumn.getPosX().intValue() + rmColumn.getWidth().intValue();
          }
          else
            x = col.getPosX().intValue(); //label starts in the column-to-group-by x position
          y = findYOffsetForGroupLabel(band);
          width -= x;
          height = getFooterVariableHeight(columnsGroup);
        }
        else if (label.getLabelPosition() == LabelPosition.TOP) {
          x = col.getPosX().intValue(); //label starts in the column-to-group-by x position
          width -= x;
          yOffset = height;
        }
        else if (label.getLabelPosition() == LabelPosition.BOTTOM) {
          x = col.getPosX().intValue(); //label starts in the column-to-group-by x position
          y = getFooterVariableHeight(columnsGroup);
          width -= x;
        }
        layoutGroupFooterLabels(columnsGroup, jgroup, x, y, width, height);
        layoutGroupVariables(columnsGroup, jgroup, yOffset);
View Full Code Here

    //Show the current value above the column name
    int yOffset = 0;
    GroupLayout layout = group.getLayout();
    //Only the value in header
    PropertyColumn column = group.getColumnToGroupBy();

    Integer height = group.getHeaderVariablesHeight()!=null
    ? group.getHeaderVariablesHeight()
        :getReport().getOptions().getDetailHeight();
   
    //VALUE_IN_HEADER,
    //VALUE_IN_HEADER_WITH_HEADERS,
    //VALUE_IN_HEADER_AND_FOR_EACH,
    //VALUE_IN_HEADER_AND_FOR_EACH_WITH_HEADERS
    if (layout.isShowValueInHeader() && layout.isHideColumn() && !layout.isShowColumnName()){
      //textfield for the current value
      JRDesignTextField currentValue = generateTextFieldFromColumn(column, height.intValue(), group);
      currentValue.setPositionType(JRDesignElement.POSITION_TYPE_FIX_RELATIVE_TO_TOP);
     
      //The width will be all the page, except for the width of the header variables
            int headerVariablesWidth = getReport().getOptions().getPrintableWidth();
           
            if (!group.getHeaderVariables().isEmpty()){
              DJGroupVariable leftmostcol = findLeftMostColumn(group.getHeaderVariables());
              headerVariablesWidth = leftmostcol.getColumnToApplyOperation().getPosX().intValue();
              if (groupLabelsPresent(group.getHeaderVariables())){
                currentValue.setY(height.intValue());
                currentValue.setHeight(getHeaderVariablesHeight(group));
              }
            }
            currentValue.setWidth(headerVariablesWidth);
           
      //fix the height depending on the font size
//      currentValue.setHeight(FontHelper.getHeightFor(column.getStyle().getFont())); //XXX CAREFULL
      yOffset += currentValue.getHeight();

      //Move down existing elements in the band.
      LayoutUtils.moveBandsElemnts(yOffset-1, headerBand); //Don't know why, but without the "-1" it wont show the headers
     
      if (group.getLayout().isPrintHeaders()){
        headerOffset += group.getHeaderHeight().intValue() + getReport().getOptions().getDetailHeight().intValue();
      }
     
      headerBand.addElement(currentValue);
    }
    //DEFAULT and DEFAULT_WITH_HEADER
    else if (layout.isShowValueInHeader() && !layout.isHideColumn() && !layout.isShowColumnName()){
      headerOffset = changeHeaderBandHeightForVariables(headerBand, group);
      insertValueInHeader(headerBand, group, headerOffset);
    }
    //VALUE_IN_HEADER_WITH_HEADERS_AND_COLUMN_NAME
    else if (layout.isShowValueInHeader() && layout.isHideColumn() && layout.isShowColumnName()){
      //Create the element for the column name
      JRDesignTextField columnNameTf = createColumnNameTextField(group, column);
      columnNameTf.setY(columnNameTf.getY() + headerOffset);

      //textfield for the current value
      JRDesignTextField currentValue = generateTextFieldFromColumn(column, height.intValue(), group);

      //The width will be (width of the page) - (column name width)
      currentValue.setWidth(getReport().getOptions().getPrintableWidth() - columnNameTf.getWidth());
      //The x position for the current value is right next to the column name
      currentValue.setX(columnNameTf.getWidth());

      //fix the height depending on the font size
      currentValue.setHeight(FontHelper.getHeightFor(column.getStyle().getFont()));
      columnNameTf.setHeight(currentValue.getHeight());

      yOffset += currentValue.getHeight();

      //Move down existing elements in the band.
View Full Code Here

    }

    if (entity instanceof PropertyColumn) {
      try {
        //addField() will throw an exception only if the column has already been registered.
        PropertyColumn propertyColumn = ((PropertyColumn)entity);
        log.debug("registering column " + column.getName());
        if ( propertyColumn.getColumnProperty() != null && !(entity instanceof ExpressionColumn)){
          getDjd().addField((JRField)transformEntity(entity));
        }
        if (entity instanceof ExpressionColumn) {
          //The Custom Expression parameter must be registered
          ExpressionColumn expressionColumn = (ExpressionColumn) entity;
View Full Code Here

      }
    }
  }

  protected Object transformEntity(Entity entity) {
    PropertyColumn propertyColumn = (PropertyColumn) entity;
    JRDesignField field = new JRDesignField();
    ColumnProperty columnProperty = propertyColumn.getColumnProperty();
    field.setName(columnProperty.getProperty());
    field.setValueClassName(columnProperty
        .getValueClassName());
    log.debug("transforming column: " + columnProperty.getProperty() + " / " + columnProperty
        .getValueClassName());

    field.setDescription(propertyColumn.getFieldDescription()); //hack for XML data source
    Iterator iter = columnProperty.getFieldProperties().keySet().iterator();
    while (iter.hasNext()) {
      String key = (String) iter.next();
      field.getPropertiesMap().setProperty(key, (String) columnProperty.getFieldProperties().get(key));
    }
View Full Code Here

    //Show the current value above the column name
    int yOffset = 0;
    GroupLayout layout = group.getLayout();
    //Only the value in header
    PropertyColumn column = group.getColumnToGroupBy();

    //VALUE_IN_HEADER,
    //VALUE_IN_HEADER_WITH_HEADERS,
    //VALUE_IN_HEADER_AND_FOR_EACH,
    //VALUE_IN_HEADER_AND_FOR_EACH_WITH_HEADERS
    if (layout.isShowValueInHeader() && layout.isHideColumn() && !layout.isShowColumnName()){
      //textfield for the current value
      JRDesignTextField currentValue = generateTextFieldFromColumn(column, getReport().getOptions().getDetailHeight().intValue(), group);

      //The width will be all the page
      currentValue.setWidth(getReport().getOptions().getPrintableWidth());

      //fix the height depending on the font size
      currentValue.setHeight(FontHelper.getHeightFor(column.getStyle().getFont()));
      yOffset += currentValue.getHeight();

      //Move down existing elements in the band.
      LayoutUtils.moveBandsElemnts(yOffset-1, headerBand); //Don't know why, but without the "-1" it wont show the headers

      headerBand.addElement(currentValue);
    }
    //DEFAULT and DEFAULT_WITH_HEADER
    else if (layout.isShowValueInHeader() && !layout.isHideColumn() && !layout.isShowColumnName()){
      headerOffset = changeHeaderBandHeightForVariables(headerBand, group);
      insertValueInHeader(headerBand, group, headerOffset);
    }
    //VALUE_IN_HEADER_WITH_HEADERS_AND_COLUMN_NAME
    else if (layout.isShowValueInHeader() && layout.isHideColumn() && layout.isShowColumnName()){
      //Create the element for the column name
      JRDesignTextField columnNameTf = createColumnNameTextField(group, column);
      columnNameTf.setY(columnNameTf.getY() + headerOffset);

      //textfield for the current value
      JRDesignTextField currentValue = generateTextFieldFromColumn(column, getReport().getOptions().getDetailHeight().intValue(), group);

      //The width will be (width of the page) - (column name width)
      currentValue.setWidth(getReport().getOptions().getPrintableWidth() - columnNameTf.getWidth());
      //The x position for the current value is right next to the column name
      currentValue.setX(columnNameTf.getWidth());

      //fix the height depending on the font size
      currentValue.setHeight(FontHelper.getHeightFor(column.getStyle().getFont()));
      columnNameTf.setHeight(currentValue.getHeight());

      yOffset += currentValue.getHeight();

      //Move down existing elements in the band.
View Full Code Here

    //Show the current value above the column name
    int yOffset = 0;
    GroupLayout layout = group.getLayout();
    //Only the value in header
    PropertyColumn column = group.getColumnToGroupBy();

    //VALUE_IN_HEADER,
    //VALUE_IN_HEADER_WITH_HEADERS,
    //VALUE_IN_HEADER_AND_FOR_EACH,
    //VALUE_IN_HEADER_AND_FOR_EACH_WITH_HEADERS
    if (layout.isShowValueInHeader() && layout.isHideColumn() && !layout.isShowColumnName()){
      //textfield for the current value
      JRDesignTextField currentValue = generateTextFieldFromColumn(column, getReport().getOptions().getDetailHeight().intValue(), group);

      //The width will be all the page
      currentValue.setWidth(getReport().getOptions().getPrintableWidth());

      //fix the height depending on the font size
      currentValue.setHeight(FontHelper.getHeightFor(column.getStyle().getFont()));
      yOffset += currentValue.getHeight();

      //Move down existing elements in the band.
      LayoutUtils.moveBandsElemnts(yOffset-1, headerBand); //Don't know why, but without the "-1" it wont show the headers

      headerBand.addElement(currentValue);
    }
    //DEFAULT and DEFAULT_WITH_HEADER
    else if (layout.isShowValueInHeader() && !layout.isHideColumn() && !layout.isShowColumnName()){
      headerOffset = changeHeaderBandHeightForVariables(headerBand, group);
      insertValueInHeader(headerBand, group, headerOffset);
    }
    //VALUE_IN_HEADER_WITH_HEADERS_AND_COLUMN_NAME
    else if (layout.isShowValueInHeader() && layout.isHideColumn() && layout.isShowColumnName()){
      //Create the element for the column name
      JRDesignTextField columnNameTf = createColumnNameTextField(group, column);
      columnNameTf.setY(columnNameTf.getY() + headerOffset);

      //textfield for the current value
      JRDesignTextField currentValue = generateTextFieldFromColumn(column, getReport().getOptions().getDetailHeight().intValue(), group);

      //The width will be (width of the page) - (column name width)
      currentValue.setWidth(getReport().getOptions().getPrintableWidth() - columnNameTf.getWidth());
      //The x position for the current value is right next to the column name
      currentValue.setX(columnNameTf.getWidth());

      //fix the height depending on the font size
      currentValue.setHeight(FontHelper.getHeightFor(column.getStyle().getFont()));
      columnNameTf.setHeight(currentValue.getHeight());

      yOffset += currentValue.getHeight();

      //Move down existing elements in the band.
View Full Code Here

  //PropertyColumn only can be used for grouping (not OperationColumn)
  protected Object transformEntity(Entity entity) throws JRException {
    log.debug("transforming group...");
    DJGroup djgroup = (DJGroup) entity;
    PropertyColumn column = djgroup.getColumnToGroupBy();
    JRDesignGroup group = new JRDesignGroup();

    if (djgroup.getName() == null) {
      int groupIndex = getDynamicReport().getColumnsGroups().indexOf(djgroup);
      int columnIndex = getDynamicReport().getColumns().indexOf(djgroup.getColumnToGroupBy());
      if (column instanceof GlobalGroupColumn){
        djgroup.setName("global_column_" + groupIndex);
      } else {
        djgroup.setName( "group["+groupIndex+"]_for_column_" + columnIndex + "-" +  column.getName());
      }     
    }
    group.setName(djgroup.getName());
   
    getLayoutManager().getReferencesMap().put(group.getName(), djgroup);

    group.setCountVariable(new JRDesignVariable());
    group.setGroupFooter(new JRDesignBand());
    group.setGroupHeader(new JRDesignBand());

    JRDesignExpression jrExpression = new JRDesignExpression();
   
    CustomExpression expressionToGroupBy = column.getExpressionToGroupBy();
   
    if (expressionToGroupBy != null) { //new in 3.0.7-b5
      useVariableForCustomExpression(group, jrExpression, expressionToGroupBy);
     
    } else {
      if (column instanceof ExpressionColumn){
        ExpressionColumn col = (ExpressionColumn)column;
        CustomExpression customExpression = col.getExpression();
        useVariableForCustomExpression(group, jrExpression, customExpression);
      } else {
        jrExpression.setText(column.getTextForExpression());
        jrExpression.setValueClassName(column.getValueClassNameForExpression());
      }
    }
   

    group.setExpression(jrExpression);
View Full Code Here

      DJGroup djgroup = groupVariable.getGroup();
      registeredGroup = LayoutUtils.findParentJRGroup(djgroup, getDynamicReport(), getDjd(), getLayoutManager());
    }
    else {
      if (col.getTextFormatter() != null){
        PropertyColumn pcol = (PropertyColumn) col;
        expression.setText("$F{" + pcol.getColumnProperty().getProperty() + "}");
        expression.setValueClassName(pcol.getColumnProperty().getValueClassName());
      } else {
        expression.setText(col.getTextForExpression());
        expression.setValueClassName(col.getValueClassNameForExpression());
      }
    }
View Full Code Here

    }

    if (entity instanceof PropertyColumn) {
      try {
        //addField() will throw an exception only if the column has already been registered.
        PropertyColumn propertyColumn = ((PropertyColumn)entity);
        log.debug("registering column " + column.getName());
        if ( propertyColumn.getColumnProperty() != null && !(entity instanceof ExpressionColumn)){
          JRField jrfield = (JRField)transformEntity(entity);
          if (getDjd().getFieldsMap().get(jrfield.getName())==null){
            getDjd().addField(jrfield);
          }         
        }
View Full Code Here

TOP

Related Classes of ar.com.fdvs.dj.domain.entities.columns.PropertyColumn

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.