• Post Reply Bookmark Topic Watch Topic
  • New Topic

Strategy to coordinate data changes between listing forms and detail forms in separate windows.

 
Basil Bourque
Greenhorn
Posts: 7
Java Mac Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to build a Swing app where one window/JFrame has a listing of database records, and another window/JFrame has a detail form to edit one of those database records.

I've got the listing window working with a JTable, backed by a database RowSet, with a TableModel in between based on George Reese's JDBC book's code. Beneath the JTable are buttons to add or edit a row in the JTable. These buttons open a separate JFrame to use as a detail form.

My question is: How can I coordinate data changes?

The RowSet could possibly be re-populated, leaving out our particular record in the detail form.

So are listeners the way to go? Or should I look at something more loosely coupled? Such as creating my own event bus to have each widget subscribe to events related to a particular table. Then each widget would look at each notification to see if the record id mentioned in the notification is a record of interest.
 
Andrey Kozhanov
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe you could try to use java.util.Observer/java.util.Observable functionality or indeed write your own event handling mechanism.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!