Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thinking about Table Models...

Gregg Bolinger
Ranch Hand
Posts: 15304
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Last night I was trying to sleep but I kept pondering on this Table Model I was going to have to work on today. It's not that complex but I wondered if there was a better way.

Currently, we extend AbstractTableModel and supply the methods for handling the data. By default this is done with a String[] of column headers and an Object[][] for the data. In the past I have changed my model to work with Vectors and ArrayLists instead because of the type of collections being returned that contained the data.

So last night I am lying in bed and wondering if it would be possible to use Collections of JavaBeans or POJO's for the data. How difficult would it be to modify my table model to pull out the data from there. Obviously this would limit your table model to specific data and not be very reusable, unless you could come up with a fancy way of using Generics to better support different types of data.

Anyway, I haven't had a chance to work on this yet but I thought I'd get the thought process rolling here in case anyone else has ever thought of or successfully achieved what I am going to try and go. I'll update this thread throughout the day of progress and/or questions I have. Who knows, it might not be possible at all.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic