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: angorya
  • Loading branch information
Jose Pereda committed Dec 21, 2023
1 parent 8872f7a commit ab68b71
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

5 comments on commit ab68b71

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@kevinrushforth
Copy link
Member

Choose a reason for hiding this comment

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

/tag 22+23

@openjdk
Copy link

@openjdk openjdk bot commented on ab68b71 Dec 21, 2023

Choose a reason for hiding this comment

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

@kevinrushforth The tag 22+23 was successfully created.

@jperedadnr
Copy link
Collaborator

Choose a reason for hiding this comment

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

/backport jfx21u

@openjdk
Copy link

@openjdk openjdk bot commented on ab68b71 Feb 22, 2024

Choose a reason for hiding this comment

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

@jperedadnr the backport was successfully created on the branch backport-jperedadnr-ab68b716 in my personal fork of openjdk/jfx21u. To create a pull request with this backport targeting openjdk/jfx21u:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit ab68b716 from the openjdk/jfx repository.

The commit being backported was authored by Jose Pereda on 21 Dec 2023 and was reviewed by Andy Goryachev.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jfx21u:

$ git fetch https://github.com/openjdk-bots/jfx21u.git backport-jperedadnr-ab68b716:backport-jperedadnr-ab68b716
$ git checkout backport-jperedadnr-ab68b716
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jfx21u.git backport-jperedadnr-ab68b716

Please sign in to comment.