• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

TextField focusLost event and a save at the same time

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
Shawn Densmore
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Campbell
 
Shawn Densmore
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic