aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes About JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "About JTable" Watch "About JTable" New topic
Author

About JTable

Ray Cheeny
Ranch Hand

Joined: Aug 21, 2002
Posts: 74
Hi,
I'm designing the JTable and I've implemented AbstractTableModel.
But I don't know how to refresh the JTable,
fireTableCellUpdated(int�row,int�column) or
fireTableDataChanged()?
And where should I invoke that?
Nate Johnson
Ranch Hand

Joined: May 13, 2002
Posts: 301
I think either would work... I used both of them at different times and ended up using the one with the arguements because I put it right in my setValueAt(...) method because I could then just use the row and column that it was given for the fire method.
Make sense?


scwcd, scjd, scjp<br /><a href="http://natejohnson.us" target="_blank" rel="nofollow">http://natejohnson.us</a><br /><a href="http://rice.kuali.org" target="_blank" rel="nofollow">http://rice.kuali.org</a>
Ray Cheeny
Ranch Hand

Joined: Aug 21, 2002
Posts: 74
Hi,
Thanks.
The setValue(...) is in the AbstractTableModel and
I could invoke tableModel.setValue(...) in my View,
right?
But could you tell me where to invoke the fireTableDataChanged()?
I used both of them at different times

Would you please explain that in detail?
Nate Johnson
Ranch Hand

Joined: May 13, 2002
Posts: 301
Originally posted by Ray Cheeny:
The setValue(...) is in the AbstractTableModel and
I could invoke tableModel.setValue(...) in my View,
right?

I actually called it from my model when its state changed (ex: a seat was booked or a search took place).
Originally posted by Ray Cheeny:
But could you tell me where to invoke the fireTableDataChanged()?

Like I said... I put it right in the setValueAt method of my AbstractTableModel class like this...
Ray Cheeny
Ranch Hand

Joined: Aug 21, 2002
Posts: 74
Hi Nate,
Thanks,
I'll have a updateTable(DataInfo) in my tableModelIMpl and it will call the fireTableDataChange().Also,I'll call the updateTable(DataInfo) in my view.
How do you think about it?
I've two question about the Broker.
1>
private ArrayList brokerControllers = new ArrayList(10);

Why use ArrayList here?I think we just need one,right?
2>
private transient BrokerGui gui;

Why use transient here?Need I use it in my design?
3>Did you put the DataInfo,FieldInfo and DatabaseException in your Client.jar?I mean did
you use these class directly in your client design?
Nate Johnson
Ranch Hand

Joined: May 13, 2002
Posts: 301
Originally posted by Ray Cheeny:
I've two question about the Broker.
1>
Why use transient here?Need I use it in my design?
3>Did you put the DataInfo,FieldInfo and DatabaseException in your Client.jar?I mean did
you use these class directly in your client design?

About 1 and 2, I am not sure what you are asking... I never supplied that code and I am not sure if you are asking me if that looks ok or why it is doing what it is doing? Are you trying to implement a Broker patter? I am not too familiar with that pattern.
3) I wrapped all of the Data stuff in DAO classes because I did not want my GUI to be in any way dependant on the sun database... that way any database can be used without changing my GUI... all that would need to be done is add a few new DAO classes.
Ray Cheeny
Ranch Hand

Joined: Aug 21, 2002
Posts: 74
Sorry Nate,
The broker is from Sun Education course .I had thought you knew it.
When I design ClientConnection,I found a question.
The ClientConnecton need a reference to the RemoteInterface(provided all the public methods in Data).So I have to write the code
in my ClientConnection.
Does that mean I'll have to put the RemoteInterface
both in server.jar and client.jar ?
Nate Johnson
Ranch Hand

Joined: May 13, 2002
Posts: 301
Originally posted by Ray Cheeny:

The broker is from Sun Education course .I had thought you knew it.

I generally stick to the GoF patterns
Originally posted by Ray Cheeny:
When I design ClientConnection,I found a question.
The ClientConnecton need a reference to the RemoteInterface(provided all the public methods in Data).So I have to write the code
in my ClientConnection.
Does that mean I'll have to put the RemoteInterface
both in server.jar and client.jar ?

Yep! But I would recommend putting a factory in the registry and getting that factory from Naming in the client. Then the factory could pass back unique RemoteData objects (make locking easy when you get to that point).
Ray Cheeny
Ranch Hand

Joined: Aug 21, 2002
Posts: 74
Hi Nate,
1>I have had a factory(return a unique RemoteData ) in my server side .Do you mean I also need a factory in my client ?Why?
2>According to the instructors,I will let the user
choose local/network.But I don't know whether the user should choose it from command line or GUI?
Nate Johnson
Ranch Hand

Joined: May 13, 2002
Posts: 301
Originally posted by Ray Cheeny:

1>I have had a factory(return a unique RemoteData ) in my server side .Do you mean I also need a factory in my client ?Why?

I had two... it is up to you. The factory that I had on my client would look at the command line args and determine which kind of DataAccess object to return and use throughout the rest of the life of the client... you probably didnt need a factory for this, but I liked it that way.
Originally posted by Ray Cheeny:

2>According to the instructors,I will let the user choose local/network.But I don't know whether the user should choose it from command line or GUI?

I did both... if the user used the command line, the options would be transfered to the GUI for confirmation or changing.
 
 
subject: About JTable