Hello!
I have set up the following method for creating a generated column. It works ok, but the problem is, the last item on the row gets the Error label. Always the last item, it doesnt matter what items I set up, and if I add a new one, the one that was last gets the icon, and the new one gets the error label. Here is my code.
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
System.out.println(source.getContainerDataSource().getContainerProperty(3, "State"));
Property prop = source.getContainerDataSource().getContainerProperty(itemId, "State");
if (prop.getValue().equals("Offline")) {
Resource stop = new ThemeResource("icons/stop16.png");
Image image = new Image("Offline", stop);
return image;
}else if (prop.getValue().equals("Online")){
Resource start = new ThemeResource("icons/accept16.png");
Image image = new Image("Online", start);
return image;
}
return new Label("Error");
}
Can anyone help me? Thank you in advance.