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

Hi,

The final solution could look like this you are right but I'm trying to stay as close to Eric's current code as possible. The nice thing is once I have Eric's model transformed we can use refactoring and javac-compiler support (another reason why I'm not provideing the minimal EMFless API in the first draft) to easily rearrage the model.

I just need to get commit rights to the incubator :-) I could in the time until this happens open a bug and attach my projects there (although their are currently in a not runnable state nor they are the FINAL solution to the transformation so they should not be the reason to drop EMF).

Tom

yves.yang@xxxxxxxxxxx schrieb:
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



_______________________________________________
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


Back to the top