Update TreeList if TreeList.Format changes

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Update TreeList if TreeList.Format changes

Dirk Fauth
This post has NOT been accepted by the mailing list yet.
Hi,

in NatTable we provide a feature called GroupBy which is based on GlazedLists TreeList. A user is able to drag a column in a specified area to start a grouping. This means to build up a tree dynamically for the selected column as tree node.

Our implementation works fine, despite the performance on update.

Our TreeList.Format contains dynamic code so the path is created dependent on the user selection. So if a user performs grouping actions, the TreeList needs to get updated. I first thought about simply setting the Format new to trigger the update, but I came across this issue that says it is not implemented:

http://java.net/jira/browse/GLAZEDLISTS-521

By digging deeper I found this entry in the mailing list:

http://glazedlists.1045722.n5.nabble.com/sorting-a-treelist-td4704550.html

This works nice, but the performance is not so good (which is understandable since this solution iterates over the whole table). Performing a clear and addAll increases the performance a bit, but not significantly.

I'm not sure if I'm doing things right. So I wanted to ask if there is a better way to trigger an update. Although I also think that creating a dynamic tree structure which adds nodes will always need its time.

Greez,
Dirk