Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » WindowBuilder » Binding through several instances?
Binding through several instances? [message #759633] Tue, 29 November 2011 12:20 Go to next message
membersound is currently offline membersoundFriend
Messages: 5
Registered: November 2011
Junior Member
how can I bind a LinkedList to a ListViewComponent through several model-layers? Eg:
Create a controller class within the ApplicationWindow, create a new Model object within the controller, and create a new LinkedList within the model.
public class MainWindow extends ApplicationWindow {
	private Controller controller = new Controller();

public class Controller extends AbstractModelObject {
	private Mode model = new Model();
	//getter + setter

public class model extends AbstractModelObject {
	private List<Person> personList = new LinkedList<Person>();
	//getter + setter

public class Person extends AbstractModelObject {
	String name;
	int age;
//getter + setter

NOW: I tried the visual binding to the listViewer by selecting:
Target (Widget): listViewer, input
Model (Bean): controller, model>personList

which generates me the following code:
IObservableList controllermodelpersonListObserveList = BeansObservables.observeList(Realm.getDefault(), controller, "model.personList");

BUT running it throws UE:
java.lang.IllegalArgumentException: Could not find property with name model.personList in class class gui.Controller
	at org.eclipse.core.internal.databinding.beans.BeanPropertyHelper.getPropertyDescriptor(
	at org.eclipse.core.databinding.beans.BeanProperties.list(
	at org.eclipse.core.databinding.beans.BeansObservables.observeList(
	at org.eclipse.core.databinding.beans.BeansObservables.observeList(
	at gui.MainWindow.initDataBindings(
	at gui.MainWindow.createContents(
	at org.eclipse.jface.window.Window.create(
	at gui.MainWindow$
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(
	at gui.MainWindow.main(

What can I do to fix this? Am I doing wrong with my setup?

Further I noticed: IF I would not create the controller-bean in the AppWindow class, but would create the model-bean directly, THEN I could select "model, personList" for binding and everything works fine!
But as I need the controller in front of the model, how can I do this?

Re: Binding through several instances? [message #764591 is a reply to message #759633] Mon, 12 December 2011 13:45 Go to previous message
Andrey Sablin is currently offline Andrey SablinFriend
Messages: 12
Registered: March 2011
Junior Member
BeansObservables not allowed using dot-separeter property names for observe lists, sets and maps (its allowed only for observe single values).

Using followed template is INCORRECT:
Target (Widget) = listViewer, input
Model (Bean) = controller, model>personList

CORRECT template to use is:
Target (Widget) = listViewer, input
Model (Bean) = controller>model, personList

PS Trunk fixed for disabling button "Create binding" for incorrect template.
  • Attachment: incorrect.png
    (Size: 186.75KB, Downloaded 662 times)
  • Attachment: correct.png
    (Size: 187.31KB, Downloaded 736 times)

[Updated on: Mon, 12 December 2011 13:48]

Report message to a moderator

Previous Topic:Exception parsing a form composite whose constructor contains additional parameters.
Next Topic:WindowBuilder Design Mode changes parent when moving objects
Goto Forum:

Current Time: Thu Apr 19 21:36:46 GMT 2018

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

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