JDK-8277000 : Tree-/TableRowSkin: replace listener to fixedCellSize by live lookup
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: jfx17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-11-11
  • Updated: 2025-04-17
  • Resolved: 2025-04-11
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
jfx25 b13Fixed
Related Reports
Blocks :  
Relates :  
Description
This is a left-over from JDK-8274061 (skin cleanup to allow replacing the skin without memory leaks/bad side-effects): Tree-/TableRowSkin register listeners to fixedCellSize that are not really needed - they do nothing but cache the fixedCellSize. This should be replaced by a live lookup of the value when needed, similar to the fix of JDK-8246745 for ListCellSkin. 

Doing so led to visually incorrect initial state of the horizontal scrollbar (thumb covering nearly all of sb's width) for many columns and fixedCellSize enabled. The underlying reason is that the initial sizing depends on fixedCellSizeEnabled being false (which is a misbehavior related to broken horizontal virtualization, JDK-8185887)
Comments
Changeset: fcdccd9a Branch: master Author: Marius Hanl <mhanl@openjdk.org> Date: 2025-04-11 17:38:46 +0000 URL: https://git.openjdk.org/jfx/commit/fcdccd9a93b826de6cba2f3c25ec5aeab5d05bcc
11-04-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jfx/pull/1645 Date: 2024-11-22 20:31:08 +0000
22-11-2024

the technical problem is that the constructor of TableRowSkinBase indirectly relies on state that's set only in its descendents: // Base: define field double fixedCellSize; boolean fixedCellSizeEnable; // Base: constructor ... updateCells(true); // Base: updateCells ... if (fixedCellSizeEnabled) { // false on first call // do some cell cleanup } else { // called initially, independent of actual value of table.fixedCellSize/Enabled children.setAll(cells); } // concrete: constructor // this is calling updateCells with fixedCellSizeEnable == false (not yet set) super(...); setupTreeTableViewListeners(); // concrete: initial setting of fixedCellSize related fields fixedCellSize = getSkinnable().getFixedCellSize(); fixedCellSizeEnabled = fixedCellSize > 0; adding all cells has the side-effect of setting their skins and make them report something useful on cell.prefWidth(-1). Or the other way round: cells without skin report 0, thus confusing row.computePrefWidth (which sums the pref of all its cells). Marked as blocked by the broken horizontal virtualization JDK-8185887 - though it might (or not ;) be a separate part of that complex issue, questions to think about: - why does row.computePrefWidth asked its children? wouldn't it be more reasonable to ask the column's pref/width? - how to solve the mis-match of computation: ask children for pref/width in computeXX, ask columns for width in isColumnPartiallyVisible(..) - should/how to fix the base implementation to not rely on state initialized by subclasses?
15-11-2021