return customDescriptorHolderByCaption;
}
@Override
public void onAddCustomColumnDescriptor(final AddCustomColumnDescriptorEvent event) {
FormField formField;
final Class<?> fieldType = event.getDescriptorHolder().getFieldType();
final String caption = event.getDescriptorHolder().getCaption();
final String fieldPath = event.getDescriptorHolder().getFieldPath();
if (fieldType.equals(Boolean.class)) {
final ListBoxFormFieldRenderer formFieldRenderer = new ListBoxFormFieldRenderer();
formFieldRenderer.addItem(Boolean.TRUE.toString(), Boolean.TRUE);
formFieldRenderer.addItem(Boolean.FALSE.toString(), Boolean.FALSE);
formField = new FormField(formFieldRenderer);
} else if (fieldType.equals(Date.class)) {
formField = new FormField(new DateBoxFormFieldRenderer());
} else if (fieldType.equals(Integer.class)) {
formField = new FormField() {
@Override
public Object getValue() {
if (super.getValue() != null) return getIntegerValue();
return null;
}
};
} else if (fieldType.equals(Long.class)) {
formField = new FormField() {
@Override
public Object getValue() {
if (super.getValue() != null) return getLongValue();
return null;
}
};
} else if (fieldType.equals(Double.class)) {
formField = new FormField() {
@Override
public Object getValue() {
if (super.getValue() != null) return getDoubleValue();
return null;
}
};
} else formField = new FormField();
final ComplexHeaderCellRenderer headerCellRenderer = new ComplexHeaderCellRenderer(caption, formField, fieldPath);
final ListColumnDescriptor<D, Object> columnDescriptor = new ListColumnDescriptor<D, Object>();
columnDescriptor.setHeaderCellRenderer(headerCellRenderer);
columnDescriptor.setCustom(true);
columnDescriptor.setValueProvider(new BeanValueProvider<D, Object>(fieldPath));