@@ -798,52 +798,51 @@ public LayoutResult layout(LayoutContext layoutContext) {
798
798
splitResult [1 ].deleteOwnProperty (Property .BORDER_BOTTOM );
799
799
}
800
800
}
801
- if (split ) {
802
- int [] rowspans = new int [currentRow .length ];
803
- boolean [] columnsWithCellToBeEnlarged = new boolean [currentRow .length ];
804
- for (col = 0 ; col < currentRow .length ; col ++) {
805
- if (splits [col ] != null ) {
806
- CellRenderer cellSplit = (CellRenderer ) splits [col ].getSplitRenderer ();
807
- if (null != cellSplit ) {
808
- rowspans [col ] = ((Cell ) cellSplit .getModelElement ()).getRowspan ();
809
- }
810
- if (splits [col ].getStatus () != LayoutResult .NOTHING && (hasContent || cellWithBigRowspanAdded )) {
811
- childRenderers .add (cellSplit );
812
- }
813
- LayoutArea cellOccupiedArea = currentRow [col ].getOccupiedArea ();
814
- if (hasContent || cellWithBigRowspanAdded || splits [col ].getStatus () == LayoutResult .NOTHING ) {
815
- CellRenderer cellOverflow = (CellRenderer ) splits [col ].getOverflowRenderer ();
816
- CellRenderer originalCell = currentRow [col ];
817
- currentRow [col ] = null ;
818
- rows .get (targetOverflowRowIndex [col ])[col ] = originalCell ;
819
- overflowRows .setCell (0 , col , null );
820
- overflowRows .setCell (targetOverflowRowIndex [col ] - row , col , (CellRenderer ) cellOverflow .setParent (splitResult [1 ]));
821
- } else {
822
- overflowRows .setCell (targetOverflowRowIndex [col ] - row , col , (CellRenderer ) currentRow [col ].setParent (splitResult [1 ]));
823
- }
824
- overflowRows .getCell (targetOverflowRowIndex [col ] - row , col ).occupiedArea = cellOccupiedArea ;
825
- } else if (currentRow [col ] != null ) {
826
- if (hasContent ) {
827
- rowspans [col ] = ((Cell ) currentRow [col ].getModelElement ()).getRowspan ();
828
- }
829
- boolean isBigRowspannedCell = 1 != ((Cell ) currentRow [col ].getModelElement ()).getRowspan ();
830
- if (hasContent || isBigRowspannedCell ) {
831
- columnsWithCellToBeEnlarged [col ] = true ;
832
- }
801
+
802
+ int [] rowspans = new int [currentRow .length ];
803
+ boolean [] columnsWithCellToBeEnlarged = new boolean [currentRow .length ];
804
+ for (col = 0 ; col < currentRow .length ; col ++) {
805
+ if (splits [col ] != null ) {
806
+ CellRenderer cellSplit = (CellRenderer ) splits [col ].getSplitRenderer ();
807
+ if (null != cellSplit ) {
808
+ rowspans [col ] = ((Cell ) cellSplit .getModelElement ()).getRowspan ();
809
+ }
810
+ if (splits [col ].getStatus () != LayoutResult .NOTHING && (hasContent || cellWithBigRowspanAdded )) {
811
+ childRenderers .add (cellSplit );
812
+ }
813
+ LayoutArea cellOccupiedArea = currentRow [col ].getOccupiedArea ();
814
+ if (hasContent || cellWithBigRowspanAdded || splits [col ].getStatus () == LayoutResult .NOTHING ) {
815
+ CellRenderer cellOverflow = (CellRenderer ) splits [col ].getOverflowRenderer ();
816
+ CellRenderer originalCell = currentRow [col ];
817
+ currentRow [col ] = null ;
818
+ rows .get (targetOverflowRowIndex [col ])[col ] = originalCell ;
819
+ overflowRows .setCell (0 , col , null );
820
+ overflowRows .setCell (targetOverflowRowIndex [col ] - row , col , cellOverflow );
821
+ } else {
822
+ overflowRows .setCell (targetOverflowRowIndex [col ] - row , col , currentRow [col ]);
823
+ }
824
+ overflowRows .getCell (targetOverflowRowIndex [col ] - row , col ).occupiedArea = cellOccupiedArea ;
825
+ } else if (currentRow [col ] != null ) {
826
+ if (hasContent ) {
827
+ rowspans [col ] = ((Cell ) currentRow [col ].getModelElement ()).getRowspan ();
828
+ }
829
+ boolean isBigRowspannedCell = 1 != ((Cell ) currentRow [col ].getModelElement ()).getRowspan ();
830
+ if (hasContent || isBigRowspannedCell ) {
831
+ columnsWithCellToBeEnlarged [col ] = true ;
833
832
}
834
833
}
834
+ }
835
835
836
- int minRowspan = Integer .MAX_VALUE ;
837
- for (col = 0 ; col < rowspans .length ; col ++) {
838
- if (0 != rowspans [col ]) {
839
- minRowspan = Math .min (minRowspan , rowspans [col ]);
840
- }
836
+ int minRowspan = Integer .MAX_VALUE ;
837
+ for (col = 0 ; col < rowspans .length ; col ++) {
838
+ if (0 != rowspans [col ]) {
839
+ minRowspan = Math .min (minRowspan , rowspans [col ]);
841
840
}
841
+ }
842
842
843
- for (col = 0 ; col < numberOfColumns ; col ++) {
844
- if (columnsWithCellToBeEnlarged [col ]) {
845
- enlargeCell (col , row , minRowspan ,currentRow , overflowRows , targetOverflowRowIndex , splitResult );
846
- }
843
+ for (col = 0 ; col < numberOfColumns ; col ++) {
844
+ if (columnsWithCellToBeEnlarged [col ]) {
845
+ enlargeCell (col , row , minRowspan ,currentRow , overflowRows , targetOverflowRowIndex , splitResult );
847
846
}
848
847
}
849
848
@@ -1254,20 +1253,18 @@ protected TableRenderer[] split(int row, boolean hasContent) {
1254
1253
protected TableRenderer [] split (int row , boolean hasContent , boolean cellWithBigRowspanAdded ) {
1255
1254
TableRenderer splitRenderer = createSplitRenderer (new Table .RowRange (rowRange .getStartRow (), rowRange .getStartRow () + row ));
1256
1255
splitRenderer .rows = rows .subList (0 , row );
1257
-
1258
1256
splitRenderer .bordersHandler = bordersHandler ;
1259
-
1260
1257
splitRenderer .heights = heights ;
1261
1258
splitRenderer .columnWidths = columnWidths ;
1262
1259
splitRenderer .countedColumnWidth = countedColumnWidth ;
1263
1260
splitRenderer .totalWidthForColumns = totalWidthForColumns ;
1261
+ splitRenderer .occupiedArea = occupiedArea ;
1262
+
1264
1263
TableRenderer overflowRenderer = createOverflowRenderer (new Table .RowRange (rowRange .getStartRow () + row , rowRange .getFinishRow ()));
1265
1264
if (0 == row && !(hasContent || cellWithBigRowspanAdded ) && 0 == rowRange .getStartRow ()) {
1266
1265
overflowRenderer .isOriginalNonSplitRenderer = isOriginalNonSplitRenderer ;
1267
1266
}
1268
1267
overflowRenderer .rows = rows .subList (row , rows .size ());
1269
- splitRenderer .occupiedArea = occupiedArea ;
1270
-
1271
1268
overflowRenderer .bordersHandler = bordersHandler ;
1272
1269
1273
1270
return new TableRenderer []{splitRenderer , overflowRenderer };
@@ -1885,7 +1882,6 @@ public CellRendererInfo(CellRenderer cellRenderer, int column, int finishRow) {
1885
1882
*/
1886
1883
private static class OverflowRowsWrapper {
1887
1884
private TableRenderer overflowRenderer ;
1888
- private HashMap <Integer , Boolean > isRowReplaced = new HashMap <>();
1889
1885
private boolean isReplaced = false ;
1890
1886
1891
1887
public OverflowRowsWrapper (TableRenderer overflowRenderer ) {
@@ -1901,9 +1897,7 @@ public CellRenderer setCell(int row, int col, CellRenderer newCell) {
1901
1897
overflowRenderer .rows = new ArrayList <>(overflowRenderer .rows );
1902
1898
isReplaced = true ;
1903
1899
}
1904
- if (!Boolean .TRUE .equals (isRowReplaced .get (row ))) {
1905
- overflowRenderer .rows .set (row , (CellRenderer []) overflowRenderer .rows .get (row ).clone ());
1906
- }
1900
+ overflowRenderer .rows .set (row , (CellRenderer []) overflowRenderer .rows .get (row ).clone ());
1907
1901
return overflowRenderer .rows .get (row )[col ] = newCell ;
1908
1902
}
1909
1903
}
0 commit comments