|
|
|
Re: Show a list of child elements in property view [message #637334 is a reply to message #637311] |
Fri, 05 November 2010 06:28 |
Ed Merks Messages: 33137 Registered: July 2009 |
Senior Member |
|
|
Michael,
Comments below.
Michael wrote:
> Hello Mr. Merks,
>
> first of all thank you for the quick help.
> I tried it similar to the two examples you gave me. This is what I
> have done:
>
>
> public List<IItemPropertyDescriptor> getPropertyDescriptors(Object
> object) {
> if (itemPropertyDescriptors == null) {
>
> super.getPropertyDescriptors(object);
You're still caching them. Think about what happens for different
instances of the object though. Each one will need its own set of
descriptors so either you need to stop using singletons or you need to
recompute the set of descriptors each time.
>
> Parameter para = (Parameter) object;
> EList<Value> values = para.getValues();
>
> for (Value value : values) {
> for (IItemPropertyDescriptor itemPropertyDescriptor :
> itemDelegator.getPropertyDescriptors(value)) {
>
> itemPropertyDescriptors.add(new
> ItemPropertyDescriptorDecorator(value, itemPropertyDescriptor) {
>
> @Override
> public String getCategory(Object thisObject) {
> return "Value " + ((Value) object).getName();
> }
>
> });
>
> }
> }
>
> }
>
> return itemPropertyDescriptors;
> }
>
>
> Now three problems still remaining.
>
> 1. The property values (getPropertyValue) of all values are from the
> same value object. They are all from the first value in the values
> list. I don't understand why? Because the decorater gets the correct
> value during the instantiation.
It's not obvious why, but a few breakpoints should help. Is this
another issue with singletons verses stateful adapters?
>
> 2. Parameter and Value extend both the class Element and Element has
> the field "name". So the generated ElementItemProvider adds the
> ItemPropertyDescriptor for the name property. Now I have the problem
> that the name of all values is the name of the parameter. Is there a
> simple way to handle this?
The names of the properties must be unique so you'll have to do
something to make it unique.
>
> 3. If I click on the Parameter, I get almost the structure which I
> described in my first post. But when I click on a other object type in
> my navigator tree, so that the properties view changes and click now
> back on the parameter, the structure is destroyed. Now all Value
> properties are in one category together with the name of the parameter
> object.
There are definitely issues with not caching or changing to be stateful.
>
> I have the assumption, that all problems have the same source.
>
> I hope I was precisely enough with my description.
>
> Regards,
>
> Michael
>
> PS: Sorry for my very bad english, I hope you understand what I mean.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03050 seconds