CellStyleGenerator

I have trouble understanding the way CellStyleGenerator works. I have a program which among other things shows the quantity of products in a table.
What I want to do is paint the background of a cell yellow if there are 5 or less products available and red if there are none.
The data is fed to the table through a BeanItemContainer with setContainerDataSource(). I’ve tried to find some hints from the demos and BoV to no avail.
The thing I’m puzzled with is how to access the data inside an Item.
Any and all help would be much appreciated.



table.setCellStyleGenerator(new Table.CellStyleGenerator() {
public String getStyle(Object itemId, Object propertyId) {
            //print itemid and propertyid & see what U get :D
           //if itemid.getclass==Product.class, then process it and return style name (say productlessthanfive)
           


}
});



.v-table-cell-content-productlessthanfive {
background: white;
color: black;
}

And if you are not using BeanItemContainer, the item id will not be your POJO but you can get the item (and through it, its properties and their values) from the table or the container with the item id.

Thank you for your reply. I have tried to print the contents of item and property:

 Item item = table.getItem(itemId);
           System.out.println(item.toString());
           Property itemProperty = item.getItemProperty(propertyId);
           System.out.println(itemProperty.toString()); 

But get null pointer exception for printing itemProperty.
I have no idea what so ever how to process properties inside containers.
This was my question in the first place. If you could assist me further I’d be more than grateful

Mich