Exemplo n.º 1
0
 /**
  * Resolve collapsing borders for the given cell. Used in case of the collapsing border model.
  *
  * @param other neighbouring grid unit
  * @param side the side to resolve (one of CommonBorderPaddingBackground.BEFORE|AFTER|START|END)
  */
 void resolveBorder(GridUnit other, int side) {
   switch (side) {
     case CommonBorderPaddingBackground.BEFORE:
       borderBefore.resolve(other.borderAfter, true, false, false);
       break;
     case CommonBorderPaddingBackground.AFTER:
       borderAfter.resolve(other.borderBefore, true, false, false);
       break;
     case CommonBorderPaddingBackground.START:
       BorderSpecification resolvedBorder =
           collapsingBorderModel.determineWinner(borderStart, other.borderEnd);
       if (resolvedBorder != null) {
         this.borderStart = resolvedBorder;
         other.borderEnd = resolvedBorder;
       }
       break;
     case CommonBorderPaddingBackground.END:
       resolvedBorder = collapsingBorderModel.determineWinner(borderEnd, other.borderStart);
       if (resolvedBorder != null) {
         this.borderEnd = resolvedBorder;
         other.borderStart = resolvedBorder;
       }
       break;
     default:
       assert false;
   }
 }
Exemplo n.º 2
0
 /**
  * For the given side, integrates in the conflict resolution the border segment of the given
  * parent element.
  *
  * @param side the side to consider (either CommonBorderPaddingBackground.BEFORE or AFTER)
  * @param parent a table element whose corresponding border coincides on the given side
  */
 void integrateBorderSegment(
     int side,
     TableFObj parent,
     boolean withNormal,
     boolean withLeadingTrailing,
     boolean withRest) {
   switch (side) {
     case CommonBorderPaddingBackground.BEFORE:
       borderBefore.integrateSegment(
           parent.borderBefore, withNormal, withLeadingTrailing, withRest);
       break;
     case CommonBorderPaddingBackground.AFTER:
       borderAfter.integrateSegment(parent.borderAfter, withNormal, withLeadingTrailing, withRest);
       break;
     default:
       assert false;
   }
 }
Exemplo n.º 3
0
 void integrateCompetingBorder(
     int side,
     ConditionalBorder competitor,
     boolean withNormal,
     boolean withLeadingTrailing,
     boolean withRest) {
   switch (side) {
     case CommonBorderPaddingBackground.BEFORE:
       borderBefore.integrateCompetingSegment(
           competitor, withNormal, withLeadingTrailing, withRest);
       break;
     case CommonBorderPaddingBackground.AFTER:
       borderAfter.integrateCompetingSegment(
           competitor, withNormal, withLeadingTrailing, withRest);
       break;
     default:
       assert false;
   }
 }
Exemplo n.º 4
0
 /** Prepares the borders of this grid unit for upcoming resolution, in the collapsing model. */
 protected void setBordersFromCell() {
   borderBefore = cell.borderBefore.copy();
   if (rowSpanIndex > 0) {
     borderBefore.normal = BorderSpecification.getDefaultBorder();
   }
   borderAfter = cell.borderAfter.copy();
   if (!isLastGridUnitRowSpan()) {
     borderAfter.normal = BorderSpecification.getDefaultBorder();
   }
   if (colSpanIndex == 0) {
     borderStart = cell.borderStart;
   } else {
     borderStart = BorderSpecification.getDefaultBorder();
   }
   if (isLastGridUnitColSpan()) {
     borderEnd = cell.borderEnd;
   } else {
     borderEnd = BorderSpecification.getDefaultBorder();
   }
 }