Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » WindowBuilder » Binding items property of Combo using WindowBuilder(Tips how to do it)
Binding items property of Combo using WindowBuilder [message #1236115] Sun, 26 January 2014 08:39 Go to next message
Baruch Youssin is currently offline Baruch YoussinFriend
Messages: 29
Registered: April 2013
Junior Member
Combo SWT widget has items property which is String[] and contains the list of all items that Combo shows.
I wanted to bind it to an appropriate property of my bean using the Bindings tab of WindowBuilder.
I have succeeded and want to share my results.

My first idea was to define a String[] property in my bean and bind it. It did not work out: whenever I chose items in the target side and my String[] property in the model side, Create data bindings button got disabled. Sad
I have also noticed that items property had {} notation next to it while my String[] property had [].
Eventually I figured myself the following binding code (without using WindowBuilder):
IObservableList MyWidgetObservable = WidgetProperties.items().observe(MyComposite.getCombo());
IObservableList MyModelObservable = BeanProperties.list("MyModelPropertyName").observe(MyBean);
bindingContext.bindList(MyWidgetObservable, MyModelObservable , null, null);


This code worked Razz , and this binding showed in the Bindings tab in the list of bindings; the model property appeared not the way all other model properties appeared,
MyBean.MyModelPropertyName
but rather as
MyBean.MyModelPropertyName(List).

Finally, I have found the following way to use the WindowBuilder: I have defined a LinkedList<String> property in my bean, and WindowBuilder's Bindings tab was happy to bind it to the items property. Smile

It seems to me that this behavior was intended: even though the items property of Combo returns an array String[], Combo actually supports insertion and deletion operations, and String[] is not an appropriate type on the model side to support them.

I wonder if I am missing the place where all these things are written. In particular:
- I have figured out the meaning of large part of the notation in the list of properties in the Bindings tab but far from all.
- Is there any place I can find the directions which bean property types should be used with each widget property?
Re: Binding items property of Combo using WindowBuilder [message #1236316 is a reply to message #1236115] Sun, 26 January 2014 23:10 Go to previous message
Eric Clayberg is currently offline Eric ClaybergFriend
Messages: 979
Registered: July 2009
Location: Boston, MA
Senior Member
If you are looking for detailed info on JFace Data Binding, I would suggest visiting its Eclipse Wiki page or the Eclpse JFace newsgroup.

If you want info on WindowBuilder's support for JFace Data Binding, I would start with the WindowBuilder docs on that subject.
Previous Topic:Support for Tablelayout / Contribute to project
Next Topic:Using Nebula CDateTime in WindowBuilder
Goto Forum:
  


Current Time: Thu Apr 25 05:18:00 GMT 2024

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

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

Back to the top