• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Question about the use of JComboBox

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm on the documentation stage and after re-reading the instruction file again & again I've got confused over my design choice of providing JComboBox for every field.
I've created a TabbedPane on which there are 2 panels one for normal search (only for Origin & Destination fields) and other for all fields with one search JButton on both panels.
Will my extra effort of providing Advance Search panel cause some -ve impact ?
I�ve used the tabbed pane in view of future functionality enhancements.

And one more question:

As per the instruction we have


The user should be able to select the origin and destination of flights...


I think it implicitly instructs us to use the JComboBox filled with all possible values.
Am I right over this point?

I'm not filling the comboboxes with all possible values of orgin & destination but making a history of all the items entered on the JComboBoxes and storing them into a configuration file which automatically gets loaded at the startup and fills the comboboxes with the history values.
So now I feel that I�ve made some unnecessary extra efforts.

Pleas help me out from this confusion. Any comment will be appreciated.
Thanks & regards
Manish Kumar
 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Manish,
yeah - the extra work is difficult to avoid. Maybe it's a comfort for you that you learned something by doing it.
I pre-filled the combo boxes with all values, including a wildcard value. Many people have done so.
My criteria search accepted any combination of values, but my GUI provided only those specified in the instructions.
Hope this helps.
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mag,
You think that our criteriaFind needs to be able to search on all fields of the database, even though the UI should just allow Destination and Origin? I have only provided a search for to&from, doh!
Perhaps that is why the instructions provide an example of the search criteria containing an Origin....
Is there an easier way to parse the incoming String other than using StringTokenizer, as I used below:

Geez, looks like I have some more work to do
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dave, @see javax.util.regex
 
Mag Hoehme
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Dave Teare:
Mag,
You think that our criteriaFind needs to be able to search on all fields of the database, even though the UI should just allow Destination and Origin? I have only provided a search for to&from, doh!


I provided a generic method, which could process any database fields. I wanted to anticipate any changes to the database schema.



Is there an easier way to parse the incoming String other than using StringTokenizer, ...


I'm afraid - no. I had even two Tokenizers, one cutting the string for the criteria, and the second one for the key/value pair.
And in addition, I encapsulated the whole tokenizing stuff into a separate class.
Hope this helps.
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Dave Teare:

Is there an easier way to parse the incoming String other than using StringTokenizer, as I used below:


The way I did it is not necessarily easier, but I think it's more in the spirit of code re-use. I took advantage java.util.Properties.load(InputStream is). You wil l need to make some allowances for the fact that the default implementation does not allow spaces in the keys, as well properly wrapping the String into some sort of InputStream.
 
Manish Kumar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mag,

I've throw the java.text.ParseException from my criteriaFind method to indicate if the search criteria string does not follow the following comma separated format
<field name>=<value>
like:
Origin='SFO',destination='LAX'
ParseException also gives the position of the error.
so the following line will create an error at column 12
Origin='SFO,destination='LAX'
 
Everybody's invited. Even this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic