• Post Reply Bookmark Topic Watch Topic
  • New Topic

TextField focusLost event and a save at the same time

 
Shawn Densmore
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, first post here...

I have an issue now appearing when upgrading from Java 1.6 to 1.7 where a cell in a table (code extends DefaultCellEditor) needs to check that the value has changed from its original value and if so, a modal dialog is displayed to select a reason why the value has changed. Works perfectly when you tab from the cell or use the ENTER key and focus events are coded to do. The issue now appearing is that if the text field still has focus with a new value and the user selects a save button or key bound to the same buttons action via registerKeyboardAction, the timing of events is now out of sync and the actual save happens while the modal dialog is still visible. All logging shows that both are on the event dispatch thread but the modal dialog is not blocking as it should. The timing was fine for this scenario when running on 1.6. Is anyone aware of something that has changed or encountered a similar issue?

Thanks
 
Rob Camick
Ranch Hand
Posts: 2700
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The issue now appearing is that if the text field still has focus with a new value and the user selects a save button


You need to stop cell editing when the table loses focus.

See Table Stop Editing for a couple of ways to do this.
 
Campbell Ritchie
Marshal
Posts: 52581
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
Shawn Densmore
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Campbell
 
Shawn Densmore
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to stop cell editing when the table loses focus.


stopCellEditing is overridden in the class extending DefaultCellEditor and within that method the modal dialog is launched to prompt for the reason. This has always worked and still does aside from the save now also occurring simultaneously.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!