File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Initial display of data. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Initial display of data." Watch "Initial display of data." New topic
Author

Initial display of data.

Olena Golub
Ranch Hand

Joined: Jan 17, 2005
Posts: 113
Hi,
I am still staying with the same problem with displaying the initial data into my Table after the application have been started.
I have some ideas but i am not sure what idea is correct or more reasonable.

1. Search for all records by calling the SUN-provided method find(String[] criteria) with empty criteria. It's my favorite

2. Call the SUN-provided method read(int recNo) up to that time i recieve a RecordNotFoundException.
But i think this is not a good idea, because RecordNotFoundException will be thrown when the record has a deleted flag. And this stops after the first deleted record will be found.

3. To provide one of two additional method in the DataAdaptor: getRecordCount() or getAllRecords()
But i am not sure if it is right.

How do you think what is the best way to do this? Or do you have another ideas?
I am very appreciated for you comments.

Thanks
Olena


SCJP 1.4<br />SCJD 1.4 (in progress)
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I've implemented No 1, pretty much because you need to implement a find method which returns all results anyway. So doesn't really require any extra work.

I wouldn't have implemented option 2 due to the reasons you give.

Option 3 is do-able, I believe, as its been mentioned else where that you CAN extend the interface provided by Sun. Whether it provides an easier or cleaner implementation than option 1 is open to debate. I think some folks have implemented this option though.

Cheers,
Matt.
Arun Subramanian
Ranch Hand

Joined: Oct 30, 2002
Posts: 47
3. To provide one of two additional method in the DataAdaptor: getRecordCount() or getAllRecords()
But i am not sure if it is right.


I am using a "getRecordCount()" approach which is defined in my implementation of the SUN provided Data Interface. This gives my TableModel the number of rows for initial display. I also have a "getSchemaDescription()" method (again defined in the same above implementation) for storing the database file schema information and which gives my TableModel the number of columns for initial display.

Thanks,
Arun.


SCJP 1.4, SCBCD 1.3, SCWCD 5.0, SCJD B&S 2.3.1 (in progress)
Frans Janssen
Ranch Hand

Joined: Dec 29, 2004
Posts: 357
Hi Olena,

I opted for no. 1 too. Why implement another solution when you have to make the find method anyway?

Frans.


SCJP 1.4, SCJD
Olena Golub
Ranch Hand

Joined: Jan 17, 2005
Posts: 113
Matt, Arun and Frans thanks a lot for you comments.
I will stay with my favorit
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Initial display of data.