I write my application that uses Tableview in which I want to represent and edit list of data.
I have data model. Something like
public class CModel
{
private List<CItem> m_lstItems;
public List<CItem> getList()
{
return m_lstItems;
}
}
public class CItem
{
private String m_sName;
private String m_sType;
public void setName(String s)
{
m_sName = s;
}
public String getName()
{
return new String(m_sName);
}
}
If I need to bind my data model I can create observableList(). But this doesn’t allow me to observe items editing. To make editing possible I need to inherit CItem members from Observable. If I declare it as Property TableView observes items changes.
The problem is that if CModel is pure data model I shouldn’t inherit it from Observable (because data and its view should be separated).
How can I wrap every list item with Observable or what is best approach?