• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FlightTableModel

 
Mario Zott
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello to all, I have some thoughts about the implementation of the TableModel:
1. I use a FlightController class to do the business logic, which contains a method criteriaFind... this version of criteriaFind calls Data's criteriafind and assembles with the result a FlightTableModel, which i use in the JTable. But it creates a New Model for every search - is this ok... or should i only set values..?
2. next question is what should the TableModel contain ... an Object[][] with all datarows or
simply an Object[] with all DataInfo objects in it...? - I think the DataInfo version comes in handy - because you have all in one (fieldnames, recordNr....)
any thoughts on this?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Having anew TableModel for each new query is fine. I had that approach. My Data class returns a DataInfo[] in criteriaFind, which I just pass to the constructor of me DefaultTableModel, which has one method to change the DataInfo[] into Object[][] which the DefaultTableModel understands, then use setTable in my JTable. Three lines of code and that's all.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic