wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes displaying recNo in gui Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "displaying recNo in gui" Watch "displaying recNo in gui" New topic
Author

displaying recNo in gui

Dmitri Christo
Ranch Hand

Joined: Jan 19, 2007
Posts: 81
Hello,

I was wondering if it is allowed to display the recNo in the gui along with the rest of the fields of a record. Because recNo (or primary key) is not formally part of the record. There is no specific directive on this in the instructions, so would you recommend such information to be displayed to the user?

I understand the user is not going to be bothered with the recNo of every record. But my question comes from what is the best way to capture the user's selection? Based on the fact that the lock/update/unlock methods (which the book/un-book functionalities are composed of) take recNo for an argument, shouldn't the gui design capture the recNo like:



Has anyone done or considered doing this?

Many thanks
Thomas Heiss
Greenhorn

Joined: Feb 20, 2008
Posts: 9
Isn't the recno the contractor id (for B&S)?

Well, I am not too sure as my parsing of the db file has not started yet

But how else would you know what to lock for an update?

If the recno is the primary key of the data which is modelled in the database as a row, I would display it in the table, too.


Technical J2EE Solution Consultant<br /> - Specialist for Middleware and Messaging solutions --<br />Certified SCJP 5.0, SCBCD 1.3, SCEA I (SCJD, SCEA II/III running)
Dmitri Christo
Ranch Hand

Joined: Jan 19, 2007
Posts: 81
Yes, that makes sense. I just had doubts since this information is not part of the record as described in the instructions. But without a primary key column in a table that holds records how can you correctly select the record?

I think you are right. It should be displayed.
Oguz Ozun
Greenhorn

Joined: May 10, 2007
Posts: 19
In my opinion, you should keep them in the model of the table to identify the selected record but you shouldn't display them. You have a control over the view what to display and how to display. Think about getColumnCount and getValueAt methods of AbstractTableModel. They can help you to hide this field.
Dmitri Christo
Ranch Hand

Joined: Jan 19, 2007
Posts: 81
Thanks for pointing this out. I was thinking that if my recNo/primary key was composed of the fields of the record, like some other ranchers have done, then I wouldn't have this dillema...

On the other hand, is displaying the recNo on the table a risk of automatic failure? - Or would it cost me marks? Is there a way of being sure?

Thanks again
Dmitri Christo
Ranch Hand

Joined: Jan 19, 2007
Posts: 81
..just found this thread discussing a similar issue. It seems hiding a column from the user's view might not be the optimal way to go, but I think it helps
[ February 23, 2008: Message edited by: Dmitri Christo ]
Oguz Ozun
Greenhorn

Joined: May 10, 2007
Posts: 19
Hi,

I think you got me wrong. When I say "hide", I mean "do not put that field into the view" , "do not even display" or "do not create even a column in the view for that field - even its width set to 0". I am just saying ignore that field when rendering the table.

I hope that this time I made myself clear.
Dmitri Christo
Ranch Hand

Joined: Jan 19, 2007
Posts: 81
Ok it's clear now what you mean, but I can't seem to figure out how to actually implement your idea. I believe the system needs to capture recNo information from the record (row) the user has selected.

I can't think of a way to pass the recNo to the gui controller if I can't determine what the user has selected at the view/display layer. I am sorry if I am missing something obvious. That's why I agreed with Thomas above.

If you wouldn't mind perhaps you could explain a little bit further? Thanks
Oguz Ozun
Greenhorn

Joined: May 10, 2007
Posts: 19


In client/server application you can get whole String array (including "D") like statements given below:


I didn't check the code snippet and I think from that you can get the idea
Dmitri Christo
Ranch Hand

Joined: Jan 19, 2007
Posts: 81
I appreciate your help. I will certainly give it a try!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: displaying recNo in gui
 
Similar Threads
update-locking
B&S : recNo in My JTable
JTable Freezes...Help!
NX: Client side lock vs Server side lock
Terminology Clarification