@@ -611,7 +611,7 @@ public LayoutResult layout(LayoutContext layoutContext) {
611
611
if (marginsCollapsingEnabled ) {
612
612
marginsCollapseHandler .endMarginsCollapse (layoutBox );
613
613
}
614
- TableRenderer [] splitResult = ! split ? split ( row + 1 , false , cellWithBigRowspanAdded ) : split (row , hasContent , cellWithBigRowspanAdded );
614
+ TableRenderer [] splitResult = split (row , hasContent , cellWithBigRowspanAdded );
615
615
// delete #layout() related properties
616
616
if (null != headerRenderer || null != footerRenderer ) {
617
617
if (null != headerRenderer || tableModel .isEmpty ()) {
@@ -633,20 +633,20 @@ public LayoutResult layout(LayoutContext layoutContext) {
633
633
if (splits [col ].getStatus () != LayoutResult .NOTHING && (hasContent || cellWithBigRowspanAdded )) {
634
634
childRenderers .add (cellSplit );
635
635
}
636
- LayoutArea cellOccupiedArea = currentRow [col ].getOccupiedArea ();
636
+ LayoutArea cellOccupiedArea = splitResult [ 1 ]. rows . get ( 0 ) [col ].getOccupiedArea ();
637
637
if (hasContent || cellWithBigRowspanAdded || splits [col ].getStatus () == LayoutResult .NOTHING ) {
638
638
CellRenderer cellOverflow = (CellRenderer ) splits [col ].getOverflowRenderer ();
639
- currentRow [col ] = null ;
640
- rows .get (targetOverflowRowIndex [col ])[col ] = (CellRenderer ) cellOverflow .setParent (splitResult [1 ]);
639
+ splitResult [ 1 ]. rows . get ( 0 ) [col ] = null ;
640
+ splitResult [ 1 ]. rows .get (targetOverflowRowIndex [col ] - row )[col ] = (CellRenderer ) cellOverflow .setParent (splitResult [1 ]);
641
641
} else {
642
- rows .get (targetOverflowRowIndex [col ])[col ] = (CellRenderer ) currentRow [col ].setParent (splitResult [1 ]);
642
+ splitResult [ 1 ]. rows .get (targetOverflowRowIndex [col ] - row )[col ] = (CellRenderer ) splitResult [ 1 ]. rows . get ( 0 ) [col ].setParent (splitResult [1 ]);
643
643
}
644
- rows .get (targetOverflowRowIndex [col ])[col ].occupiedArea = cellOccupiedArea ;
645
- } else if (currentRow [col ] != null ) {
644
+ splitResult [ 1 ]. rows .get (targetOverflowRowIndex [col ] - row )[col ].occupiedArea = cellOccupiedArea ;
645
+ } else if (splitResult [ 1 ]. rows . get ( 0 ) [col ] != null ) {
646
646
if (hasContent ) {
647
- rowspans [col ] = currentRow [col ].getModelElement ().getRowspan ();
647
+ rowspans [col ] = splitResult [ 1 ]. rows . get ( 0 ) [col ].getModelElement ().getRowspan ();
648
648
}
649
- boolean isBigRowspannedCell = 1 != currentRow [col ].getModelElement ().getRowspan ();
649
+ boolean isBigRowspannedCell = 1 != splitResult [ 1 ]. rows . get ( 0 ) [col ].getModelElement ().getRowspan ();
650
650
if (hasContent || isBigRowspannedCell ) {
651
651
columnsWithCellToBeEnlarged [col ] = true ;
652
652
}
@@ -662,36 +662,36 @@ public LayoutResult layout(LayoutContext layoutContext) {
662
662
663
663
for (col = 0 ; col < numberOfColumns ; col ++) {
664
664
if (columnsWithCellToBeEnlarged [col ]) {
665
- LayoutArea cellOccupiedArea = currentRow [col ].getOccupiedArea ();
665
+ LayoutArea cellOccupiedArea = splitResult [ 1 ]. rows . get ( 0 ) [col ].getOccupiedArea ();
666
666
if (1 == minRowspan ) {
667
667
// Here we use the same cell, but create a new renderer which doesn't have any children,
668
668
// therefore it won't have any content.
669
- Cell overflowCell = currentRow [col ].getModelElement ().clone (true ); // we will change properties
670
- currentRow [col ].isLastRendererForModelElement = false ;
671
- childRenderers .add (currentRow [col ]);
672
- currentRow [col ] = null ;
673
- rows .get (targetOverflowRowIndex [col ])[col ] = (CellRenderer ) overflowCell .getRenderer ().setParent (this );
674
- rows .get (targetOverflowRowIndex [col ])[col ].deleteProperty (Property .HEIGHT );
675
- rows .get (targetOverflowRowIndex [col ])[col ].deleteProperty (Property .MIN_HEIGHT );
676
- rows .get (targetOverflowRowIndex [col ])[col ].deleteProperty (Property .MAX_HEIGHT );
669
+ Cell overflowCell = splitResult [ 1 ]. rows . get ( 0 ) [col ].getModelElement ().clone (true ); // we will change properties
670
+ splitResult [ 1 ]. rows . get ( 0 ) [col ].isLastRendererForModelElement = false ;
671
+ childRenderers .add (splitResult [ 1 ]. rows . get ( 0 ) [col ]);
672
+ splitResult [ 1 ]. rows . get ( 0 ) [col ] = null ;
673
+ splitResult [ 1 ]. rows .get (targetOverflowRowIndex [col ] - row )[col ] = (CellRenderer ) overflowCell .getRenderer ().setParent (this );
674
+ splitResult [ 1 ]. rows .get (targetOverflowRowIndex [col ] - row )[col ].deleteProperty (Property .HEIGHT );
675
+ splitResult [ 1 ]. rows .get (targetOverflowRowIndex [col ] - row )[col ].deleteProperty (Property .MIN_HEIGHT );
676
+ splitResult [ 1 ]. rows .get (targetOverflowRowIndex [col ] - row )[col ].deleteProperty (Property .MAX_HEIGHT );
677
677
} else {
678
- childRenderers .add (currentRow [col ]);
678
+ childRenderers .add (splitResult [ 1 ]. rows . get ( 0 ) [col ]);
679
679
// shift all cells in the column up
680
680
int i = row ;
681
- for (; i < row + minRowspan && i + 1 < rows .size () && rows .get (i + 1 )[col ] != null ; i ++) {
682
- rows .get (i )[col ] = rows .get (i + 1 )[col ];
683
- rows .get (i + 1 )[col ] = null ;
681
+ for (; i < row + minRowspan && i + 1 < rows .size () && splitResult [ 1 ]. rows .get (i + 1 - row )[col ] != null ; i ++) {
682
+ splitResult [ 1 ]. rows .get (i - row )[col ] = splitResult [ 1 ]. rows .get (i + 1 - row )[col ];
683
+ splitResult [ 1 ]. rows .get (i + 1 - row )[col ] = null ;
684
684
}
685
685
// the number of cells behind is less then minRowspan-1
686
686
// so we should process the last cell in the column as in the case 1 == minRowspan
687
687
if (i != row + minRowspan - 1 && null != rows .get (i )[col ]) {
688
688
Cell overflowCell = rows .get (i )[col ].getModelElement ();
689
- rows .get (i )[col ].isLastRendererForModelElement = false ;
690
- rows .get (i )[col ] = null ;
691
- rows .get (targetOverflowRowIndex [col ])[col ] = (CellRenderer ) overflowCell .getRenderer ().setParent (this );
689
+ splitResult [ 1 ]. rows .get (i - row )[col ].isLastRendererForModelElement = false ;
690
+ splitResult [ 1 ]. rows .get (i - row )[col ] = null ;
691
+ splitResult [ 1 ]. rows .get (targetOverflowRowIndex [col ] - row )[col ] = (CellRenderer ) overflowCell .getRenderer ().setParent (this );
692
692
}
693
693
}
694
- rows .get (targetOverflowRowIndex [col ])[col ].occupiedArea = cellOccupiedArea ;
694
+ splitResult [ 1 ]. rows .get (targetOverflowRowIndex [col ] - row )[col ].occupiedArea = cellOccupiedArea ;
695
695
}
696
696
}
697
697
}
@@ -709,7 +709,7 @@ public LayoutResult layout(LayoutContext layoutContext) {
709
709
}
710
710
if (Boolean .TRUE .equals (getPropertyAsBoolean (Property .FILL_AVAILABLE_AREA ))
711
711
|| Boolean .TRUE .equals (getPropertyAsBoolean (Property .FILL_AVAILABLE_AREA_ON_SPLIT ))) {
712
- extendLastRow (currentRow , layoutBox );
712
+ extendLastRow (splitResult [ 1 ]. rows . get ( 0 ) , layoutBox );
713
713
}
714
714
adjustFooterAndFixOccupiedArea (layoutBox );
715
715
0 commit comments