jQuery in Action, 3rd edition
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes another topic for criteriaFind 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 "another topic for criteriaFind" Watch "another topic for criteriaFind" New topic

another topic for criteriaFind

Allen Chan
Ranch Hand

Joined: Jun 07, 2002
Posts: 64
Hi all,
I am still not clear about how we should handle the criteriaFind, obviously we should be able to perform a search by entering criteria (by entering into a text area or textfield)
"FLightNo='PA001',Destination='SFO', ...", but do we need to put two (or more combobox) there and let them select the flightno, dest, from, etc. After select they could start search
jay denzel
Ranch Hand

Joined: Sep 18, 2002
Posts: 57
hi allen,
my solution looks like this. The user can provide 6 criterias to search for a flight.
1. Flight Number -> TextField
2. Origin -> ComboBx dynamically filled with the distinct values of the corresponding column
3. Destination -> ComboBox dynamically filled with the distinct values of the corresponding column
4. Carrier -> ComboBox dynamically filled with the distinct values of the corresponding column
5. Day -> ComboBox static string array of all days of the week
6. Time -> TextField
With this information I build the criteria string, e.g. something like origin='SFO',day='Sun'
This string gets parsed, I check which column number is e.g origin and put column number and argument in a map. The map then looks something like this {1=SFO, 2=DEN, ... } Using column numbers is easier I think for comparing because they correspond to the index in DataInfo object.
The searching looks like this:

Hope this helps.
Andrea Gazzarini
Ranch Hand

Joined: Sep 09, 2002
Posts: 125
Hi allen,
My implementation looks like this:

I have a Criteria and Constraint class.
When the user click on the search action, the search dialog appears. The search fields displayed into this dialog is not hard-coded, but they are retrevied from the table column model, so if (for example) the underlying business object change, the search dialogs change with it.
The Search Dialog contains n pairs label/textfield
(the label show the property name and the textfield is the entry field). Each of these represents a "Constraint". The toString() method of the Constraint class returns:
All the constraints are managed (and contained into) by the Criteria class. The toString() of the Criteria class returns:
So the congruency search control are delegated to each Constraint object and a general check is performed by the Criteria object.
Hope this helps.

Regards,<br />Andrea<br /> <br /><a href="http://www.linkedin.com/in/andreagazzarini" target="_blank" rel="nofollow">Andrea Gazzarini</a><br />Skype ID : gazzax72<br />Google Talk ID : a.gazzarini@gmail.com<br /><a href="http://www.andreagazzarini.blogspot.com" target="_blank" rel="nofollow">My Blog</a>
I agree. Here's the link: http://aspose.com/file-tools
subject: another topic for criteriaFind
It's not a secret anymore!