-
Enhancement
-
Resolution: Unresolved
-
P5
-
None
-
1.4.1
-
Fix Understood
-
generic
-
generic
JTable needs API that will allow developers to specify what happens to an ongoing edit when JTable loses focus. There have been multiple bugs on this issue, occurring over a long period of time.
Originally, the behavior was to do absolutely nothing when focus is lost. This was a bad idea since, upon focus lost, the visible JTable could be left out of sync with its model.
Next, the behavior was to always cancel edits. This wasn't very well liked by users of JTable.
A more recent approach to solve this problem was to take a "commit-or-cancel" approach. That is, attempt to commit any ongoing edit and only cancel it if that fails. This would satisfy most developer's needs, but could break backward compatibility for those that assumed no action is taken.
As a result, the current behavior is to again do nothing, with the ability to turn on "commit-or-cancel" by putting a client property on JTable, like this:
table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE)
Still, we believe more needs to be done. Even the "commit-or-cancel" behavior is not flexible enough since it gives the developer no notification when their edit is cancelled. As a result, data could be lost.
The purpose of this RFE is to request API that will make this behavior customizable, and a decent default implementation that will satisfy most developers.
Originally, the behavior was to do absolutely nothing when focus is lost. This was a bad idea since, upon focus lost, the visible JTable could be left out of sync with its model.
Next, the behavior was to always cancel edits. This wasn't very well liked by users of JTable.
A more recent approach to solve this problem was to take a "commit-or-cancel" approach. That is, attempt to commit any ongoing edit and only cancel it if that fails. This would satisfy most developer's needs, but could break backward compatibility for those that assumed no action is taken.
As a result, the current behavior is to again do nothing, with the ability to turn on "commit-or-cancel" by putting a client property on JTable, like this:
table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE)
Still, we believe more needs to be done. Even the "commit-or-cancel" behavior is not flexible enough since it gives the developer no notification when their edit is cancelled. As a result, data could be lost.
The purpose of this RFE is to request API that will make this behavior customizable, and a decent default implementation that will satisfy most developers.
- relates to
-
JDK-4709394 1.4 REGRESSION: JTable does not take entered data.
-
- Resolved
-
-
JDK-5007652 JComboBox in JTable not closed correctly
-
- Closed
-