-
Bug
-
Resolution: Fixed
-
P3
-
8, jfx15
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8267643 | 8-pool | Balchandra Vaidya | P3 | Open | Unresolved |
.. but doesn't (after row was re-used?). To reproduce, compile and run the example below
- click into leading empty space on any of visible leafs (root or expanded child)
- expected and actual: leaf selected
- expand a collapsed child, click into leading empty space of any of its leaf children
- expected: child leaf selected
- actual: child leaf not selected
The technical issue is a mixture:
- TreeTableRowSkin manages the disclosure node, seems to try to remove it if not needed but fails (when/why exactly?). At least it seems to toggle the disclosure's visibility reliably
- TreeTableCellBehavior does the hit-detection on the disclosure node if added to the row
Seems to be virulent since ages (checked against fx11 and fx8). Priority set to 3 because it's an UX issue and nothing an application developer can workaround.
A quick fix is to let the hit-detection check both existence and visibility. A cleaner fix (off scope for this, extracted to ??) would cleanup the missing removal (and possibly other layout issues around graphic/indentation in Tree/Table). A real fix might also cleanup the smeared responsibility across several collaborators)
The example (modified from https://stackoverflow.com/q/63964556/203657):
public class TreeTableLeafSelectionWithMouseBug extends Application {
@Override
public void start(Stage primaryStage) {
// TreeTableView
TreeTableView<String> treeTableView = new TreeTableView<>(new TreeItem<>("Root"));
// column
TreeTableColumn<String, String> primaryColumn = new TreeTableColumn<>("Col1");
primaryColumn.setCellValueFactory(call -> new ReadOnlyStringWrapper(call.getValue().getValue()));
treeTableView.getColumns().add(primaryColumn);
fillTree(treeTableView.getRoot());
HBox content = new HBox(10, treeTableView);
Scene scene = new Scene(content);
primaryStage.setScene(scene);
primaryStage.show();
}
protected void fillTree(TreeItem<String> root) {
root.setExpanded(true);
root.getChildren().add(0, new TreeItem<>("leafChild"));
for (int i = 0; i < 10; i++) {
TreeItem<String> newChild = new TreeItem<>("child " + i);
if (i == 0) newChild.setExpanded(true);
root.getChildren().add(newChild);
for (int j = 0; j < 3; j++) {
TreeItem<String> newChild2 = new TreeItem<>(i + " grandChild " + j);
newChild.getChildren().add(newChild2);
}
}
}
public static void main(String[] args) {
launch(args);
}
}
- click into leading empty space on any of visible leafs (root or expanded child)
- expected and actual: leaf selected
- expand a collapsed child, click into leading empty space of any of its leaf children
- expected: child leaf selected
- actual: child leaf not selected
The technical issue is a mixture:
- TreeTableRowSkin manages the disclosure node, seems to try to remove it if not needed but fails (when/why exactly?). At least it seems to toggle the disclosure's visibility reliably
- TreeTableCellBehavior does the hit-detection on the disclosure node if added to the row
Seems to be virulent since ages (checked against fx11 and fx8). Priority set to 3 because it's an UX issue and nothing an application developer can workaround.
A quick fix is to let the hit-detection check both existence and visibility. A cleaner fix (off scope for this, extracted to ??) would cleanup the missing removal (and possibly other layout issues around graphic/indentation in Tree/Table). A real fix might also cleanup the smeared responsibility across several collaborators)
The example (modified from https://stackoverflow.com/q/63964556/203657):
public class TreeTableLeafSelectionWithMouseBug extends Application {
@Override
public void start(Stage primaryStage) {
// TreeTableView
TreeTableView<String> treeTableView = new TreeTableView<>(new TreeItem<>("Root"));
// column
TreeTableColumn<String, String> primaryColumn = new TreeTableColumn<>("Col1");
primaryColumn.setCellValueFactory(call -> new ReadOnlyStringWrapper(call.getValue().getValue()));
treeTableView.getColumns().add(primaryColumn);
fillTree(treeTableView.getRoot());
HBox content = new HBox(10, treeTableView);
Scene scene = new Scene(content);
primaryStage.setScene(scene);
primaryStage.show();
}
protected void fillTree(TreeItem<String> root) {
root.setExpanded(true);
root.getChildren().add(0, new TreeItem<>("leafChild"));
for (int i = 0; i < 10; i++) {
TreeItem<String> newChild = new TreeItem<>("child " + i);
if (i == 0) newChild.setExpanded(true);
root.getChildren().add(newChild);
for (int j = 0; j < 3; j++) {
TreeItem<String> newChild2 = new TreeItem<>(i + " grandChild " + j);
newChild.getChildren().add(newChild2);
}
}
}
public static void main(String[] args) {
launch(args);
}
}
- backported by
-
JDK-8267643 TreeTableView: must select leaf row on click into indentation region
- Open
- relates to
-
JDK-8253769 MouseEventFirer: must not fire event with incorrect coordinates
- Open