The refresh changes could only be a problem if something in the Code is misbehaving.
I had a look, and indeed, the expandedNode is NEVER removed. The logic simply does not work, never did in the previous versions.
Prior to 26-ea+15, the table refresh was recreating ALL cells. This masked the bug.
But now, the refresh method really refreshes the existing cells. So rows and cells need to react to that, as they should before.
 
The root cause is, that the expandedNode is removed from the HashMap before it could be cleaned up in the corresponding TableRowSkin.
So when the TableRowSkin tries to remove the expandedNode, it is already null.
Removing the code fixes the issue:
 
            public BooleanProperty getExpandedProperty(S item) {
                BooleanProperty value = expansionState.get(item);
                if (value == null) {
                    value = new SimpleBooleanProperty(item, "expanded", false) {
                        @Override
                        protected void invalidated() {
//                            if (!getValue()) {
//                                expandedNodeCache.remove(getBean());
//                            }
                            getTableView().refresh();
                        }
                    };
                    expansionState.put(item, value);
                }
                return value;
            }
 
Again, this was also problematic before, but masked by the recreation.
 
To restore the old behavior, you could write:
 
            TableView<Person> table = new TableView<>() {
                @Override
                public void refresh() {
                    getProperties().put("recreateKey", Boolean.TRUE);
                }
            };
 
I don't know if ControlsFX is still somewhat maintained. Otherwise I can have file a PR there.
 
-- Marius
 
Gesendet: Sonntag, 23. November 2025 um 16:14
Von: "Cormac Redmond" <[email protected]>
Betreff: JFX 26-ea+15 TableView "bug" -- related to 8359599?
Hi,
 
Since 26-ea+15, there may be a "bug" with TableView which appears to be rendering duplicated nodes.
 
I first noticed this when using ControlFX's TableRowExpanderColumn (https://controlsfx.github.io/javadoc/11.2.2/org.controlsfx.controls/org/controlsfx/control/table/TableRowExpanderColumn.html), which has been working as expected for several years, right up until 26-ea+15. This column just provides a simple way to allow expansion of table rows.
 
I have created a gist consisting of a single runnable class. It's quite small, and no dependencies are required (minimal ControlsFX code copied into it):
 
 
Run this on 26-ea+15, and you'll see the issue re: duplicated rendering; run it on anything older, and there's no issue. If I had to guess, I'd say this issue is related to this commit (8359599):
 
 
 
The application starts out like this on all versions, there's three rows (number of rows is irrelevant):
image.png
 
Click the +'s and -'s more than once.
 
26-ea+15 "bug"; notice the duplications that appear just by clicking the + / -'s a couple of times:
image.png
 
26-ea+14 (and previous) expected / normal behaviour:
image.png

 
 
 
Kind Regards,
Cormac Redmond
 
 
 

Reply via email to