public void startCell(ICellContent cell) throws BirtException { if (cellEmitter != null) { cellEmitter.startCell(cell); } else { if (!isNestTable()) { BufferedReportEmitter buffer = null; int colId = cell.getColumn(); int colSpan = cell.getColSpan(); int rowSpan = cell.getRowSpan(); // the current executed cell is rowIndex, columnIndex // get the span value of that cell. if (cell.getGenerateBy() instanceof CellDesign) { CellDesign cellDesign = (CellDesign) cell.getGenerateBy(); if (cellDesign != null) { String dropType = cellDesign.getDrop(); if (dropType != null && !"none".equals(dropType)) // $NON-NLS-1$ { rowSpan = createDropID(getGroupLevel(), dropType); } } } // the table has no cache, the cell is the first drop or spanned cell if (!hasDropCell() && (rowSpan < 0 || rowSpan > 1)) { layoutEvents.push( new LayoutEvent( LayoutEvent.ON_FIRST_DROP_CELL, new StartInfo(layout.getRowCount() - 1, colId))); } if (hasDropCell() || rowSpan < 0 || rowSpan > 1) { buffer = new BufferedReportEmitter(emitter); cellEmitter = buffer; } // we need cache the cell createCell(colId, rowSpan, colSpan, new CellContent(cell, buffer)); if (hasDropCell()) { return; } // TODO: changes the column id and output it. emitter.startCell(layout.getWrappedCellContent(cell)); } else { emitter.startCell(cell); } } }
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); }