Skip to content

Commit 35f3538

Browse files
fix: use celldata cache for merged cell styles (#8330) (#8378)
Co-authored-by: Ugur Saglam <106508695+ugur-vaadin@users.noreply.github.com>
1 parent f043234 commit 35f3538

File tree

1 file changed

+13
-5
lines changed
  • vaadin-spreadsheet-flow-parent/vaadin-spreadsheet-flow-client/src/main/java/com/vaadin/addon/spreadsheet/client

1 file changed

+13
-5
lines changed

vaadin-spreadsheet-flow-parent/vaadin-spreadsheet-flow-client/src/main/java/com/vaadin/addon/spreadsheet/client/SheetWidget.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3645,11 +3645,7 @@ public void addMergedRegion(MergedRegion region) {
36453645
}
36463646
String key = toKey(region.col1, region.row1);
36473647
MergedCell mergedCell = new MergedCell(this, region.col1, region.row1);
3648-
String cellStyle = "cs0";
3649-
Cell cell = getCell(region.col1, region.row1);
3650-
if (cell != null) {
3651-
cellStyle = cell.getCellStyle();
3652-
}
3648+
String cellStyle = getMergedRegionCellStyle(region);
36533649
mergedCell.setValue(getCellValue(region.col1, region.row1), cellStyle,
36543650
false);
36553651
DivElement element = mergedCell.getElement();
@@ -3678,6 +3674,18 @@ public void addMergedRegion(MergedRegion region) {
36783674
}
36793675
}
36803676

3677+
private String getMergedRegionCellStyle(MergedRegion region) {
3678+
CellData cellData = getCellData(region.col1, region.row1);
3679+
if (cellData != null && cellData.cellStyle != null) {
3680+
return cellData.cellStyle;
3681+
}
3682+
Cell cell = getCell(region.col1, region.row1);
3683+
if (cell != null) {
3684+
return cell.getCellStyle();
3685+
}
3686+
return "cs0";
3687+
}
3688+
36813689
/**
36823690
* For internal use only! May be removed in the future.
36833691
*/

0 commit comments

Comments
 (0)