This is an initial poc for the long standing issue of allowing to commit a cell 
value when the focus is lost. This also contains 
[JDK-8089311](https://bugs.openjdk.org/browse/JDK-8089311) (for better 
understanding the usecase with `TextFiield` cells, but we may split this later 
on).

API
-
- Instead of calling `cancelEdit`, every cell now calls `stopEdit` when the 
focus is lost. The default behavior is cancelling the edit, but developers can 
now override the behavior and allow a `commitEdit` instead
- Every `MOUSE_PRESSED` shifts the focus to the cell container, which is 
undesired in case of editing the cell. So this event is now consumed.
- All `TextField` cells now commit their value (instead of cancel) on focus loss

Considerations
-
- I tried to make the API minimal, and without breaking changes (other than the 
`TextField` cells committing their values, but we may split this up)
- The Cell Container focus behavior is, well, weird right now. That is why 
consuming the event is needed to better support this PR. One thing we may can 
consider is using the `focusWithin` property instead for all 4 Cell Containers 
and not calling `requestFocus` for nearly every `MOUSE_PRESSED` event. If we 
decide so, this is needs to be done before merging this PR.
- Clicking the `ScrollBar` now commits/cancels the edit. I checked other 
applications and this is very common. But something I need to note here. This 
probably can be fixed in the same way mentioned above (`focusWithin`)

-------------

Commit messages:
 - focus edit

Changes: https://git.openjdk.org/jfx/pull/1935/files
  Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1935&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8089514
  Stats: 488 lines in 27 files changed: 382 ins; 23 del; 83 mod
  Patch: https://git.openjdk.org/jfx/pull/1935.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1935/head:pull/1935

PR: https://git.openjdk.org/jfx/pull/1935

Reply via email to