Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipse-incubator-e4-dev] Declarative UI, EMF vs DOM?

Hi,

I don't know if my title post is correct, but I would like start this topic to write something into Wiki.
I say EMF (or another thing) vs DOM because I would like purpose TK-UI to manage Decalarative UI and set pro/cons for EMF and TK-UI.

TK-UI is Toolkit for User Interface where you can describe your UI with any XML markup (today XUL and XHTML start to be
implemented and I have intention to implement XForms) and you can mix XML markup into the same description.

<html:input type="text" id="myInput" />
<xul:textbox />

TK-UI manage UI with DOM Document like WebBrowser DOM Document (with _javascript_).

Document document = ....
HTMLElementInput input = document.getElementById('myInput');
input.setValue("bla bla bla");

I have read into this forum that EMF please a lot of people to manage Declarative UI.
And here that I have understood

User describe UI with XMI into Window.xmi like this :

<xmi:XMI xmi:version="2.0"
        xmlns:xmi="http://www.omg.org/XMI" >
  <Window>
    <Textbox value="bla bla bla" />
  </Window>
</xmi:XMI>

And it load it with ResourceSet :

URI fileURI = URI.createFileURI(new File("Window.xmi").getAbsolutePath());
Resource resource = resourceSet.getResource(fileURI, true);

Window /* EObject */ window = resource.????;
Textbox textbox = window.????
textbox.setValue("XXXXXX");

So here how I have understood the final UI API.
Is it correct?

So with EMF UI is managed with Ecore model (EObject...) and custom java method (setValue)
and with TK-UI UI is managed with DOM Document and custom java method (setValue).

Here pro/cons for EMF and DOM that I see :

EMF :

    pro:
       1. Provide a model (XSD, XMI..) to define structure of widget (Window, Textbox...)
       2. Provide a lot of tools to manage EMF.
   
    cons:
       1. New API to learn for developer (like me) who doesn't know EMF (but perhaps EMF is very knowed?).
     
DOM (TK-UI) :

     pro:
         1. Manage UI with DOM Document :
             1.1 : use getElementById, XPath to retrieve widget
             1.2 :  use addEventListener to add click event
             1.3  : use  createElement, appendChild to add  widget  to the UI at runtime, use removeChild to remove widget.
        2. DOM Document API is knowed by a lot of pepople who develop Web with _javascript_.      

     cons:
         1. (Today) : doesn't provide model (XSD, XMI...) to generate TK-UI Element (ex : HTMLInputElementImpl).

So EMF is attractive for the model but I think taht Eclipse E4 must think about developer who wants use API to manage Decalarative UI.
Do you prefer use EMF API or DOM API to manage UI?

With the 2 solutions (EMF, DOM), we must develop some code to bind (EMF java model (Textbox)/DOM Element)
with SWT Text widget. So we need develop something.

JFace Databinding seems good to manage that. It exists (EMF Jface Databinding project) and me I have developped
(DOM JFace Databinding).

I hope this topic will interest some people.

Regards Angelo

Back to the top