/** * This method <i>append</i> a new row to the grid <b>and</b> to the underlying model * @param row */ @Override public void appendRow(GridRow row) { checkSimulation(); super.appendRow(row); int rowIndex = getRowCount() - 1; commonAddRow(rowIndex); }
@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 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); }