complex label provider for multi-level tree viewer [message #728732] |
Fri, 23 September 2011 19:44 |
Matthieu Rethers Messages: 1 Registered: September 2011 |
Junior Member |
|
|
Hi Everyone,
First let look at the structure:
class Artifact {
RecordSet uncategorized;
RecordSet all;
List<RecordSet> categorized;
}
class RecordSet {
String name;
List<Record> records;
}
Pretty simple. Now I want a tree viewer that would represent my artifact as such:
+ all (150)
+++ uncategorized (100)
+++ categorized
++++ category 1 (10)
++++ category 2 (40)
I get this structure to display just fine so far.
Now the label provider... The tree viewer is backed up by an Artifact instance that changes according to the editor that is opened. As I'm adding records to the RecordSets, I want to change the count on the above labels. So the logic would be to use some kind of master detail observable and an ObservableMapLabelProvider. This is where it gets complicated. How do I tell the label provider to listen to changes in my nested categories as well as in my uncategorized and all RecordSet? Also ideally I'd like categorized label to show total across children categories.
I have the feeling that it all boils down to how I define the content provider and then use a observeEach on the known elements but I'm clueless at this point.
I'm having a really hard time finding documentation on non-trivial databindings and would really appreciate some helps here.
Thanks
|
|
|
Powered by
FUDForum. Page generated in 0.02988 seconds