Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is there any possibility of changing the db.db file??

 
jyothi sunke
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
My searchGUI contains 3 labels, 3 comboboxes and 2 buttons. The user can select origin, destination and carrier from this GUI and matched records will dispaly in ResultsGUI.
In this process, I took two vectors..
one for airports(origin, destination),
another for carrier fileds.
I took the values of both airports and carrier from db.db file and added them to vector. And later that vector added to corresponding ComboBox.
Means, what I did is I manually added the values of origin,destination and carrier fields of db.db file to the comboboxes. If sun people change the db.db file records(origin,destination and carrier fields values to some other values) my appilication won't work.
Is there any possibility of changing that db.db file??
My application works fine with the db.db file given to me. Should my procedure be generic??
Please suggest me in this regard..
Thanks in advance..
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it is possible that the data might change, and hard coding the JComboBoxes isn't the best solution.
It is possible with the classes provided, and a little coding to get the unique values of any field, and use that to fill your JComboBoxes.
Mark
 
jyothi sunke
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Mark!!!
I will work on that...
 
Daniela Ch
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mark Spritzler:
Yes it is possible that the data might change, and hard coding the JComboBoxes isn't the best solution.
It is possible with the classes provided, and a little coding to get the unique values of any field, and use that to fill your JComboBoxes.
Mark


Ok, I can manage to get the unique values of any field dynamically from the database using a method in my Facade.
But I have to at least give the name of the field to this method.
Or maybe hardcode it in getDestinationAirports() wich can call the generic method?
Or maybe make a HashTable like Aleksey said :

Aleksey Matiychenko
ranch hand
Member # 11948
In my data class constructor I added a call to createFieldIndex method which populates a hashtable with names of the columns as keys and their index as values

Or maybe like Micheal Morris did make an inteface that have all the field names and their number?
...
/Daniela
 
John Lee
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jyothi sunke:
Means, what I did is I manually added the values of origin,destination and carrier fields of db.db file to the comboboxes. If sun people change the db.db file records(origin,destination and carrier fields values to some other values) my appilication won't work.
Is there any possibility of changing that db.db file??

I think Sun people probablly won't change db.db to test your code. But I think you better explain your design in document. There are pros and cons, under some circumstance, your design may be practical.
 
Daniela Ch
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, but still, I want to find a way to avoid hardcoding the fields, or if it is impossible, to know where to do it...
/Daniela
[ December 25, 2002: Message edited by: Daniela Ch ]
 
John Lee
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did the assignment ~15 months ago. Actually it is pretty easy. When you use RMI model, you can just search the db.db at client side, accumulating all the different fields, then input them to combobox.
 
Daniela Ch
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hhmm...
 
Daniela Ch
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone else give me his/her advice on this?
/Daniela
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic