My current plan is to have 2 JComboBoxes for the name and location fields because it is easier to use (compare to JTextFields) and i don't to have to worry about case-sensitivity, and invalid entries.
The problem with this plan is:
Suppose the original db file has location 'New York'and later some other application adds to the db file a new locations 'new york'.
Q1: Should i interpret these two entries as different locations. If so, my location combobox will have two choices for the same geographical place! Is this ok? Implementing location JTextField will not have this "visual" problem.
Q2a: Since assignment allows only book and search, is it ok to populate the JComboBox *ONCE* at the start of the client application and forget about it.
Q2b. Or should i refresh the JComboBoxes everytime the 'search' button is clicked or when the table is refreshed. This caters for database being updated by other applications otherwise the items in comboboxes will be stale.
What if the user wants to view all records, or just perform a search on one of the two fields?
This is my plan.
1. User wants to view all records:
The name and location combobox each has an wildcard item "any name" and any location" respectively. User selects these and click on the "Search" button to view all records. This suffices for standalone mode.
But i plan to have an additional button "Refresh Table" to facilitate "user-friendliness" for network client mode. Suppose User A wants to book Contractor 1. He highlights Contractor 1 and presses "Book" button. However, he was a fraction too slow. User B booked it just before User A pressed "Book". User A will get a pop-up message box that states "Contractor 1 has been booked. Please refresh table and select another". So the "Refresh Table" facilitates that. He could have refreshed the table by choosing the wildcard items in the name & location comboboxes and pressed "Search" but this takes more steps.
2. User wants to just perform a search on one of the two fields?
Without loss of generality, suppose he wants to do a search on name. He selects one of the items in the name combobox and choose the "any location" wildcard item in the location combobox.
Hope it helps.
[Derek]: Suppose the original db file has location 'New York'and later some other application adds to the db file a new locations 'new york'. Q1: Should i interpret these two entries as different locations.
So i should interpret them as same location. Does this mean that on the server side, findByCriteria returns two record numbers, one for 'New York' and another for 'new york' and an adapter class filters them and returns just one record to the client's gui? So the search method in the adapter will have to use String.equalsIgnoreCase() instead of String.equals().
Is this what you mean?