Hello guys,
I’m using Varitin addon (v 1.61) in my web app. I’m trying to implement lazy loading using MTable as following:
[code]
private List users = new ArrayList();
users = gbemForCommonDb.getEntitymanager().createQuery(“SELECT ua FROM UserAccount ua”)
.getResultList();
usersMTable = new MTable(CommonUserAccount.class)
.withFullHeight()
.withFullWidth()
.withStyleName(“striped”, ValoTheme.TABLE_BORDERLESS, ValoTheme.TABLE_NO_HORIZONTAL_LINES, ValoTheme.TABLE_NO_VERTICAL_LINES)
.withProperties(“email”, “firstname”, “lastname”, “username”)
.withColumnHeaders(GroupBuilderApp.getInstance().getTranslation(“email”),
GroupBuilderApp.getInstance().getTranslation(“firstname”),
GroupBuilderApp.getInstance().getTranslation(“lastname”),
GroupBuilderApp.getInstance().getTranslation(“username”))
.withValueChangeListener(new MValueChangeListener() {
@Override
public void valueChange(MValueChangeEvent event) {
setModificationsEnabled(event.getProperty().getValue() != null);
}
private void setModificationsEnabled(boolean b) {
editItem.setEnabled(b);
removeItem.setEnabled(b);
}
}).lazyLoadFrom(new LazyList.PagingProvider() {
@Override
public List findEntities(int firstRow) {
return users.subList(firstRow, 20);
}
}, new LazyList.CountProvider() {
@Override
public int size() {
return users.size();
}
});
usersMTable.addBeans(users);
[/code]But getting the following error in the line usersMTable.addBeans(users) :
Severe: java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:148)
at java.util.AbstractList.add(AbstractList.java:108)
at org.vaadin.viritin.ListContainer.addItem(ListContainer.java:378)
Am I doing anything wrong? If so then what is the solution then?
@MattiTahvonen it would be a great pleasure for me if you have a look on my issue
Thanks in advance