Пример #1
0
 /** {@inheritDoc} */
 @Override
 public InlineArea get(final LayoutContext context) {
   // Create a zero-width, zero-height dummy area so this node can
   // participate in the ID handling. Otherwise, addId() wouldn't
   // be called. The area must also be added to the tree, because
   // determination of the X,Y position is done in the renderer.
   final InlineArea area = new InlineArea();
   if (this.fobj.hasId()) {
     TraitSetter.setProducerID(area, this.fobj.getId());
   }
   return area;
 }
Пример #2
0
  /**
   * Return an Area which can contain the passed childArea. The childArea may not yet have any
   * content, but it has essential traits set. In general, if the LayoutManager already has an Area
   * it simply returns it. Otherwise, it makes a new Area of the appropriate class. It gets a parent
   * area for its area by calling its parent LM. Finally, based on the dimensions of the parent
   * area, it initializes its own area. This includes setting the content IPD and the maximum BPD.
   *
   * @param childArea the child area
   * @return the parent area of the child
   */
  @Override
  public Area getParentArea(final Area childArea) {
    if (this.curBlockArea == null) {
      this.curBlockArea = new Block();
      // Set up dimensions
      // Must get dimensions from parent area
      /* Area parentArea = */ this.parentLayoutManager.getParentArea(this.curBlockArea);

      TraitSetter.setProducerID(this.curBlockArea, getTable().getId());

      this.curBlockArea.setIPD(getContentAreaIPD());

      setCurrentArea(this.curBlockArea);
    }
    return this.curBlockArea;
  }
Пример #3
0
 /**
  * Add the area for this layout manager. This adds the dummy area to the parent, *if* it has an id
  * - otherwise it serves no purpose.
  *
  * @param posIter the position iterator
  * @param context the layout context for adding the area
  */
 @Override
 public void addAreas(final PositionIterator posIter, final LayoutContext context) {
   if (this.fobj.hasId()) {
     addId();
     if (this.parentLayoutManager instanceof BlockStackingLayoutManager
         && !(this.parentLayoutManager instanceof BlockLayoutManager)) {
       final Block helperBlock = new Block();
       TraitSetter.setProducerID(helperBlock, this.fobj.getId());
       this.parentLayoutManager.addChildArea(helperBlock);
     } else {
       final InlineArea area = getEffectiveArea();
       this.parentLayoutManager.addChildArea(area);
     }
   }
   while (posIter.hasNext()) {
     posIter.next();
   }
 }
Пример #4
0
  /**
   * The table area is a reference area that contains areas for columns, bodies, rows and the
   * contents are in cells.
   *
   * @param parentIter the position iterator
   * @param layoutContext the layout context for adding areas
   */
  @Override
  public void addAreas(final PositionIterator parentIter, final LayoutContext layoutContext) {
    getParentArea(null);
    addId();

    // add space before, in order to implement display-align = "center" or
    // "after"
    if (layoutContext.getSpaceBefore() != 0) {
      addBlockSpacing(0.0, MinOptMax.getInstance(layoutContext.getSpaceBefore()));
    }

    final int startXOffset = getTable().getCommonMarginBlock().startIndent.getValue(this);

    // add column, body then row areas

    // BPD of the table, i.e., height of its content; table's borders and
    // paddings not counted
    int tableHeight = 0;
    // Body childLM;
    final LayoutContext lc = new LayoutContext(0);

    lc.setRefIPD(getContentAreaIPD());
    this.contentLM.setStartXOffset(startXOffset);
    this.contentLM.addAreas(parentIter, lc);
    tableHeight += this.contentLM.getUsedBPD();

    this.curBlockArea.setBPD(tableHeight);

    if (this.columnBackgroundAreas != null) {
      for (final Iterator iter = this.columnBackgroundAreas.iterator(); iter.hasNext(); ) {
        final ColumnBackgroundInfo b = (ColumnBackgroundInfo) iter.next();
        TraitSetter.addBackground(
            b.backgroundArea,
            b.column.getCommonBorderPaddingBackground(),
            this,
            b.xShift,
            -b.backgroundArea.getYOffset(),
            b.column.getColumnWidth().getValue(this),
            tableHeight);
      }
      this.columnBackgroundAreas.clear();
    }

    if (getTable().isSeparateBorderModel()) {
      TraitSetter.addBorders(
          this.curBlockArea,
          getTable().getCommonBorderPaddingBackground(),
          this.discardBorderBefore,
          this.discardBorderAfter,
          false,
          false,
          this);
      TraitSetter.addPadding(
          this.curBlockArea,
          getTable().getCommonBorderPaddingBackground(),
          this.discardPaddingBefore,
          this.discardPaddingAfter,
          false,
          false,
          this);
    }
    TraitSetter.addBackground(
        this.curBlockArea, getTable().getCommonBorderPaddingBackground(), this);
    TraitSetter.addMargins(
        this.curBlockArea,
        getTable().getCommonBorderPaddingBackground(),
        this.startIndent,
        this.endIndent,
        this);
    TraitSetter.addBreaks(
        this.curBlockArea, getTable().getBreakBefore(), getTable().getBreakAfter());
    TraitSetter.addSpaceBeforeAfter(
        this.curBlockArea, layoutContext.getSpaceAdjust(), this.effSpaceBefore, this.effSpaceAfter);

    flush();

    resetSpaces();
    this.curBlockArea = null;

    notifyEndOfLayout();
  }