TableHeaderComponent & TableListBoxModel?

hum.. why is the table header not managed by the tableModelList ? it would make sense to me that the number of columns and their names depends on the table model for instance. I think that in most cases, when you set a model to a table, you want its header to change according to that model, no?

Or we should have a kind of TableHeaderModel ?

Hum.. just some thoughts. but am I thinking that the wrong way ?

Well, the reason that there's a virtual "model" class for the table is because it's used throughout the lifetime of the table to provide data on-demand for the cells. But the header just gets set-up once and then is allowed to run itself, so it doesn't need a model to refer to. True, I could have given the TableListModel a method which gets called to initialise the header, but don't think it would have made anything simpler.

>  but don't think it would have made anything simpler

well, here is a common case I think :
the number of columns and their names depends on the type of data the TableListModels point to (or contain).
when a TableListModel is given to a table through table->setModel() then you also have to set up all your header with many many table->getHeader()->… 
And if you use different tables to which you want to give that model, that can be quite a lot of lines.. 
and if you want to change your table model in runtime, you have to do that again.
I can't have a component which inherits TableList and implements that logic, because if the table does not know what TableListModel will show, it won't be able to set up its header correctly.
If the header was set up in the model that would be done automatically, or we could just call something like updateHeader().
but again, maybe I'm not approaching that the right way?

I really don't think it'd be any better if the model handled that, and it'd make it much harder to do things like save/restore the header state. If you find yourself writing a lot of repeated code, that just means you need to clean things up and write in a more D.R.Y. style.

ok, thanks for your answers!