Hi!
I use the CssLayout class for generated columns in my table. The table is updated frequently during long period (one-two days). As the result I observe the large amount of ArrayList objects used by the CssLayout instances. The garbage collector cannot destroy such objects because of loop which you can see at this picture:
Any hints, comments?
My code looks like that:
[code]
addGeneratedColumn(STATUS, new CustomTable.ColumnGenerator() {
private static final long serialVersionUID = 1L;
@Override
public Object generateCell(CustomTable source, final Object itemId, Object columnId) {
final CssLayout layout = new CssLayout();
if( isOnline(itemId) ) {
layout.setStyleName("device-status-online");
} else {
layout.setStyleName("device-status-offline");
}
final Property.ValueChangeListener listener = new ValueChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void valueChange(Property.ValueChangeEvent event) {
if( isOnline(itemId) ) {
layout.setStyleName("device-status-online");
} else {
layout.setStyleName("device-status-offline");
}
}};
final Item item = source.getItem(itemId);
if( item instanceof BeanItem ) {
final BeanItem<?> beanItem = (BeanItem<?>) item;
{
final Property<?> itemProperty = beanItem.getItemProperty("touchTime");
if( itemProperty instanceof Property.ValueChangeNotifier ) {
Property.ValueChangeNotifier notifier = (com.vaadin.data.Property.ValueChangeNotifier) itemProperty;
notifier.removeValueChangeListener(listener);
notifier.addValueChangeListener(listener);
}
}
}
return layout;
[/code]When I switched on HorizontalLayout instead of CssLayout the problem disappeared.
Thanks in advance,
AnatolyS