Skip to main content

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] Wed, 31 October 2012 00:58
Prashant p is currently offline Prashant pFriend
Messages: 57
Registered: October 2012

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")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",);

Employee employee = new Employee("Prashant");

Address adrss = new Address("3761237",null);

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));

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

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);

When i run this i get exception

"Status WARNING: org.eclipse.core.databinding code=0 Could not read value of 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 09:05]

Report message to a moderator

Previous Topic:Views and Double Click event prob
Next Topic:Show/Hide pages in MultiPageEditor
Goto Forum:

Current Time: Wed May 23 07:28:34 GMT 2018

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

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

Back to the top