Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-incubator-e4-dev] Initial discussion onthe'modelled'workbench UI

I don't know why EGUIElement inherites from EPresentationModelElement and
EStyle.

How about this:
                    EPresentationModelElement
                                ^
                                |
                    ---------------------------
                    |                         |
                    |                         |
              EGUIElement x------------>EStyleProvider
                                      0..1    ^
                                              |
                                      ECSSStyle, or others

yves
> Hi,
>
> In my current EricToTom-Transformation I've modeled it currently like
> this:
>
> EPresentationModelElement                  EStyle
>     ^                                        ^ ^
>     |                                        | |
>     -----------------------------------------| |
>                    |                           |
>                    |                           |
>              EGUIElement x------------> EStyleClass
>                                    0..1
>
> Tom
>
> Yves YANG schrieb:
>>> public class UIElement {
>>>    private Style style;
>>>
>>>    private class WrappedStyle extends Style {
>>>        private HashMap ownMap = new HashMap();
>>>
>>>        private WrappedStyle(Style style) {
>>>            this.style = style;
>>>        }
>>>
>>>        public String get(String name) {
>>>           if( ownMap.contains(name) ) {
>>>              return ownMap.get(name);
>>>           }
>>>        }
>>>
>>>        public void set(String name, String value) {
>>>           ownMap.put(name,value);
>>>        }
>>>    }
>>>
>>>    // Allows reading without the need to wrap
>>>    public String getStyleAttribute(String name) {
>>>        return style.get(name)
>>>    }
>>>
>>>
>>>    public String setStyleAttribute(String name, String value) {
>>>        getStyle().set(name,value);
>>>    }
>>>
>>>    public Style getStyle() {
>>>        if( !( style instanceof WrappedStyle ) ) {
>>>            this.style = new WrappedStyle(this.style);
>>>        }
>>>
>>>        return style;
>>>    }
>>> }
>>
>> In general, we have the same idea.
>> Here is what I suggest:
>> public class UIElement {
>>     private Style style;
>>     private HashMap ownMap = new HashMap();
>>
>>     // Allows reading without the need to wrap
>>     public Object getValue(String name) {
>> 	  if (ownMap.containsKey(name)) {
>> 		return ownMap.get(name);
>> 	  }
>> 	  return getDefaultValue(name);
>>     }
>>
>>     protected Object getDefaultValue (String name) {
>> 	  if (style != null) {
>> 		return style.get(name);
>> 	  }
>> 	  return null;
>>     }
>>
>>     public Object getLocalValue(String name) {
>>        return ownMap.get(name);
>>     }
>>
>>     public boolean hasLocalValue(String name) {
>>        return ownMap.containsKey(name);
>>     }
>>     public void unsetValue(String name) {
>>        ownMap.remove(name);
>>     }
>>
>>     public void setValue(String name, Object value) {
>>         ownMap.set(name, value);
>>     }
>>
>>     public Style getStyle() {
>>         return style;
>>     }
>> }
>>
>> Style is subclass UIElement.
>>
>> yves
>>
>> _______________________________________________
>> eclipse-incubator-e4-dev mailing list
>> eclipse-incubator-e4-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/eclipse-incubator-e4-dev
>
>
> --
> B e s t S o l u t i o n . a t                        EDV Systemhaus GmbH
> ------------------------------------------------------------------------
> tom schindl                               leiter softwareentwicklung/CSO
> ------------------------------------------------------------------------
> eduard-bodem-gasse 8/3    A-6020 innsbruck      phone    ++43 512 935834
> _______________________________________________
> eclipse-incubator-e4-dev mailing list
> eclipse-incubator-e4-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipse-incubator-e4-dev
>




Back to the top