예제 #1
0
파일: EffRow.java 프로젝트: JuliaIva/hq
 /**
  * Returns the break class for this row. This is a combination of break-after set on the last
  * children of any cells ending on this row.
  *
  * <p><strong>Note:</strong> this method doesn't take into account break-after set on the
  * enclosing fo:table-row element, if any, as it must be ignored if the row belongs to a group of
  * spanned rows (see XSL-FO 1.1, 7.20.1).
  *
  * <p><strong>Note:</strong> this works only after getNextKuthElements on the corresponding
  * TableCellLM have been called!
  *
  * @return one of {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN}, {@link
  *     Constants#EN_PAGE}, {@link Constants#EN_EVEN_PAGE}, {@link Constants#EN_ODD_PAGE}
  */
 public int getBreakAfter() {
   int breakAfter = Constants.EN_AUTO;
   for (Iterator iter = gridUnits.iterator(); iter.hasNext(); ) {
     GridUnit gu = (GridUnit) iter.next();
     if (!gu.isEmpty() && gu.getColSpanIndex() == 0 && gu.isLastGridUnitRowSpan()) {
       breakAfter = BreakUtil.compareBreakClasses(breakAfter, gu.getPrimary().getBreakAfter());
     }
   }
   return breakAfter;
 }
예제 #2
0
파일: EffRow.java 프로젝트: JuliaIva/hq
 /**
  * Returns the break class for this row. This is a combination of break-before set on the first
  * children of any cells starting on this row.
  *
  * <p><strong>Note:</strong> this method doesn't take into account break-before set on the
  * enclosing fo:table-row element, if any, as it must be ignored if the row belongs to a group of
  * spanned rows (see XSL-FO 1.1, 7.20.2).
  *
  * <p><strong>Note:</strong> this works only after getNextKuthElements on the corresponding
  * TableCellLM have been called!
  *
  * @return one of {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN}, {@link
  *     Constants#EN_PAGE}, {@link Constants#EN_EVEN_PAGE}, {@link Constants#EN_ODD_PAGE}
  */
 public int getBreakBefore() {
   int breakBefore = Constants.EN_AUTO;
   for (Iterator iter = gridUnits.iterator(); iter.hasNext(); ) {
     GridUnit gu = (GridUnit) iter.next();
     if (gu.isPrimary()) {
       breakBefore = BreakUtil.compareBreakClasses(breakBefore, gu.getPrimary().getBreakBefore());
     }
   }
   return breakBefore;
 }
예제 #3
0
  /** {@inheritDoc} */
  @Override
  public List getNextKnuthElements(final LayoutContext context, final int alignment) {

    final List returnList = new LinkedList();

    /*
     * Compute the IPD and adjust it if necessary (overconstrained)
     */
    this.referenceIPD = context.getRefIPD();
    if (getTable().getInlineProgressionDimension().getOptimum(this).getEnum() != EN_AUTO) {
      final int contentIPD =
          getTable().getInlineProgressionDimension().getOptimum(this).getLength().getValue(this);
      updateContentAreaIPDwithOverconstrainedAdjust(contentIPD);
    } else {
      if (!getTable().isAutoLayout()) {
        final BlockLevelEventProducer eventProducer =
            BlockLevelEventProducer.Provider.get(getTable().getUserAgent().getEventBroadcaster());
        eventProducer.tableFixedAutoWidthNotSupported(this, getTable().getLocator());
      }
      updateContentAreaIPDwithOverconstrainedAdjust();
    }
    final int sumOfColumns = this.columns.getSumOfColumnWidths(this);
    if (!this.autoLayout && sumOfColumns > getContentAreaIPD()) {
      log.debug(
          FONode.decorateWithContextInfo(
              "The sum of all column widths is larger than the specified table width.",
              getTable()));
      updateContentAreaIPDwithOverconstrainedAdjust(sumOfColumns);
    }
    final int availableIPD = this.referenceIPD - getIPIndents();
    if (getContentAreaIPD() > availableIPD) {
      final BlockLevelEventProducer eventProducer =
          BlockLevelEventProducer.Provider.get(getTable().getUserAgent().getEventBroadcaster());
      eventProducer.objectTooWide(
          this,
          getTable().getName(),
          getContentAreaIPD(),
          context.getRefIPD(),
          getTable().getLocator());
    }

    /*
     * initialize unit to determine computed values for
     * proportional-column-width()
     */
    if (this.tableUnit == 0.0) {
      this.tableUnit = this.columns.computeTableUnit(this);
    }

    if (!this.firstVisibleMarkServed) {
      addKnuthElementsForSpaceBefore(returnList, alignment);
    }

    if (getTable().isSeparateBorderModel()) {
      addKnuthElementsForBorderPaddingBefore(returnList, !this.firstVisibleMarkServed);
      this.firstVisibleMarkServed = true;
      // Border and padding to be repeated at each break
      // This must be done only in the separate-border model, as in
      // collapsing
      // tables have no padding and borders are determined at the cell
      // level
      addPendingMarks(context);
    }

    // Elements for the table-header/footer/body
    List contentKnuthElements;
    this.contentLM = new TableContentLayoutManager(this);
    final LayoutContext childLC = new LayoutContext(0);
    /*
     * childLC.setStackLimit( MinOptMax.subtract(context.getStackLimit(),
     * stackSize));
     */
    childLC.setRefIPD(context.getRefIPD());
    childLC.copyPendingMarksFrom(context);

    contentKnuthElements = this.contentLM.getNextKnuthElements(childLC, alignment);
    // Set index values on elements coming from the content LM
    final Iterator iter = contentKnuthElements.iterator();
    while (iter.hasNext()) {
      final ListElement el = (ListElement) iter.next();
      notifyPos(el.getPosition());
    }
    // TODO fixme : don't toString() a list...
    log.debug(contentKnuthElements.toString());
    wrapPositionElements(contentKnuthElements, returnList);

    context.updateKeepWithPreviousPending(getKeepWithPrevious());
    context.updateKeepWithPreviousPending(childLC.getKeepWithPreviousPending());

    context.updateKeepWithNextPending(getKeepWithNext());
    context.updateKeepWithNextPending(childLC.getKeepWithNextPending());

    if (getTable().isSeparateBorderModel()) {
      addKnuthElementsForBorderPaddingAfter(returnList, true);
    }
    addKnuthElementsForSpaceAfter(returnList, alignment);

    if (!context.suppressBreakBefore()) {
      // addKnuthElementsForBreakBefore(returnList, context);
      final int breakBefore =
          BreakUtil.compareBreakClasses(getTable().getBreakBefore(), childLC.getBreakBefore());
      if (breakBefore != Constants.EN_AUTO) {
        returnList.add(
            0,
            new BreakElement(
                getAuxiliaryPosition(), 0, -KnuthElement.INFINITE, breakBefore, context));
      }
    }

    // addKnuthElementsForBreakAfter(returnList, context);
    final int breakAfter =
        BreakUtil.compareBreakClasses(getTable().getBreakAfter(), childLC.getBreakAfter());
    if (breakAfter != Constants.EN_AUTO) {
      returnList.add(
          new BreakElement(getAuxiliaryPosition(), 0, -KnuthElement.INFINITE, breakAfter, context));
    }

    setFinished(true);
    resetSpaces();
    return returnList;
  }