Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

displaying recNo in gui

 
Dmitri Christo
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dmitri Christo
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
..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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I appreciate your help. I will certainly give it a try!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic