Skip to content

Commit

Permalink
8321970: New table columns don't appear when using fixed cell size un…
Browse files Browse the repository at this point in the history
…less refreshing tableView

Reviewed-by: jvos
Backport-of: ab68b71
  • Loading branch information
Jose Pereda committed Feb 24, 2024
1 parent e00407b commit f83dfdd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,8 @@ void updateCells(boolean resetChildren) {
}
}
getChildren().removeAll(toRemove);
} else if (resetChildren || cellsEmpty) {
}
if (resetChildren || cellsEmpty) {
getChildren().setAll(cells);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
package test.javafx.scene.control.skin;

import com.sun.javafx.tk.Toolkit;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
Expand Down Expand Up @@ -316,6 +317,27 @@ public void invisibleColumnsShouldRemoveCorrespondingCellsInRow() {
invisibleColumnsShouldRemoveCorrespondingCellsInRowImpl();
}

/**
* The {@link TableRowSkin} should add new cells after new columns are added.
* See: JDK-8321970
*/
@Test
public void cellsShouldBeAddedInRowFixedCellSize() {
tableView.setFixedCellSize(24);

TableColumn<Person, String> otherColumn = new TableColumn<>("other");
otherColumn.setPrefWidth(100);
otherColumn.setCellValueFactory(value -> new SimpleStringProperty("other"));
tableView.getColumns().add(otherColumn);

Toolkit.getToolkit().firePulse();
assertEquals(5, tableView.getColumns().size());

Toolkit.getToolkit().firePulse();
IndexedCell<?> row = VirtualFlowTestUtils.getCell(tableView, 1);
assertEquals(5, row.getChildrenUnmodifiable().stream().filter(TableCell.class::isInstance).count());
}

@After
public void after() {
stageLoader.dispose();
Expand Down

1 comment on commit f83dfdd

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.