protected IRowContent createRowContent(IReportContent report, int cellNumber) {
   IRowContent row = report.createRowContent();
   for (int i = 0; i < cellNumber; i++) {
     ICellContent cell = createCellContent(report, 1, 1);
     row.getChildren().add(cell);
     cell.setParent(row);
   }
   return row;
 }
 protected ITableContent createTableContent(IReportContent report, int colNumber, int rowCount) {
   ITableContent table = report.createTableContent();
   for (int i = 0; i < rowCount; i++) {
     ITableBandContent band = report.createTableBandContent();
     band.setBandType(ITableBandContent.BAND_DETAIL);
     IRowContent row = createRowContent(report, colNumber);
     band.getChildren().add(row);
     row.setParent(band);
     table.getChildren().add(band);
     band.setParent(table);
   }
   return table;
 }
  public void endRow(IRowContent row) throws BirtException {
    if (cellEmitter != null) {
      cellEmitter.endRow(row);
    } else {
      if (!isNestTable()) {
        layout.endRow(row);
        lastRowId = row.getRowID();
        hasDropCell = layout.hasDropCell();
        if (hasDropCell()) {
          return;
        }
        if (layoutEvents.size() > 0) {
          flush();
          return;
        }
      }
      // For fixed layout reports and in run task, we need to emit the
      // invisible content to PDF layout engine.
      boolean hiddenMask =
          context.isFixedLayout()
              && (Integer) context.getLayoutEngine().getOption(EngineTask.TASK_TYPE)
                  == IEngineTask.TASK_RUN;
      boolean isHidden =
          LayoutUtil.isHidden(
              row, emitter.getOutputFormat(), context.getOutputDisplayNone(), hiddenMask);

      if (!isHidden) {
        emitter.endRow(row);
      }
    }
  }
Example #4
0
  private void refineBandContent(ITableBandContent content) {
    if (isHeaderRefined) return;

    Collection children = content.getChildren();
    ArrayList removed = new ArrayList();
    if (children != null) {
      Iterator itr = children.iterator();
      while (itr.hasNext()) {
        IRowContent rowContent = (IRowContent) itr.next();
        RowDesign rowDesign = (RowDesign) rowContent.getGenerateBy();
        if (rowDesign != null && !rowDesign.getRepeatable()) {
          removed.add(rowContent);
        }
      }
      children.removeAll(removed);
    }
    isHeaderRefined = true;
  }
  protected void flushRow(int rowId, int colId, boolean withStart) throws BirtException {
    int colCount = layout.getColCount();
    int columnId = layout.getColumnId(colId);
    Row row = layout.getRow(rowId);
    IRowContent rowContent = (IRowContent) row.getContent();
    if (withStart) {
      emitter.startRow(rowContent);
    }
    for (int j = columnId; j < colCount; j++) {
      Cell cell = row.getCell(j);
      if (cell.getStatus() == Cell.CELL_USED) {
        CellContent content = (CellContent) cell.getContent();
        CellContentWrapper tempCell = new CellContentWrapper(content.cell);
        tempCell.setColumn(cell.getColId());
        tempCell.setRowSpan(cell.getRowSpan());
        tempCell.setColSpan(cell.getColSpan());

        emitter.startCell(tempCell);
        if (content.buffer != null) {
          content.buffer.flush();
        }
        emitter.endCell(tempCell);
      }
      if (cell.getStatus() == Cell.CELL_EMPTY) {
        IReportContent report = rowContent.getReportContent();
        ICellContent cellContent = report.createCellContent();
        cellContent.setParent(rowContent);
        cellContent.setColumn(cell.getColId() + 1);
        cellContent.setRowSpan(cell.getRowSpan());
        cellContent.setColSpan(cell.getColSpan());
        emitter.startCell(cellContent);
        emitter.endCell(cellContent);
      }
    }
    emitter.endRow(rowContent);
  }
  public void startRow(IRowContent row) throws BirtException {
    if (cellEmitter != null) {
      cellEmitter.startRow(row);
    } else {
      // For fixed layout reports and in run task, we need to emit the
      // invisible content to PDF layout engine.
      boolean hiddenMask =
          context.isFixedLayout()
              && (Integer) context.getLayoutEngine().getOption(EngineTask.TASK_TYPE)
                  == IEngineTask.TASK_RUN;
      boolean isHidden =
          LayoutUtil.isHidden(
              row, emitter.getOutputFormat(), context.getOutputDisplayNone(), hiddenMask);

      if (!isNestTable()) {
        int rowId = row.getRowID();
        if (lastRowId >= 0 && rowId > lastRowId + 1) {
          for (int i = lastRowId + 1; i < rowId; i++) {
            IRowContent newRow = (IRowContent) row.cloneContent(false);
            newRow.setParent(row.getParent());
            newRow.setRowID(i);
            startRow(newRow);
            endRow(newRow);
          }
        }
        layout.createRow(row, isHidden);
        if (!isHidden) {
          if (hasDropCell()) {
            layoutEvents.push(
                new LayoutEvent(LayoutEvent.ON_ROW, new StartInfo(layout.getRowCount() - 1, 0)));
            return;
          } else if (layout.hasUnResolvedRow() && !LayoutUtil.isRepeatableRow(row)) {
            layoutEvents.push(
                new LayoutEvent(LayoutEvent.ON_ROW, new StartInfo(layout.getRowCount() - 1, 0)));
            hasDropCell = true;
            return;
          }
        }

        // TODO: here we need handle the hidden row and change the row
        // id.
      }
      if (!isHidden) {
        emitter.startRow(row);
      }
    }
  }