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);
      }
    }
  }
  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);
      }
    }
  }
 public void initLayout(ITableContent table) {
   String keyString =
       context.getPageHintManager().getHintMapKey(table.getInstanceID().toUniqueString());
   this.layout = new TableContentLayout(table, getOutputFormat(), context, keyString);
   this.layoutEvents = new Stack();
   UnresolvedRowHint hint = null;
   if (isFirst) {
     if (context != null) {
       hint = context.getPageHintManager().getUnresolvedRowHint(keyString);
       isFirst = false;
     }
   }
   if (hint == null) {
     hint = hintMap.get(keyString);
   }
   layout.setUnresolvedRowHint(hint);
 }
  public void resolveAll(boolean finished) {
    layout.resolveDropCells(finished);
    UnresolvedRowHint hint = layout.getUnresolvedRow();
    if (hint != null) {
      hintMap.put(layout.getKeyString(), hint);
      if (context != null) {
        context.getPageHintManager().addUnresolvedRowHint(layout.getKeyString(), hint);
      }
    }

    hasDropCell = layout.hasDropCell();
  }
 protected boolean isContentFinished(IContent content) {
   if (context != null) {
     return context.getPageHintManager().getLayoutHint(content);
   }
   return true;
 }
 protected boolean allowPageBreak() {
   if (context != null) {
     return context.allowPageBreak();
   }
   return false;
 }