You didn't got the main idea, I guess. The getAssociatedObjects method is not about transfering anything like ordering and filtering. Of cause this can be a list but why?Personally I prefer to use the List instead of Object[] for reasons like flexibility, easy sorting and filtering etc. But it really is no big deal, I can of course convert the object array to a List inside the View anyway.
This is not the model of the view only of the viewer (tree or what ever). It is also nothing to be synchronized with the domain or something like that. Please return me all your children and that's it.
Maybe. The question raises about what you do, when you feed a tree viewer with some content.Please correct me if I'm wrong, but it seems to me we were talking a bit past each other and we don't really disagree that much on this issue.
It is only about the viewer's needs. A node of a tree or list is composed of an image and a text (label). This is what the label provider is all about. Using a table label provider is somewhat diffrent, too.I would not have a labelprovider that is potentially tied to all my domain objects. Besides, using a Provider for simply setting a label seems like overkill. And you need labels for your Customer fields too. How do you handle those?
You can do as you please. But the some other config and all labels is somewhat confusing. Again the label provider is only an adapter for your domain model elements and nothing more special.I prefer having all labels and some other config info for each domain object in separate classes.
In my framework I use reflection to get all fields from a domain model class using what I call a BeanPicker:
Your bean picker is quite heavy weight but seams to be very handy. I often used reflection, too but now I mostly try to avoid it. It is not quite good programming habbit to inspect an object. I would go for something like a type called NamedItem or something like that.The BeanPicker has a few other methods like setting which property is editable etc.
But anyway your solution is quite nice, I guess. But it is nothing the label provider is about. It is simply an adapter for the viewer being used by some view. Nothing more but nothing less.
Cheers,
Martin (Kersten)[/quote]


Reply With Quote