Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » Start of a data binding framework released--help requested
Start of a data binding framework released--help requested [message #95574] Thu, 30 June 2005 21:46 Go to next message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
All,

The VE team yesterday released the start of a data binding framework
into CVS.

We believe that this framework belongs in VE because the framework is
architected in a way that we can support both Swing and SWT data binding
from the same code base, consistent with our charter. We also can bind
controls to any back-end--from plain old Java objects to EJB3 or Db4o
(http://www.db4o.com) [full disclosure, I work for db4objects, the
leading open-source object database company].

Currently this framework implements binding between plain old Java
objects and an SWT Text control, along with data validation based on
regular expressions, Java code, or just the data type of the Java
property being edited. Stubs are in the code showing how it can easily
be extended to support editing using any SWT control and any data back-end.

The VE team currently does not have plans to provide tooling support for
this library, but we had it, so we thought we'd release it. :-) Since
we don't have data binding in any of the VE plan documents yet, please
consider this released on an unofficial basis only for now. Of course,
we would love to see what the community could come up in terms of
completing it and adding tooling support, and we would support the
community in any efforts to do so.

You can check out the new library (called Sweet) from CVS:

Host: dev.eclipse.org
Repository: /home/tools/
Package: org.eclipse.ve.sweet

The class org.eclipse.ve.sweet.test.TestSweet is a simple tutorial
showing how to use most of the framework's features.


Best regards,

Dave Orme
--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Re: Start of a data binding framework released--help requested [message #95890 is a reply to message #95574] Sun, 03 July 2005 13:43 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Dave,
Is it possible bind nested properties.For example :
bean Address with properties:
String street
String city
String state
bean Person
String name
int age
Address address

binding :
....
Text street = new Text(shell, SWT.BORDER);
....
ObjectEditorFactory.factory = new JavaObjectEditorFactory();
personEditor = ObjectEditorFactory.edit(person);
personEditor.bind(name, "Name");
personEditor.bind(age, "Age");
personEditor.bind(street,"address.street");
....
and one question :
why binding properties have first upper character (Name,Age), except simple
property name name,age ... ?

Thanks
Haris Peco
David J. Orme wrote:

> All,
>
> The VE team yesterday released the start of a data binding framework
> into CVS.
>
> We believe that this framework belongs in VE because the framework is
> architected in a way that we can support both Swing and SWT data binding
> from the same code base, consistent with our charter. We also can bind
> controls to any back-end--from plain old Java objects to EJB3 or Db4o
> (http://www.db4o.com) [full disclosure, I work for db4objects, the
> leading open-source object database company].
>
> Currently this framework implements binding between plain old Java
> objects and an SWT Text control, along with data validation based on
> regular expressions, Java code, or just the data type of the Java
> property being edited. Stubs are in the code showing how it can easily
> be extended to support editing using any SWT control and any data
> back-end.
>
> The VE team currently does not have plans to provide tooling support for
> this library, but we had it, so we thought we'd release it. :-) Since
> we don't have data binding in any of the VE plan documents yet, please
> consider this released on an unofficial basis only for now. Of course,
> we would love to see what the community could come up in terms of
> completing it and adding tooling support, and we would support the
> community in any efforts to do so.
>
> You can check out the new library (called Sweet) from CVS:
>
> Host: dev.eclipse.org
> Repository: /home/tools/
> Package: org.eclipse.ve.sweet
>
> The class org.eclipse.ve.sweet.test.TestSweet is a simple tutorial
> showing how to use most of the framework's features.
>
>
> Best regards,
>
> Dave Orme
Re: Start of a data binding framework released--help requested [message #95920 is a reply to message #95890] Sun, 03 July 2005 23:54 Go to previous messageGo to next message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
snpe wrote:
> Dave,
> Is it possible bind nested properties.For example :
> bean Address with properties:
> String street
> String city
> String state
> bean Person
> String name
> int age
> Address address
>
> binding :
> ...
> Text street = new Text(shell, SWT.BORDER);
> ...
> ObjectEditorFactory.factory = new JavaObjectEditorFactory();
> personEditor = ObjectEditorFactory.edit(person);
> personEditor.bind(name, "Name");
> personEditor.bind(age, "Age");
> personEditor.bind(street,"address.street");
> ...

Not this way. You would need to:

ObjectEditorFactory.factory = new JavaObjectEditorFactory();
IObjectEditor personEditor = ObjectEditorFactory.edit(person);
personEditor.bind(name, "Name");
personEditor.bind(age, "Age");

IObjectEditor addressEditor =
ObjectEditorFactory.edit(person.getAddress());
addressEditor.bind(street,"Street");

Right now there is no way to automatically link these editors, but it
wouldn't be hard to write a MasterDetailController to generically manage
this 1:1 master-detail relationship. Something that could work like:

new MasterDetailController(personEditor, "Address", addressEditor);

where the MasterDetailController registers itself as an
IInputChangeListener on personEditor, automatically receives the
"Address" property value when personEditor's input changes, and then
sets the resulting address object as the input on addressEditor.

All that's required in order to do this is to add the
IInputChangeListener callback in IObjectEditor, and to code the
MasterDetailController.

> and one question :
> why binding properties have first upper character (Name,Age), except simple
> property name name,age ... ?

To handle some legacy db4o situations. :-) I really want folks to
always use upper case property names always, so this probably should be
changed to force this.


Thanks for the observation.


Best regards,

Dave Orme

--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Re: Start of a data binding framework released--help requested [message #95934 is a reply to message #95920] Mon, 04 July 2005 00:28 Go to previous messageGo to next message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
I just added the IInputChangeListener event to IObjectEditor but I won't
get a chance to implement the MasterDetailController right now. In case
you or someone else wants to, here's what needs to happen:

* MasterDetailController must implement IImputChangeListener.

* It must include a disconnect() method that unregisters itself from the
IObjectEditor to which it is registered as an IInputChangeListener.

* One convenient way to establish a master-detail link would be to
include something like the constructor I showed in my previous example.

* When the MasterDetailController gets an inputChanging() event, it
should ask the detail object's editor to commit() any changes. If the
detail object editor cannot commit(), inputChanging() should return
false to abort the input change operation.

* When the MasterDetailController gets the inputChanged() event, it
should reload the detail object from the new master object's property
and set the new detail object as the input in the detail object editor.


Best regards,

Dave Orme

David J. Orme wrote:
> snpe wrote:
>
>> Dave,
>> Is it possible bind nested properties.For example :
>> bean Address with properties:
>> String street
>> String city
>> String state
>> bean Person
>> String name
>> int age
>> Address address
>>
>> binding :
>> ...
>> Text street = new Text(shell, SWT.BORDER);
>> ...
>> ObjectEditorFactory.factory = new JavaObjectEditorFactory();
>> personEditor = ObjectEditorFactory.edit(person);
>> personEditor.bind(name, "Name");
>> personEditor.bind(age, "Age");
>> personEditor.bind(street,"address.street");
>> ...
>
>
> Not this way. You would need to:
>
> ObjectEditorFactory.factory = new JavaObjectEditorFactory();
> IObjectEditor personEditor = ObjectEditorFactory.edit(person);
> personEditor.bind(name, "Name");
> personEditor.bind(age, "Age");
>
> IObjectEditor addressEditor =
> ObjectEditorFactory.edit(person.getAddress());
> addressEditor.bind(street,"Street");
>
> Right now there is no way to automatically link these editors, but it
> wouldn't be hard to write a MasterDetailController to generically manage
> this 1:1 master-detail relationship. Something that could work like:
>
> new MasterDetailController(personEditor, "Address", addressEditor);
>
> where the MasterDetailController registers itself as an
> IInputChangeListener on personEditor, automatically receives the
> "Address" property value when personEditor's input changes, and then
> sets the resulting address object as the input on addressEditor.
>
> All that's required in order to do this is to add the
> IInputChangeListener callback in IObjectEditor, and to code the
> MasterDetailController.
>
>> and one question :
>> why binding properties have first upper character (Name,Age), except
>> simple
>> property name name,age ... ?
>
>
> To handle some legacy db4o situations. :-) I really want folks to
> always use upper case property names always, so this probably should be
> changed to force this.
>
>
> Thanks for the observation.
>
>
> Best regards,
>
> Dave Orme
>


--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Re: Start of a data binding framework released--help requested [message #95946 is a reply to message #95920] Mon, 04 July 2005 00:33 Go to previous messageGo to next message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
David J. Orme wrote:
>> and one question :
>> why binding properties have first upper character (Name,Age), except
>> simple
>> property name name,age ... ?
>
> To handle some legacy db4o situations. :-) I really want folks to
> always use upper case property names always, so this probably should be
> changed to force this.

Actually, I'm wrong here. It's this way so that if someone defines
fields using lower-case initial letters (like usual), but adds a getter
with camel caps (like usual), Sweet will automatically pick up the
getter and use that.


Best regards,

Dave Orme

--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Re: Start of a data binding framework released--help requested [message #95976 is a reply to message #95934] Mon, 04 July 2005 03:46 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Dave,
see spring-rcp binding (swing only) (www.springframework.org)
spring rcp have feature bind like this :
bind(component,"address.street")
It is great, but don't support swt

regards

David J. Orme wrote:

> I just added the IInputChangeListener event to IObjectEditor but I won't
> get a chance to implement the MasterDetailController right now. In case
> you or someone else wants to, here's what needs to happen:
>
> * MasterDetailController must implement IImputChangeListener.
>
> * It must include a disconnect() method that unregisters itself from the
> IObjectEditor to which it is registered as an IInputChangeListener.
>
> * One convenient way to establish a master-detail link would be to
> include something like the constructor I showed in my previous example.
>
> * When the MasterDetailController gets an inputChanging() event, it
> should ask the detail object's editor to commit() any changes. If the
> detail object editor cannot commit(), inputChanging() should return
> false to abort the input change operation.
>
> * When the MasterDetailController gets the inputChanged() event, it
> should reload the detail object from the new master object's property
> and set the new detail object as the input in the detail object editor.
>
>
> Best regards,
>
> Dave Orme
>
> David J. Orme wrote:
>> snpe wrote:
>>
>>> Dave,
>>> Is it possible bind nested properties.For example :
>>> bean Address with properties:
>>> String street
>>> String city
>>> String state
>>> bean Person
>>> String name
>>> int age
>>> Address address
>>>
>>> binding :
>>> ...
>>> Text street = new Text(shell, SWT.BORDER);
>>> ...
>>> ObjectEditorFactory.factory = new JavaObjectEditorFactory();
>>> personEditor = ObjectEditorFactory.edit(person);
>>> personEditor.bind(name, "Name");
>>> personEditor.bind(age, "Age");
>>> personEditor.bind(street,"address.street");
>>> ...
>>
>>
>> Not this way. You would need to:
>>
>> ObjectEditorFactory.factory = new JavaObjectEditorFactory();
>> IObjectEditor personEditor = ObjectEditorFactory.edit(person);
>> personEditor.bind(name, "Name");
>> personEditor.bind(age, "Age");
>>
>> IObjectEditor addressEditor =
>> ObjectEditorFactory.edit(person.getAddress());
>> addressEditor.bind(street,"Street");
>>
>> Right now there is no way to automatically link these editors, but it
>> wouldn't be hard to write a MasterDetailController to generically manage
>> this 1:1 master-detail relationship. Something that could work like:
>>
>> new MasterDetailController(personEditor, "Address", addressEditor);
>>
>> where the MasterDetailController registers itself as an
>> IInputChangeListener on personEditor, automatically receives the
>> "Address" property value when personEditor's input changes, and then
>> sets the resulting address object as the input on addressEditor.
>>
>> All that's required in order to do this is to add the
>> IInputChangeListener callback in IObjectEditor, and to code the
>> MasterDetailController.
>>
>>> and one question :
>>> why binding properties have first upper character (Name,Age), except
>>> simple
>>> property name name,age ... ?
>>
>>
>> To handle some legacy db4o situations. :-) I really want folks to
>> always use upper case property names always, so this probably should be
>> changed to force this.
>>
>>
>> Thanks for the observation.
>>
>>
>> Best regards,
>>
>> Dave Orme
>>
>
>
Re: Start of a data binding framework released--help requested [message #95990 is a reply to message #95574] Mon, 04 July 2005 03:44 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
David J. Orme:

> The VE team yesterday released the start of a data binding framework
> into CVS.

[cut]

> The VE team currently does not have plans to provide tooling support for
> this library, but we had it, so we thought we'd release it. :-) Since
> we don't have data binding in any of the VE plan documents yet, please
> consider this released on an unofficial basis only for now. Of course,
> we would love to see what the community could come up in terms of
> completing it and adding tooling support, and we would support the
> community in any efforts to do so.

I would like contribute to this project as part of my work for
Instantiations. But right now I have question: why not use some existing
data binding framework (such as JGoodies, https://binding.dev.java.net)
as base and implement SWT/JFace support on top of it? Do we really need
create new binding framework from scratch?

--
SY, Konstantin Scheglov


Konstantin Scheglov,
Google, Inc.
Re: Start of a data binding framework released--help requested [message #96004 is a reply to message #95976] Mon, 04 July 2005 03:47 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
snpe:

> see spring-rcp binding (swing only) (www.springframework.org)
> spring rcp have feature bind like this :
> bind(component,"address.street")
> It is great, but don't support swt

There is also Commons-Beans library from Jakarta that supports access
to inner properties. May be it would be good to use it...

--
SY, Konstantin Scheglov


Konstantin Scheglov,
Google, Inc.
Re: Start of a data binding framework released--help requested [message #96121 is a reply to message #96004] Tue, 05 July 2005 13:37 Go to previous messageGo to next message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
Konstantin Scheglov wrote:
> snpe:
>
>> see spring-rcp binding (swing only) (www.springframework.org)
>> spring rcp have feature bind like this :
>> bind(component,"address.street")
>> It is great, but don't support swt
>
>
> There is also Commons-Beans library from Jakarta that supports access
> to inner properties. May be it would be good to use it...

That might be a good idea.

However, if this is the only feature we need from Commons Beans, it is
probably a better idea to just implement it ourselves if that's what
people want in order to avoid adding a dependency that we force everyone
to drag in. It would be really simple to implement...

I'm happy to look at patches. :-)


Best regards,

Dave Orme
--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Re: Start of a data binding framework released--help requested [message #96133 is a reply to message #95990] Tue, 05 July 2005 14:16 Go to previous messageGo to next message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
Konstantin Scheglov wrote:
> David J. Orme:
>
>> The VE team yesterday released the start of a data binding framework
>> into CVS.
>
>
> [cut]
>
>> The VE team currently does not have plans to provide tooling support
>> for this library, but we had it, so we thought we'd release it. :-)
>> Since we don't have data binding in any of the VE plan documents yet,
>> please consider this released on an unofficial basis only for now. Of
>> course, we would love to see what the community could come up in terms
>> of completing it and adding tooling support, and we would support the
>> community in any efforts to do so.
>
>
> I would like contribute to this project as part of my work for
> Instantiations. But right now I have question: why not use some existing
> data binding framework (such as JGoodies, https://binding.dev.java.net)
> as base and implement SWT/JFace support on top of it? Do we really need
> create new binding framework from scratch?

Here's why I think a fresh approach is helpful compared to existing ones:

- Support for multiple back-ends and multiple front-ends should be
designed in, not included as an afterthought. For example, given this
code, one could now write a Hibernate-aware back-end really quickly.
Which brings me to the next point:

- I believe that binding frameworks need explicit support for
transactional behavior. Getting the data between your Java model
objects and your UI is only 2/3 of the problem. The rest is setting
your modified Java objects back into the persistent store, calling
commit() or rollback() on the transaction at the right times, etc. The
framework should do this automatically.

- The approach here integrates binding and validation seamlessly. For
all the simple cases (where the data type determines the type of
validation rules required), you don't have to even think about
validation--it's done automatically. Validation should automatically be
integrated into the object's transactional behavior with the underlying
persistence mechanism, whatever that is.


Best regards,

Dave Orme
--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Re: Start of a data binding framework released--help requested [message #96572 is a reply to message #96133] Thu, 07 July 2005 15:51 Go to previous message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
David J. Orme wrote:
> Here's why I think a fresh approach is helpful compared to existing ones:
>
> - Support for multiple back-ends and multiple front-ends should be
> designed in, not included as an afterthought. For example, given this
> code, one could now write a Hibernate-aware back-end really quickly.
> Which brings me to the next point:
>
> - I believe that binding frameworks need explicit support for
> transactional behavior. Getting the data between your Java model
> objects and your UI is only 2/3 of the problem. The rest is setting
> your modified Java objects back into the persistent store, calling
> commit() or rollback() on the transaction at the right times, etc. The
> framework should do this automatically.
>
> - The approach here integrates binding and validation seamlessly. For
> all the simple cases (where the data type determines the type of
> validation rules required), you don't have to even think about
> validation--it's done automatically. Validation should automatically be
> integrated into the object's transactional behavior with the underlying
> persistence mechanism, whatever that is.

Gili and I were talking about this yesterday, and he added another
reason/suggestion:

Eclipse's data binding framework should be based on, integrate with, and
use JFace whenever possible since JFace is Eclipse's (currently
somewhat primitive) data binding framework.

I have done some refactoring to implement this, so anyone who has the
code should update to the latest CVS version.


Regards,

Dave
--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Re: Start of a data binding framework released--help requested [message #608935 is a reply to message #95574] Sun, 03 July 2005 13:43 Go to previous message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Dave,
Is it possible bind nested properties.For example :
bean Address with properties:
String street
String city
String state
bean Person
String name
int age
Address address

binding :
....
Text street = new Text(shell, SWT.BORDER);
....
ObjectEditorFactory.factory = new JavaObjectEditorFactory();
personEditor = ObjectEditorFactory.edit(person);
personEditor.bind(name, "Name");
personEditor.bind(age, "Age");
personEditor.bind(street,"address.street");
....
and one question :
why binding properties have first upper character (Name,Age), except simple
property name name,age ... ?

Thanks
Haris Peco
David J. Orme wrote:

> All,
>
> The VE team yesterday released the start of a data binding framework
> into CVS.
>
> We believe that this framework belongs in VE because the framework is
> architected in a way that we can support both Swing and SWT data binding
> from the same code base, consistent with our charter. We also can bind
> controls to any back-end--from plain old Java objects to EJB3 or Db4o
> (http://www.db4o.com) [full disclosure, I work for db4objects, the
> leading open-source object database company].
>
> Currently this framework implements binding between plain old Java
> objects and an SWT Text control, along with data validation based on
> regular expressions, Java code, or just the data type of the Java
> property being edited. Stubs are in the code showing how it can easily
> be extended to support editing using any SWT control and any data
> back-end.
>
> The VE team currently does not have plans to provide tooling support for
> this library, but we had it, so we thought we'd release it. :-) Since
> we don't have data binding in any of the VE plan documents yet, please
> consider this released on an unofficial basis only for now. Of course,
> we would love to see what the community could come up in terms of
> completing it and adding tooling support, and we would support the
> community in any efforts to do so.
>
> You can check out the new library (called Sweet) from CVS:
>
> Host: dev.eclipse.org
> Repository: /home/tools/
> Package: org.eclipse.ve.sweet
>
> The class org.eclipse.ve.sweet.test.TestSweet is a simple tutorial
> showing how to use most of the framework's features.
>
>
> Best regards,
>
> Dave Orme
Re: Start of a data binding framework released--help requested [message #608938 is a reply to message #95890] Sun, 03 July 2005 23:54 Go to previous message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
snpe wrote:
> Dave,
> Is it possible bind nested properties.For example :
> bean Address with properties:
> String street
> String city
> String state
> bean Person
> String name
> int age
> Address address
>
> binding :
> ...
> Text street = new Text(shell, SWT.BORDER);
> ...
> ObjectEditorFactory.factory = new JavaObjectEditorFactory();
> personEditor = ObjectEditorFactory.edit(person);
> personEditor.bind(name, "Name");
> personEditor.bind(age, "Age");
> personEditor.bind(street,"address.street");
> ...

Not this way. You would need to:

ObjectEditorFactory.factory = new JavaObjectEditorFactory();
IObjectEditor personEditor = ObjectEditorFactory.edit(person);
personEditor.bind(name, "Name");
personEditor.bind(age, "Age");

IObjectEditor addressEditor =
ObjectEditorFactory.edit(person.getAddress());
addressEditor.bind(street,"Street");

Right now there is no way to automatically link these editors, but it
wouldn't be hard to write a MasterDetailController to generically manage
this 1:1 master-detail relationship. Something that could work like:

new MasterDetailController(personEditor, "Address", addressEditor);

where the MasterDetailController registers itself as an
IInputChangeListener on personEditor, automatically receives the
"Address" property value when personEditor's input changes, and then
sets the resulting address object as the input on addressEditor.

All that's required in order to do this is to add the
IInputChangeListener callback in IObjectEditor, and to code the
MasterDetailController.

> and one question :
> why binding properties have first upper character (Name,Age), except simple
> property name name,age ... ?

To handle some legacy db4o situations. :-) I really want folks to
always use upper case property names always, so this probably should be
changed to force this.


Thanks for the observation.


Best regards,

Dave Orme

--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Re: Start of a data binding framework released--help requested [message #608939 is a reply to message #95920] Mon, 04 July 2005 00:28 Go to previous message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
I just added the IInputChangeListener event to IObjectEditor but I won't
get a chance to implement the MasterDetailController right now. In case
you or someone else wants to, here's what needs to happen:

* MasterDetailController must implement IImputChangeListener.

* It must include a disconnect() method that unregisters itself from the
IObjectEditor to which it is registered as an IInputChangeListener.

* One convenient way to establish a master-detail link would be to
include something like the constructor I showed in my previous example.

* When the MasterDetailController gets an inputChanging() event, it
should ask the detail object's editor to commit() any changes. If the
detail object editor cannot commit(), inputChanging() should return
false to abort the input change operation.

* When the MasterDetailController gets the inputChanged() event, it
should reload the detail object from the new master object's property
and set the new detail object as the input in the detail object editor.


Best regards,

Dave Orme

David J. Orme wrote:
> snpe wrote:
>
>> Dave,
>> Is it possible bind nested properties.For example :
>> bean Address with properties:
>> String street
>> String city
>> String state
>> bean Person
>> String name
>> int age
>> Address address
>>
>> binding :
>> ...
>> Text street = new Text(shell, SWT.BORDER);
>> ...
>> ObjectEditorFactory.factory = new JavaObjectEditorFactory();
>> personEditor = ObjectEditorFactory.edit(person);
>> personEditor.bind(name, "Name");
>> personEditor.bind(age, "Age");
>> personEditor.bind(street,"address.street");
>> ...
>
>
> Not this way. You would need to:
>
> ObjectEditorFactory.factory = new JavaObjectEditorFactory();
> IObjectEditor personEditor = ObjectEditorFactory.edit(person);
> personEditor.bind(name, "Name");
> personEditor.bind(age, "Age");
>
> IObjectEditor addressEditor =
> ObjectEditorFactory.edit(person.getAddress());
> addressEditor.bind(street,"Street");
>
> Right now there is no way to automatically link these editors, but it
> wouldn't be hard to write a MasterDetailController to generically manage
> this 1:1 master-detail relationship. Something that could work like:
>
> new MasterDetailController(personEditor, "Address", addressEditor);
>
> where the MasterDetailController registers itself as an
> IInputChangeListener on personEditor, automatically receives the
> "Address" property value when personEditor's input changes, and then
> sets the resulting address object as the input on addressEditor.
>
> All that's required in order to do this is to add the
> IInputChangeListener callback in IObjectEditor, and to code the
> MasterDetailController.
>
>> and one question :
>> why binding properties have first upper character (Name,Age), except
>> simple
>> property name name,age ... ?
>
>
> To handle some legacy db4o situations. :-) I really want folks to
> always use upper case property names always, so this probably should be
> changed to force this.
>
>
> Thanks for the observation.
>
>
> Best regards,
>
> Dave Orme
>


--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Re: Start of a data binding framework released--help requested [message #608940 is a reply to message #95920] Mon, 04 July 2005 00:33 Go to previous message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
David J. Orme wrote:
>> and one question :
>> why binding properties have first upper character (Name,Age), except
>> simple
>> property name name,age ... ?
>
> To handle some legacy db4o situations. :-) I really want folks to
> always use upper case property names always, so this probably should be
> changed to force this.

Actually, I'm wrong here. It's this way so that if someone defines
fields using lower-case initial letters (like usual), but adds a getter
with camel caps (like usual), Sweet will automatically pick up the
getter and use that.


Best regards,

Dave Orme

--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Re: Start of a data binding framework released--help requested [message #608944 is a reply to message #95934] Mon, 04 July 2005 03:46 Go to previous message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Dave,
see spring-rcp binding (swing only) (www.springframework.org)
spring rcp have feature bind like this :
bind(component,"address.street")
It is great, but don't support swt

regards

David J. Orme wrote:

> I just added the IInputChangeListener event to IObjectEditor but I won't
> get a chance to implement the MasterDetailController right now. In case
> you or someone else wants to, here's what needs to happen:
>
> * MasterDetailController must implement IImputChangeListener.
>
> * It must include a disconnect() method that unregisters itself from the
> IObjectEditor to which it is registered as an IInputChangeListener.
>
> * One convenient way to establish a master-detail link would be to
> include something like the constructor I showed in my previous example.
>
> * When the MasterDetailController gets an inputChanging() event, it
> should ask the detail object's editor to commit() any changes. If the
> detail object editor cannot commit(), inputChanging() should return
> false to abort the input change operation.
>
> * When the MasterDetailController gets the inputChanged() event, it
> should reload the detail object from the new master object's property
> and set the new detail object as the input in the detail object editor.
>
>
> Best regards,
>
> Dave Orme
>
> David J. Orme wrote:
>> snpe wrote:
>>
>>> Dave,
>>> Is it possible bind nested properties.For example :
>>> bean Address with properties:
>>> String street
>>> String city
>>> String state
>>> bean Person
>>> String name
>>> int age
>>> Address address
>>>
>>> binding :
>>> ...
>>> Text street = new Text(shell, SWT.BORDER);
>>> ...
>>> ObjectEditorFactory.factory = new JavaObjectEditorFactory();
>>> personEditor = ObjectEditorFactory.edit(person);
>>> personEditor.bind(name, "Name");
>>> personEditor.bind(age, "Age");
>>> personEditor.bind(street,"address.street");
>>> ...
>>
>>
>> Not this way. You would need to:
>>
>> ObjectEditorFactory.factory = new JavaObjectEditorFactory();
>> IObjectEditor personEditor = ObjectEditorFactory.edit(person);
>> personEditor.bind(name, "Name");
>> personEditor.bind(age, "Age");
>>
>> IObjectEditor addressEditor =
>> ObjectEditorFactory.edit(person.getAddress());
>> addressEditor.bind(street,"Street");
>>
>> Right now there is no way to automatically link these editors, but it
>> wouldn't be hard to write a MasterDetailController to generically manage
>> this 1:1 master-detail relationship. Something that could work like:
>>
>> new MasterDetailController(personEditor, "Address", addressEditor);
>>
>> where the MasterDetailController registers itself as an
>> IInputChangeListener on personEditor, automatically receives the
>> "Address" property value when personEditor's input changes, and then
>> sets the resulting address object as the input on addressEditor.
>>
>> All that's required in order to do this is to add the
>> IInputChangeListener callback in IObjectEditor, and to code the
>> MasterDetailController.
>>
>>> and one question :
>>> why binding properties have first upper character (Name,Age), except
>>> simple
>>> property name name,age ... ?
>>
>>
>> To handle some legacy db4o situations. :-) I really want folks to
>> always use upper case property names always, so this probably should be
>> changed to force this.
>>
>>
>> Thanks for the observation.
>>
>>
>> Best regards,
>>
>> Dave Orme
>>
>
>
Re: Start of a data binding framework released--help requested [message #608946 is a reply to message #95574] Mon, 04 July 2005 03:44 Go to previous message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
David J. Orme:

> The VE team yesterday released the start of a data binding framework
> into CVS.

[cut]

> The VE team currently does not have plans to provide tooling support for
> this library, but we had it, so we thought we'd release it. :-) Since
> we don't have data binding in any of the VE plan documents yet, please
> consider this released on an unofficial basis only for now. Of course,
> we would love to see what the community could come up in terms of
> completing it and adding tooling support, and we would support the
> community in any efforts to do so.

I would like contribute to this project as part of my work for
Instantiations. But right now I have question: why not use some existing
data binding framework (such as JGoodies, https://binding.dev.java.net)
as base and implement SWT/JFace support on top of it? Do we really need
create new binding framework from scratch?

--
SY, Konstantin Scheglov


Konstantin Scheglov,
Google, Inc.
Re: Start of a data binding framework released--help requested [message #608948 is a reply to message #95976] Mon, 04 July 2005 03:47 Go to previous message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
snpe:

> see spring-rcp binding (swing only) (www.springframework.org)
> spring rcp have feature bind like this :
> bind(component,"address.street")
> It is great, but don't support swt

There is also Commons-Beans library from Jakarta that supports access
to inner properties. May be it would be good to use it...

--
SY, Konstantin Scheglov


Konstantin Scheglov,
Google, Inc.
Re: Start of a data binding framework released--help requested [message #608957 is a reply to message #96004] Tue, 05 July 2005 13:37 Go to previous message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
Konstantin Scheglov wrote:
> snpe:
>
>> see spring-rcp binding (swing only) (www.springframework.org)
>> spring rcp have feature bind like this :
>> bind(component,"address.street")
>> It is great, but don't support swt
>
>
> There is also Commons-Beans library from Jakarta that supports access
> to inner properties. May be it would be good to use it...

That might be a good idea.

However, if this is the only feature we need from Commons Beans, it is
probably a better idea to just implement it ourselves if that's what
people want in order to avoid adding a dependency that we force everyone
to drag in. It would be really simple to implement...

I'm happy to look at patches. :-)


Best regards,

Dave Orme
--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Re: Start of a data binding framework released--help requested [message #608958 is a reply to message #95990] Tue, 05 July 2005 14:16 Go to previous message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
Konstantin Scheglov wrote:
> David J. Orme:
>
>> The VE team yesterday released the start of a data binding framework
>> into CVS.
>
>
> [cut]
>
>> The VE team currently does not have plans to provide tooling support
>> for this library, but we had it, so we thought we'd release it. :-)
>> Since we don't have data binding in any of the VE plan documents yet,
>> please consider this released on an unofficial basis only for now. Of
>> course, we would love to see what the community could come up in terms
>> of completing it and adding tooling support, and we would support the
>> community in any efforts to do so.
>
>
> I would like contribute to this project as part of my work for
> Instantiations. But right now I have question: why not use some existing
> data binding framework (such as JGoodies, https://binding.dev.java.net)
> as base and implement SWT/JFace support on top of it? Do we really need
> create new binding framework from scratch?

Here's why I think a fresh approach is helpful compared to existing ones:

- Support for multiple back-ends and multiple front-ends should be
designed in, not included as an afterthought. For example, given this
code, one could now write a Hibernate-aware back-end really quickly.
Which brings me to the next point:

- I believe that binding frameworks need explicit support for
transactional behavior. Getting the data between your Java model
objects and your UI is only 2/3 of the problem. The rest is setting
your modified Java objects back into the persistent store, calling
commit() or rollback() on the transaction at the right times, etc. The
framework should do this automatically.

- The approach here integrates binding and validation seamlessly. For
all the simple cases (where the data type determines the type of
validation rules required), you don't have to even think about
validation--it's done automatically. Validation should automatically be
integrated into the object's transactional behavior with the underlying
persistence mechanism, whatever that is.


Best regards,

Dave Orme
--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Re: Start of a data binding framework released--help requested [message #608988 is a reply to message #96133] Thu, 07 July 2005 15:51 Go to previous message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
David J. Orme wrote:
> Here's why I think a fresh approach is helpful compared to existing ones:
>
> - Support for multiple back-ends and multiple front-ends should be
> designed in, not included as an afterthought. For example, given this
> code, one could now write a Hibernate-aware back-end really quickly.
> Which brings me to the next point:
>
> - I believe that binding frameworks need explicit support for
> transactional behavior. Getting the data between your Java model
> objects and your UI is only 2/3 of the problem. The rest is setting
> your modified Java objects back into the persistent store, calling
> commit() or rollback() on the transaction at the right times, etc. The
> framework should do this automatically.
>
> - The approach here integrates binding and validation seamlessly. For
> all the simple cases (where the data type determines the type of
> validation rules required), you don't have to even think about
> validation--it's done automatically. Validation should automatically be
> integrated into the object's transactional behavior with the underlying
> persistence mechanism, whatever that is.

Gili and I were talking about this yesterday, and he added another
reason/suggestion:

Eclipse's data binding framework should be based on, integrate with, and
use JFace whenever possible since JFace is Eclipse's (currently
somewhat primitive) data binding framework.

I have done some refactoring to implement this, so anyone who has the
code should update to the latest CVS version.


Regards,

Dave
--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Previous Topic:VE properties tab is empty
Next Topic:How to retrieve the information displayed in "Java Beans"
Goto Forum:
  


Current Time: Sat Apr 20 03:20:40 GMT 2024

Powered by FUDForum. Page generated in 0.04861 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top