JDK-8175260 : JavaFX: TreeTableView Selection Listener unexpected behaviour
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: 8,9
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2017-02-19
  • Updated: 2024-03-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Description
FULL PRODUCT VERSION :


ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.3.9600]

A DESCRIPTION OF THE PROBLEM :
Kindly refer to:
https://stackoverflow.com/questions/41737988/javafx-treetableview-selection-listener-unexpected-behaviour

At least this behaviour refers to an undocumented contract in the selection API. Better would be if the getSelectionModel().getSelectedItems().addListener() would be correctly triggered even if no clearSelection() is called in SelectionMode == SINGLE.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
see description

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
see description
ACTUAL -
see description

ERROR MESSAGES/STACK TRACES THAT OCCUR :
see description

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
see description
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
see description


Comments
Additional Information from Submitter: -------------------------------------------------------------- Regarding to your comment. I would state it is a documentation issue (1) AND a source code issue (2): ad (1): At: http://download.java.net/java/jdk9/jfxdocs/javafx/scene/control/SelectionModel.html#select-int- you state: "If there is already one or more indices selected in this model, calling this method will _not_ clear these selections " This is not correct for 'SelectionMode.SINGLE'. Here the selection gets cleared. This is the natural behaviour and should IMO not be changed. ad (2): I suggest the keep the selection behaviour for 'SelectionMode.SINGLE'. However also a notification of selection change should be triggered
22-02-2017

Verified in 8u121 and 9-ea+156 and its reproducible in both. PFA testcase [treeTableViewTest.java] to reproduce the issue. According to Submitter: 1 -> It’s a documentation bug https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/SelectionModel.html#select-int- http://download.java.net/java/jdk9/jfxdocs/javafx/scene/control/SelectionModel.html#select-int- OR 2 -> It’s a Source code bug. For treeTable, if SelectionMode == SINGLE, select(int index)API should also notify removal of previous item (if any) like clearAndSelect (int index) API. Moving it to dev team for the evaluation.
20-02-2017