Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is there any data binding system on XUL framework?

32 views
Skip to first unread message

Nori

unread,
Nov 19, 2009, 5:27:35 PM11/19/09
to
Hi there,

I'm just wondering if there is any data binding system like the one
Adobe Flex has on Xul framework?
It's a function woking like a binding between some data model and a
value of an user interface control, and the model is automatically
updated by observing a value of a control.

Thank you,
Nori

Davi

unread,
Nov 20, 2009, 4:22:07 PM11/20/09
to

Hello Nori.

Well, I think RDF templates does something like that but... I don't
like RDF. I just ended by develop my own binding facility (based on
Beans Binding, used with SAF - Swing Application Framework). Actually
it's not open and not even is ready for use, but it was pretty simple
to develop. You just wrap the controls exposing a common interface
(getValue and setValue in my case) and also a language for binding
(something like EL - Expression Language, also from Java world).

I hope that it helps.

Davi

PS. Sorry for the english

Nori

unread,
Nov 21, 2009, 7:18:48 AM11/21/09
to
Hi Davi,

Thank you for replying to me.
You mean you are talking about XBL, right?
I know XML, but what I wanted to know is a binding of a value of some
component and some data model object.
For example, I would like to bind a value of a text box which is
already present as a XUL component and some data object.

I think we are talking about a different issue.
Yeah, XUL is using a word 'binding' for XBL, so it's a kind of
complecated, but I'm not talking about XML.

Anyway, thank you for the reply.
Nori

Davi

unread,
Nov 21, 2009, 11:38:13 AM11/21/09
to

No no. We are talking about the same thing. And I am talking about RDF
templates (not XBL).

Please see: https://developer.mozilla.org/en/rdf_in_mozilla_faq

Im my app, I wrote a library to do the data binding (I'm not using RDF
templates). I have a variable called registry:

var registry = {
name: null,
phone: null,
married: null.

// and so on...
}

And I have some controls that reflects the data inside this object:

// first you bind controls to the "model"

var b1 = bind("my-control-id-1", "name");
var b2 = bind("my-control-id-2", "phone");
var b3 = bind("my-control-id-3", "married");

var group = new BindingGroup();
group.add(b1);
group.add(b2);
group.add(b3);

// ...

// to update the values and binded controls:

b1.setValue("Davi R. Tavares");
b2.setValue("000 000");
b3.setValue(false);
group.updateControls();

It was quite easy to implement this library, I think you can do so.
Please take a look at RDF templates and Beans Binding specification
(https://beansbinding.dev.java.net/).

Hope it was helpfull.

Davi

Nori

unread,
Nov 22, 2009, 11:05:30 AM11/22/09
to
Hi Davi,

It's exactly what I was expecting for!!
Thank you so much. You gave me a quite good idea.
It helped me a lot.

Thanks!!!

0 new messages