• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Updating of JTable cell for emote connection

 
Stephen Gest
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm working on the UrlyBird application, and I'm having some trouble updating the JTable for the customer id cell for a given row when a CSR books a record. I use my own table model extended from AbstractTableModel, and overrode setValueAt to set the data within the appropriate cell, and fireTableCellUpdated(rowIndex, columnIndex) to update the table as efficiently as possible. For local connections, the cell updates correctly
when a record is booked. For remote connections, the client is notified
through an event that a particular record has changed. Within the implementation of this particular event listener, I have TableModel as instance data. When the event notification occurs, in the event interface implementation, I call tableModel.setValueAt with the event data passed in.
In this case, the call to fireTableCellUpdated(rowIndex, columnIndex) within my table model implementation does not do anything.

I suspected that the event listeners within the table model were not getting serialized when the event listener was marshalled across the wire in the call to addListener on the remote object. However, in the event callback, I did a call to retrieve the event listeners within the model, and there was one still registered.

Has anyone ever encountered this before?

Thanks,

Stephen
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Stephen,

I assume you are talking about updating a client other than the client who booked the record.

Simple solution: This is not required for the assignment .

Longer solution: You will need to make all your clients observers of the server. From memory you cannot use the standard JDK Observer / Observable due to other classes you must extend, so you will have to create your own implementation of the Observable design pattern. In order for your server to send messages to all registered observers, the observers will need to be Remote objects themselves so that the server can call a remote method.

All I have given so far is very broad hints - feel free to ask for clarification.

Regards, Andrew
 
Stephen Gest
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Andrew.... I think I have enough to go on. What I forgot was that the server invoking the client was a remote call as well! I got one client to update remotely, so I'll modify the code to follow a more Observer-like pattern.

Thanks again!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic