• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on GUI

 
Sai Patnala
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a question.
I am developing GUI modules first to start with for the assignment.
I am trying to extend Data class and add methods like String[] getFieldNames(), String[] getValuesFor(String fieldName), etc.
getFieldNames gives me all the field names. I thought writing this way makes it dynamic. Even if a new fields are added to database, still this code works.
Similarly, getValuesFor method gives me list of values for a particular fieldName like source or destination.
Is there anyone who tried like this. What is the best way to do in this kind of situations.
- Sai
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well getting fieldNames is in the FieldInfo class, so adding it to the Data class is redundancy.
Creating a Wrapper class or Facade to the Data class can provide these kind of messages so that it will hide the "Complexity" of getting all the uniqe values, that you are looking for.
You will have to come up with very strong case for modifying the Data class in this way. (Please note, I am not saying that modifying the Data class is a no-no in the assignment. Because this is your decision. )
Mark
 
Sai Patnala
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mark.
FieldInfo class has name and length methods.
What i was looking for is in Data or subclass of it, methods which can give me a particular column values say flight number, or source etc.
I just kind of started doing the assignment. I was playing with it for awhile to see what all functionality it has to provide me first. I havent yet taken any design decisions. I thought using it extensively helps me learn more.
Another question, do we have to provide client side validation at all? I was considering it and already provided a little bit. I am trying to extend it little more that no wrong selection has been made by the user.
- sai
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually if you use JComboboxes for searching and JTable for displaying the flights, the only "Validation" you need is when the user enters the number of seats to book. And only if you want do you check to see that the number is positive and not larger than the number of currently available seats.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic