Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » JFace Databinding exception(java.lang.IllegalArgumentException: Could not find property with name)
JFace Databinding exception [message #965053] Tue, 30 October 2012 20:58
Prashant p is currently offline Prashant p
Messages: 57
Registered: October 2012
Member
Hi,

I am new to Jface databinding. I am trying to poulate table using data binding. When any one clicks on row, vales are shown in mapped text field.When i do this i get Exception.("java.lang.IllegalArgumentException: Could not find property with name name in class class com.swt.pro.model.Employee")Below is the class structure.

I have 3 Model class which are responsible for populating 1 GUI table

public class WorkplaceDetail extends AbstractModelObject {

private int code;
private String plant;
private String compRegNum;
private final List <Employee> m_employee = new ArrayList();
}

public class Employee extends AbstractModelObject{


private String empName;
private int empNumber;
private List<Address> address = new ArrayList();
}

public class Address extends AbstractModelObject{

private String primaryPhone;
private String secPhone;
}

In main class I am populating value of these models

List<WorkplaceDetail> m_workplace = new ArrayList();

public void initializeModels() {
WorkplaceDetail workplaceDetail = new WorkplaceDetail(1, "von Goethe",);
//m_workplace.add(workplaceDetail);

Employee employee = new Employee("Prashant");
workplaceDetail.addEmployee(employee);

Address adrss = new Address("3761237",null);
workplaceDetail.addAddress(adrss);
m_workplace.add(workplaceDetail);
}

Databinding method

ObservableListContentProvider simpleTableViewerContentProviderList = new ObservableListContentProvider();
IObservableMap[] simpleTableViewerLabelProviderMaps = PojoObservables.observeMaps(simpleTableViewerContentProviderList.getKnownElements(), WorkplaceDetail.class, new String[]{"code","plant", "compRegNum"});
m_workplaceViewer.setLabelProvider(new ObservableMapLabelProvider(simpleTableViewerLabelProviderMaps));
m_workplaceViewer.setContentProvider(simpleTableViewerContentProviderList);

WritableList smListWritableList = new WritableList(m_workplace, WorkplaceDetail.class);
m_workplaceViewer.setInput(smListWritableList);

IObservableMap[] _simpleTableViewerLabelProviderMaps = PojoObservables.observeMaps(simpleTableViewerContentProviderList.getKnownElements(), Employee.class, new String[]{"name"});
m_workplaceViewer.setLabelProvider(new ObservableMapLabelProvider(_simpleTableViewerLabelProviderMaps));


IObservableMap[] simpleTableViewerLabelProviderMaps_2 = PojoObservables.observeMaps(simpleTableViewerContentProviderList.getKnownElements(), Address.class, new String[]{ "phone1", "phone2"});
m_workplaceViewer.setLabelProvider(new ObservableMapLabelProvider(simpleTableViewerLabelProviderMaps_2));

WritableList smListWritableList = new WritableList(m_workplace, WorkplaceDetail.class);
m_workplaceViewer.setInput(smListWritableList);

When i run this i get exception

"Status WARNING: org.eclipse.core.databinding code=0 Could not read value of com.swt.pro.model.WorkplaceDetail@14ffc5.empName java.lang.IllegalArgumentException: object is not an instance of declaring class

Also i attached Expected output screen. Please help me to resolve the exception.

[Updated on: Wed, 31 October 2012 05:05]

Report message to a moderator

Previous Topic:The control List,how to Display and hide????
Next Topic:Show/Hide pages in MultiPageEditor
Goto Forum:
  


Current Time: Sat Apr 19 16:14:08 EDT 2014

Powered by FUDForum. Page generated in 0.08404 seconds