[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-dev] Re: [DataBinding] DOM and Rhino JFace Databinding implementation.

Hi Angelo,

Sorry for not responding earlier - I was (mentally) far away from work for a long weekend.

First, I agree with Aaron - the eclipse-dev mailing list is too general for this topic. Can we please continue this discussion on platform-ui-dev@xxxxxxxxxxx? (i.e. remove eclipse-dev from the to: list when you respond)

I think what you are working on is very interesting, and I am glad that the data binding framework can be used in this context.

However, I am not sure what your goals are.  For IP reasons, I cannot look at your code while it is hosted outside of eclipse.org.  Did you just want to get some feedback on what you have been working on?  Or would you like to know if it could become part of an Eclipse project?  If the latter, we could work towards creating a new component in the Eclipse Platform Incubator with you (and others who are interested in this as well) as initial committers, similar to how this is done in the Modeling project [1].  What do you think?

Cheers
Boris

[1] http://wiki.eclipse.org/Modeling_Project_Releng/Component_Creation

On Thu, Jul 31, 2008 at 1:57 AM, Angelo zerr <angelo.zerr@xxxxxxxxx> wrote:
Hi,

Nobody is interested with DOM and Rhino binding?

I have start to refactor my JFace DOM binding implementation and you can found into the TK-UI SVN.
You have 2 Eclipse project :

org.eclipse.core.databinding.dom which is DOMP binding source.
org.eclipse.core.examples.databinding.dom which is DOM binding samples.

I would like know too if it's possible to add into JFace Databinding Wiki (section Miscelanous), the DOM binding section?
If you are agrre with that, is it possible to give the SVN TK-UI link into JFace Databinding Wiki, because I have not finished the project and I can't send mail with source as bug.

Regards Angelo

2008/7/30 Angelo zerr <angelo.zerr@xxxxxxxxx>
Hi,

I'm TK-UI developer. TK-UI is Toolkit to describe your UI with any XML markup (XUL, XHTML...)
and render it with Swing or SWT. I'm using JFace databinding to bind DOM Document (Element, Attr, Text...)https://tk-ui.svn.sourceforge.net/svnroot/tk-ui/inbox/org.eclipse.core.examples.databinding.dom

with UI widget. So when you update UI it update DOM, whoen you update DOM, the UI is updated.

For instance you can write this XHTML content :

<html xmlns="http://www.w3.org/1999/xhtml">
     <input type="text" value="bla bla bla" />
</html>

And TK-UI load DOM Document and display SWT Text with "bla bla bla".
When you type some data into input (SWT Text), it update attribute value of the DOM.
So DOM Document are totally bounded with UI.

To manage DOM binding I have created DOMObservables (like BeansObservales, PojoObservables...)
and you use this factory like another JFace databinding implementation. This project is stored into
UFace project.

But I would like know if JFace team is interested with my DOM JFace Databinding implementation?
Indead I would like to improve this project to manage a lot of thing like masterdetail.

Here simple sample with masterdetail which manage three SWT List which display countries, cities and streets.
Each SWT List are bounded with this DOM Document :

<countries>
    <country name="Country 1" >
        <cities>
            <city name="City 1.1" >
                <street name="Street 1.1.1" />
            </city>
            <city name="City 1.2" >
                <street name="Street 1.2.1" />
                <street name="Street 1.2.2" />
                <street name="Street 1.2.3" />
            </city>
            <city name="City 1.3" >
                <street name="Street 1.3.1" />
                <street name="Street 1.3.2" />
            </city>
        </cities>
    </country>
    <country name="Country 2" >
        <cities>
            <city name="City 2.1" >
                <street name="Street 2.1.1" />
                <street name="Street 2.1.2" />
            </city>
            <city name="City 2.2" >
                <street name="Street 2.2.1" />
                <street name="Street 2.2.2" />
                <street name="Street 2.2.3" />
            </city>
        </cities>
    </country>
</countries>

The first SWT list display countries (Country 1 and Country 2 ).
When you select a country the second SWT List display cities (ex : you select
Country 1, SWT List cities display City 1.1, City 1.2, City 1.3).

Here the Java code for this sample :

Display display = new Display();
Shell shell = new Shell(display, SWT.SHELL_TRIM);
FillLayout layout = new FillLayout();
shell.setLayout(layout);

Composite composite = new Composite(shell, SWT.NONE);
composite.setLayout(new FillLayout());

DocumentBuilderFactory factory = new org.apache.xerces.jaxp.DocumentBuilderFactoryImpl();
DocumentBuilder builder = factory.newDocumentBuilder();
Document countriesDOM = builder.parse(DOMComboViewerMasterDetail.class
        .getResourceAsStream("countries.xml"));

final Realm realm = SWTObservables.getRealm(display);

// Country
org.eclipse.swt.widgets.List countryList = new org.eclipse.swt.widgets.List(
        composite, SWT.BORDER | SWT.V_SCROLL);
ListViewer countryViewer = new ListViewer(countryList);
ObservableListContentProvider countryViewerContent = new ObservableListContentProvider();
countryViewer.setContentProvider(countryViewerContent);

countryViewer.setLabelProvider(new LabelProvider() {
    public String getText(Object element) {
        Element elt = (Element) element;
        return elt.getAttribute("name");
    }
});

IObservableList countries = DOMObservables.observeElementItems(realm,
        countriesDOM.getDocumentElement(), "country", null, null);
countryViewer.setInput(countries);

// City
IObservableValue selectedCountry = ViewersObservables
        .observeSingleSelection(countryViewer);

org.eclipse.swt.widgets.List cityList = new org.eclipse.swt.widgets.List(
        composite, SWT.BORDER | SWT.V_SCROLL);
ListViewer cityViewer = new ListViewer(cityList);
ObservableListContentProvider cityViewerContent = new ObservableListContentProvider();
cityViewer.setContentProvider(cityViewerContent);

cityViewer.setLabelProvider(new LabelProvider() {
    public String getText(Object element) {
        Element elt = (Element) element;
        return elt.getAttribute("name");
    }
});

IObservableList cities = DOMObservables.observeDetailList(realm,
        selectedCountry, "city");
cityViewer.setInput(cities);

// Street
IObservableValue selectedCity = ViewersObservables
        .observeSingleSelection(cityViewer);

org.eclipse.swt.widgets.List streetList = new org.eclipse.swt.widgets.List(
        composite, SWT.BORDER | SWT.V_SCROLL);
ListViewer streetViewer = new ListViewer(streetList);
ObservableListContentProvider streetViewerContent = new ObservableListContentProvider();
streetViewer.setContentProvider(streetViewerContent);

streetViewer.setLabelProvider(new LabelProvider() {
    public String getText(Object element) {
        Element elt = (Element) element;
        return elt.getAttribute("name");
    }
});

IObservableList streets = DOMObservables.observeDetailList(realm,
        selectedCity, "street");
streetViewer.setInput(streets);

shell.pack();
shell.open();

while (!shell.isDisposed()) {
    if (!display.readAndDispatch())
        display.sleep();
}

shell.dispose();

If you are interested with my work, don't hesitate to contact me, I will happy
to contribute to JFace Databinding project.

At end I have too start Rhino JFace Databinding to bind Scriptable _javascript_ Object with another thing (DOM, SWT UI....)
I could tell you more if you are interested.

Regards Angelo


_______________________________________________
eclipse-dev mailing list
eclipse-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipse-dev