Add columns dynamically to JXTreeTable
I'm relatively new to SwingX and may be my problems are related to that.
Anyway, I've got a JXTreeTable which is populated with some standard informations. Now I want to add one timestamp column for each timestamp in a database table and display the entries according to their timestamps.
The problem is since the treeTable shall be aware of changes in the database (which can happen any time) showing and hiding columns will not work . So I will have to add and remove columns dynamically when an entry is added to or removed from the database.
The treeTable is intended to look like this:
Interval--Min--Max--[timestamp]... (and here may be multiple timestamp columns)
Interval1---0-----5------(entry for this timestamp)
Interval2---6-----10----(entry for this timestamp)
I implemented a TreeTableModel that recieves the database changes and updates both the nodes in the model and the columns in the treeTable. And it seems to work as far as the model is concerned.
But the column changes don't have any effect on the table which you can see in the window, no matter how many times I invoke the reload() method on the model or repaint() on the table itself. The rows on the other hand are updated and displayed correctly, .
Now the questions:
Is it possible to change the table structure (i.e. add/remove columns) of a JXTreeTable dynamically?
And if so, how do I do that?
I'd be very grateful for any suggestions.