-
Notifications
You must be signed in to change notification settings - Fork 542
8356770: TreeTableView not updated after removing a TreeItem with children and adding it to another parent #1971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
👋 Welcome back zelmidaoui! A progress list of the required criteria for merging this PR into |
|
@Ziad-Mid This change is no longer ready for integration - check the PR body for details. |
modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeTableViewSkin.java
Show resolved
Hide resolved
Webrevs
|
|
/reviewers 2 |
|
@andy-goryachev-oracle |
|
@Ziad-Mid can we add a unit test which fails in master and passes with the fix? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no ill effects with the reproducer and the monkey tester (which was updated to add data manipulation context menus, see https://github.com/andy-goryachev-oracle/MonkeyTest ).
I suppose adding a flag in the skin (as opposed to similar flag in VirtualContainerBase) is ok since it deals with tree-table-specific functionality.
I have added test as suggested |
andy-goryachev-oracle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding the test! Verified it fails in master and passes with the fix.
Maran23
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix should be good, commented some improvements for the test
| } | ||
|
|
||
| @Test | ||
| void test_jdk_8356770_reparentingItem() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend a test name that reflects what exactly we want to test here. You can reference the JDK Ticket in a javadoc comment.
Example:
jfx/modules/javafx.controls/src/test/java/test/javafx/scene/control/skin/TableColumnHeaderTest.java
Lines 349 to 354 in 829d2be
| /** | |
| * The content display should also be taken into consideration when measuring the width. | |
| * See also: <a href="https://bugs.openjdk.org/browse/JDK-8186188">JDK-8186188</a> | |
| */ | |
| @Test | |
| public void testResizeColumnToFitContentWithGraphicAlignment() { |
| table.setShowRoot(true); | ||
|
|
||
| stageLoader = new StageLoader(table); | ||
| Toolkit.getToolkit().firePulse(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this call really needed? Just asking because most of the time, it is not needed right after the StageLoader
| Toolkit.getToolkit().firePulse(); | ||
|
|
||
| // Find "item B" row and record its disclosure node indent | ||
| TreeTableRow<String> rowBefore = findRow(table, "item B"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend using VirtualFlowTestUtils.getVirtualFlow(table).getVisibleCell(index);
The index should be easy to find out, since we always know where the TreeItem should be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes exact, I usually prefer not to hardcode things, but sure in this case I will modify it.
| } | ||
|
|
||
| private static double disclosureX(TreeTableRow<String> row) { | ||
| Node disclosureNode = row.lookup(".tree-disclosure-node"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you just call: row.getDisclosureNode() ?
| return null; | ||
| } | ||
|
|
||
| private static double disclosureX(TreeTableRow<String> row) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know IntelliJ makes methods static by default (when extracting), but I don't think it makes sense here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's perfectly fine to have a static method here (and in tests in general).
| control.requestLayout(); | ||
| break; | ||
| } | ||
| else if (eventType.equals(TreeItem.<T>childrenModificationEvent())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: else if should be in the previous line to follow the Java Code Convention: } else if (..)
| Toolkit.getToolkit().firePulse(); | ||
|
|
||
| TreeTableRow<String> rowAfter = findRow(table, "item B"); | ||
| assertNotNull(rowAfter, "item B row should not be null"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Null check is not needed, since we do test the disclosure node position instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The null check is just for safety that the item exist, not that much important.
|
I have updated the test, thanks for comments could you check. |
Maran23
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two minor comments. Will reapprove once they are fixed.
Test looks good, and gives helpful insights to us in case it fails in the future. Good job!
modules/javafx.controls/src/test/java/test/javafx/scene/control/TreeTableViewTest.java
Outdated
Show resolved
Hide resolved
modules/javafx.controls/src/test/java/test/javafx/scene/control/TreeTableViewTest.java
Outdated
Show resolved
Hide resolved
|
Changes added thank you for review, I will integrate by tomorrow if no more suggestions. |
When a subtree is moved in a
TreeTableView, the visuals don’t update until a resize or expand/collapse. TheTreeTableViewSkinonly rebuilds cells when the expanded row count changes.This PR makes the skin to detect structural changes on
childrenModificationEventusing new variabletreeStructureDirty, and inupdateItemCount()callrequestRebuildCells()to refresh the visuals.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1971/head:pull/1971$ git checkout pull/1971Update a local copy of the PR:
$ git checkout pull/1971$ git pull https://git.openjdk.org/jfx.git pull/1971/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1971View PR using the GUI difftool:
$ git pr show -t 1971Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1971.diff
Using Webrev
Link to Webrev Comment