Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » JFace viewer and/or JFace databinding
JFace viewer and/or JFace databinding [message #462482] Mon, 29 January 2007 23:00 Go to next message
Nicolas Mura is currently offline Nicolas MuraFriend
Messages: 24
Registered: July 2009
Junior Member
JFace viewer and/or JFace databinding

Hi,
What are the difference between JFace viewer and JFace databinding (3.2) ?
May be the answer is obvious, but there is something I don't understand
(I'm new to SWT/JFace).
Both of them create a link between a java object and an SWT widget.

What is the best API (viewer/databinding) to link model objet to the
presentation layer?
Can I use the two API together and how (best practice) ?

Example:
public class Person {
String firstName;
String lastName
int age;
}

If I want to represent an instance of this class as a form with text
fields, databinding seems perfect.

But if I want to put a list of Person in a Table, what should I use :
+ ArrayList<Person> => TableViewer => Table
+ ArrayList<Person> => databinding => Table
Or maybe ArrayList<Person> => databinding => TableViewer => Table (in
this case, why use databinding)

Thanks for your help.
Re: JFace viewer and/or JFace databinding [message #462530 is a reply to message #462482] Tue, 30 January 2007 06:06 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

JFace builds a MVC-wrapper around SWT-Controls whereas Databinding is
used to bind data to any SWT-Control and uses for
List/Table/DropDown-Controls JFace-Viewers. If you consider using
Databinding please use the current CVS-Code. The one from 3.2 was
experimental and the API has changed, but it is compatible with 3.2 and
if it's not this can be considered a bug what I know and has to be
reported to bugzilla.

Tom

Nicolas Mura schrieb:
> JFace viewer and/or JFace databinding
>
> Hi,
> What are the difference between JFace viewer and JFace databinding (3.2) ?
> May be the answer is obvious, but there is something I don't understand
> (I'm new to SWT/JFace).
> Both of them create a link between a java object and an SWT widget.
>
> What is the best API (viewer/databinding) to link model objet to the
> presentation layer?
> Can I use the two API together and how (best practice) ?
>
> Example:
> public class Person {
> String firstName;
> String lastName
> int age;
> }
>
> If I want to represent an instance of this class as a form with text
> fields, databinding seems perfect.
>
> But if I want to put a list of Person in a Table, what should I use :
> + ArrayList<Person> => TableViewer => Table
> + ArrayList<Person> => databinding => Table
> Or maybe ArrayList<Person> => databinding => TableViewer => Table (in
> this case, why use databinding)
>
> Thanks for your help.
Re: JFace viewer and/or JFace databinding [message #462532 is a reply to message #462530] Tue, 30 January 2007 09:21 Go to previous messageGo to next message
Nicolas Mura is currently offline Nicolas MuraFriend
Messages: 24
Registered: July 2009
Junior Member
Hi Tom, thanks for your help.

> JFace builds a MVC-wrapper around SWT-Controls whereas Databinding is
> used to bind data to any SWT-Control and uses for
> List/Table/DropDown-Controls JFace-Viewers.

So for "complex" SWT component (List/Table/DropDown-Controls), I should use databinding and viewer at the sametime.
But if I take my previous example (class Person)
I have an ArrayList of Person and a Table widget.
If I modify a value through the Table, the viewer should directly modify the corresponding value in the arrayList
(propertie of a person object in the array list).
In this case, why use databinding? The model has already been modified,
so I still don't understand the utility of databinding moreover viewer for complex component.

> If you consider using
> Databinding please use the current CVS-Code. The one from 3.2 was
> experimental and the API has changed, but it is compatible with 3.2 and
> if it's not this can be considered a bug what I know and has to be
> reported to bugzilla.

For the databinding, I've tried to test the 3.3 version and downloaded 3 plugins
- org.eclipse.core.databinding.beans
- org.eclipse.core.databinding
- org.eclipse.jface.databinding
But it doesn't compile. I don't remember the error message but it is about viewer.
Maybe I need another plugin to get it working in eclipse 3.2 ?

Nicolas
Re: JFace viewer and/or JFace databinding [message #462609 is a reply to message #462532] Wed, 31 January 2007 00:14 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Nicolas Mura schrieb:
> Hi Tom, thanks for your help.
>
>> JFace builds a MVC-wrapper around SWT-Controls whereas Databinding is
>> used to bind data to any SWT-Control and uses for
>> List/Table/DropDown-Controls JFace-Viewers.
>
> So for "complex" SWT component (List/Table/DropDown-Controls), I should
> use databinding and viewer at the sametime.
> But if I take my previous example (class Person)
> I have an ArrayList of Person and a Table widget.
> If I modify a value through the Table, the viewer should directly modify
> the corresponding value in the arrayList (propertie of a person object
> in the array list).
> In this case, why use databinding? The model has already been modified,
> so I still don't understand the utility of databinding moreover viewer
> for complex component.
>

Did you saw what databinding can do for you when browsing the examples?
In your example you have a list of persons and select one and for
editing you provide an ordinary Composite with Text-Widgets. The
Databinding code handles all this automatically for you, another example
are subforms whose dependency updateing in automatically done for you by
the databinding code and in the end it provides hooks for you to
validate and convert code in a common way.

If you only have a TableViewer and you use inline-editing you are right
JFace is enough but if things get more complex databinding can reduce
the amount of custom code extremely. In the end XML-Languages like XSWT
or my newer port EXSWT
( http://publicsvn.bestsolution.at/repos/java/at.bestsolution. exswt/)
automatically create the binding for you and all you need to write
data(basebound) applications is an XML-Editor some ORM-Tool like
Hibernate and you are done.

>> If you consider using
>> Databinding please use the current CVS-Code. The one from 3.2 was
>> experimental and the API has changed, but it is compatible with 3.2 and
>> if it's not this can be considered a bug what I know and has to be
>> reported to bugzilla.
>
> For the databinding, I've tried to test the 3.3 version and downloaded 3
> plugins
> - org.eclipse.core.databinding.beans
> - org.eclipse.core.databinding
> - org.eclipse.jface.databinding
> But it doesn't compile. I don't remember the error message but it is
> about viewer.
> Maybe I need another plugin to get it working in eclipse 3.2 ?
>
> Nicolas

I don't know exactly the best thing is to check out the modules from cvs
and look at the MANIFEST files if some dependency could not be
resolved and check it out from cvs.

Tom
Re: JFace viewer and/or JFace databinding [message #462788 is a reply to message #462530] Thu, 01 February 2007 07:52 Go to previous messageGo to next message
Peter Maas is currently offline Peter MaasFriend
Messages: 47
Registered: July 2009
Member
Tom Schindl schrieb:
> If you consider using Databinding please use the current CVS-Code.

So you advise against using the databinding code of 3.3M4 within
Eclipse 3.2.1?

--
Gruesse/Regards,

Peter Maas, Aachen
E-mail "cC5tYWFzQG1hZ21hc29mdC5kZQ==\n".decode("base64")
Re: JFace viewer and/or JFace databinding [message #462828 is a reply to message #462788] Thu, 01 February 2007 11:40 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

Well databinding has evolved and it's API should be finalized with M4
but under the hoods I development is still going on and I always make
sure that my implementation is working with what's going to be the final
version. If 3.3 is out I advise to ship a stable freeze the modules you
use and develop the next generation with the current cvs.

At least this what I'm doing. With Databinding I'd use the CVS-Tree to
make sure I have all modules (=> Databinding wouldn't compile) and can
make sure that nothing is missing and schedule my release cycle to
release the next minor release shortly after the next M-Build is out.

But I'm not the one of the main developers of databinding but normally
eclipse CVS-HEAD doesn't get unstable which is allowed to some extent in
the HEAD-Branch but normally not done because many developers use
I/N-Builds to work uncovering problems (not testable with unit-testing)
as fast as possible.

Tom

Peter Maas schrieb:
> Tom Schindl schrieb:
>> If you consider using Databinding please use the current CVS-Code.
>
> So you advise against using the databinding code of 3.3M4 within
> Eclipse 3.2.1?
>
Re: JFace viewer and/or JFace databinding [message #462883 is a reply to message #462609] Thu, 01 February 2007 22:04 Go to previous message
Nicolas Mura is currently offline Nicolas MuraFriend
Messages: 24
Registered: July 2009
Junior Member
Thank you for your advices
Previous Topic:Imaging App, MouseMoveListener for View
Next Topic:RCP, JDT, and WTP
Goto Forum:
  


Current Time: Sat Sep 21 01:15:45 GMT 2024

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

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

Back to the top