public Range setCellValueInternal(final int rowIndex, final int columnIndex, final GridCellValue<?> value) { final boolean isMerged = isMerged(); try { this.isMerged = false; return super.setCellValue(rowIndex, columnIndex, value); } finally { this.isMerged = isMerged; } }
@Override //Override to sync underlying Model with UiModel public Range setCellValue(final int rowIndex, final int columnIndex, final GridCellValue<?> value) { final Range range = super.setCellValue(rowIndex, columnIndex, value); synchronizer.setCellValue(range, columnIndex, value); return range; }
public Range setCellValueInternal(final int rowIndex, final int columnIndex, final GridCellValue<?> value) { final boolean isMerged = isMerged(); try { this.isMerged = false; return super.setCellValue(rowIndex, columnIndex, value); } finally { this.isMerged = isMerged; } }
@Override //Override to sync underlying Model with UiModel public Range setCellValue(final int rowIndex, final int columnIndex, final GridCellValue<?> value) { final Range range = super.setCellValue(rowIndex, columnIndex, value); synchronizer.setCellValue(range, columnIndex, value); return range; }
@Test public void testSetCellValueWhenNoExistingGridCell() { final BaseGridColumn<String> column = new BaseGridColumn<>(header, columnRenderer, 25.0); baseGridData.insertColumn(0, column); baseGridData.appendRow(new BaseGridRow()); baseGridData.setCellValue(0, 0, new BaseGridCellValue<>("hello")); assertThat(baseGridData.getCell(0, 0).getValue().getValue()).isEqualTo("hello"); assertThat(baseGridData.getCell(0, 0)).isInstanceOf(BaseGridCell.class); }
@Test public void testSetCellValueWhenNoExistingGridCell() { final BaseGridColumn<String> column = new BaseGridColumn<>(header, columnRenderer, 25.0); baseGridData.insertColumn(0, column); baseGridData.appendRow(new BaseGridRow()); baseGridData.setCellValue(0, 0, new BaseGridCellValue<>("hello")); assertThat(baseGridData.getCell(0, 0).getValue().getValue()).isEqualTo("hello"); assertThat(baseGridData.getCell(0, 0)).isInstanceOf(BaseGridCell.class); }
@Test public void testSetCellValueWhenExistingBaseGridCell() { final BaseGridColumn<String> column = new BaseGridColumn<>(header, columnRenderer, 25.0); baseGridData.insertColumn(0, column); baseGridData.appendRow(new BaseGridRow()); baseGridData.setCell(0, 0, () -> new BaseGridCell<>(new BaseGridCellValue<>(""))); baseGridData.setCellValue(0, 0, new BaseGridCellValue<>("hello")); assertThat(baseGridData.getCell(0, 0).getValue().getValue()).isEqualTo("hello"); assertThat(baseGridData.getCell(0, 0)).isInstanceOf(BaseGridCell.class); }
@Test public void testSetCellValueWhenExistingCustomGridCell() { final BaseGridColumn<String> column = new BaseGridColumn<>(header, columnRenderer, 25.0); baseGridData.insertColumn(0, column); baseGridData.appendRow(new BaseGridRow()); baseGridData.setCell(0, 0, () -> new CustomGridCell<>(new BaseGridCellValue<>("hello"))); baseGridData.setCellValue(0, 0, new BaseGridCellValue<>("hello")); assertThat(baseGridData.getCell(0, 0).getValue().getValue()).isEqualTo("hello"); assertThat(baseGridData.getCell(0, 0)).isInstanceOf(CustomGridCell.class); }
@Test public void testSetCellValueWhenExistingCustomGridCell() { final BaseGridColumn<String> column = new BaseGridColumn<>(header, columnRenderer, 25.0); baseGridData.insertColumn(0, column); baseGridData.appendRow(new BaseGridRow()); baseGridData.setCell(0, 0, () -> new CustomGridCell<>(new BaseGridCellValue<>("hello"))); baseGridData.setCellValue(0, 0, new BaseGridCellValue<>("hello")); assertThat(baseGridData.getCell(0, 0).getValue().getValue()).isEqualTo("hello"); assertThat(baseGridData.getCell(0, 0)).isInstanceOf(CustomGridCell.class); }
@Test public void testSetCellValueWhenExistingBaseGridCell() { final BaseGridColumn<String> column = new BaseGridColumn<>(header, columnRenderer, 25.0); baseGridData.insertColumn(0, column); baseGridData.appendRow(new BaseGridRow()); baseGridData.setCell(0, 0, () -> new BaseGridCell<>(new BaseGridCellValue<>(""))); baseGridData.setCellValue(0, 0, new BaseGridCellValue<>("hello")); assertThat(baseGridData.getCell(0, 0).getValue().getValue()).isEqualTo("hello"); assertThat(baseGridData.getCell(0, 0)).isInstanceOf(BaseGridCell.class); }