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 B&S: GUI and Search functionality 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 "B&S: GUI and Search functionality" Watch "B&S: GUI and Search functionality" New topic
Author

B&S: GUI and Search functionality

Mickey Mulligan
Greenhorn

Joined: Feb 26, 2006
Posts: 20
I've found the most confusing aspect of the project to be designing a GUI using Swing. At the moment I'm trying to create a JDialog used for searching.

I have a SearchDialog class, which extends JDialog . This returns a container object called SearchCriteria with the name and location for the search.

In the constructor for SearchDialog, there's a call to this.setVisible(true). Is this the "correct" way to do this, or should it be called from the class which instantiates SearchDialog.

In the UI requirements Sun says:

"It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user."


I've noticed others have been confused by this. What's the general take? My application currently has one button to "Retrieve all" (ie. search for all records), and another to perform a name/location search.
henry ang
Greenhorn

Joined: Dec 19, 2006
Posts: 12
Hi all,

I think this topic has been discussed before, but it seems the general answer is not clear or satisfactory.

Consider the requirement again "It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user."

I think the second part for records "where the name and/or location fields exactly match values specified by the user" is quite clear

However notice the wording of this requirements.. there is a "OR" One must allow user to search the data for all records OR. In a logical sense, one could have interpret the English meaning as.. if you do the former..u can ignore the latter.. since it is a OR not a AND requirement.

I guess the only unclear thing is when implementing the former - must allow the user the search the data for all records.

TO me, the first layman approach would be to have six field jtextboxes that allow user to search either by name,location,specialties,size,rate and owner.

However, there is another approach to it, you could have only a jtextbox that search any data (regardless of fields) that matches the record.

Or last, implement both the former and latter (requirements)

Can anyone who has already passed the exam comment on this
OR share with us the gui display of the search panel.

Millions of thanks in advance!!


-------------------------<br />SCSA,SCNA,SCJP,SCEA
Muhammad Shafique
Ranch Hand

Joined: Sep 30, 2006
Posts: 59
I am working on similar assignment and have same requirements.

The find method in DBMain interface says:

// Returns an array of record numbers that match the specified
// criteria. Field n in the database file is described by
// criteria[n]. A null value in criteria[n] matches any field
// value. A non-null value in criteria[n] matches any field
// value that begins with criteria[n]. (For example, "Fred"
// matches "Fred" or "Freddy".)
public int [] find(String [] criteria)

First, the number of criteria elements MUST not exceed number of fields in one record in DB. This find method should be at DB layer and could be used for both (alone, server) modes.

For search, GUI part says:
"It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user."

Now here we need records not their physical location numbers in DB after search is done. I think the first half of above statement simply means bring all records from the DB and second half means that search is based on both name and location or any one of them (when second/first is null/empty).

The search JDialog box which I designed has two text fields (name, location) and two check boxes (Select All, Case Sensitive). Case Sensitive check box works in case of field based search only.

This is my understanding, specifications are quite confusing. I am also skeptical about many such things.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: B&S: GUI and Search functionality