-
Notifications
You must be signed in to change notification settings - Fork 542
8187309: TreeCell must not change tree's data #724
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
Conversation
|
👋 Welcome back fastegal! A progress list of the required criteria for merging this PR into |
mstr2
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.
Looks good to me.
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.
Looks good to me too. The commitEdit(..) method of TreeCell is now in sync with the other cells.
Just left two minor comments.
| assertEquals("cell text must not have changed", oldValue, cell.getText()); | ||
| } | ||
|
|
||
|
|
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.
Very minor: Empty line
| } | ||
|
|
||
| /** | ||
| * Test test setup. |
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: I would rephrase that a bit. Something like:
Tests the cell editing setup.
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.
oops .. forgot to change this (and the other comment) before integration - sry
| setSelectionModel(sm); | ||
| setFocusModel(new TreeViewFocusModel<T>(this)); | ||
|
|
||
| setOnEditCommit(DEFAULT_EDIT_COMMIT_HANDLER); |
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.
You are adding the default edit commit handler to TreeView. Although it seems to be correct, this default handler is likely to be overwritten if the user code already has a setOnEditCommit() call. This is shown by the test_rt_29650() failure in TreeviewTest.java which you have corrected.
The changes done in this PR makes TreeView similar to ListView and TableView in terms of having the default edit commit handler.
Unfortunately, I do not see how can we avoid user code accidentally overwriting the default edit commit handler. Documenting this possibility seems to be the only way ahead.
Any other idea?
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, the change might break application code, though that code would be buggy. Actually, the behavior as implemented now, already is documented :)
It is very important to note that if you call setOnEditCommit(javafx.event.EventHandler) with your own EventHandler, then you will be removing the default handler. Unless you then handle the writeback to the property (or the relevant data source), nothing will happen.
so: if they have a custom handler that doesn't save the data, they were violating the specification (though were getting away with it due to the bug).
Personally, I think that we cannot keep backward compatibility to bugs.
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.
Thanks for the explanation. I see that it is already well documented.
|
@kleopatra This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 4 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
|
/integrate |
|
Going to push as commit 4cf66d9.
Your commit was automatically rebased without conflicts. |
|
@kleopatra Pushed as commit 4cf66d9. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Issue was TreeView commit editing implementation violated the spec'ed mechanism:
Fix is to move the saving of the edited value from cell into a default commit handler in tree and set that handler in the constructor.
Added tests that failed/passed before/after the fix (along with a sanity test for default commit that passed also before). Also fixed a test bug (incorrect registration of custom commit handler, see JDK-8280951) in TreeViewTest.test_rt_29650 to keep it passing.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/724/head:pull/724$ git checkout pull/724Update a local copy of the PR:
$ git checkout pull/724$ git pull https://git.openjdk.java.net/jfx pull/724/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 724View PR using the GUI difftool:
$ git pr show -t 724Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/724.diff