Hi Chris,
Thanks for your reply.
I think you are right that for future enhancements they refer to changing the UI functionality. I also found that issue - in my DB interface provided by SUN there are create and delete methods and in the same time this functionality is not required in the client?!?! I leave this issue for now because I have not thought on this.. :roll:
Let's go back to my previous concern of parsing the db file:
Well to be honest i did use the header information to obtain the field names and sizes for my columns. However then i hardcoded the UI in terms of column names etc.
Now what if someone changes column name?? you need to change your code ah?
So you are getting part of the information dynamically and other part static hardcoded! Do you think it is a good idea?
Some people say hardcode is not good - I could not agree with that statement in a way that if a constant is designed to be a constant it must me hardcoded. If this value may be changed in the future it is not a constant and I agree hardcoded is not good)). Having said all that I'm thinking on 2 approaches here:
1. SUN never say explicitly that the format of the file would be changed! Considering the data provided like
Subcontractor ---- name ---- 32 I can hardcode those values and my code will be simple and will work. Now if something changes field length or new field added - code will break ))).
On the other hand:
2. I can parse the db file during the initialization and put the data in HashMap or whatever.. and use this values later to set in JTable. This approach I agree is more flexible but add another layer of complexity...
Did SUN intentionally make this vague enough or they would like either approach if this is documented detailed in the
doc...?
It took me a couple of hours to create a small program to parse the file. Now it will take me days to research what approach to take...
Please guys tell me if I am on the right road or not? and what approaches you made regarding this?
Regards,
Nick