Auto row height for images [message #1688846] |
Sat, 21 March 2015 19:19  |
Eclipse User |
|
|
|
Hi all,
I've a column which displays an image depending on data value (i.e., the
data from model object is a path which points to an image). I've created
a CellImagePainter which overrides the getImage method:
public class CellImagePainter extends ImagePainter {
@Override
protected Image getImage(ILayerCell cell, IConfigRegistry
configRegistry) {
Image retval = null;
Object dataValue = cell.getDataValue();
if (dataValue instanceof Image) {
retval = (Image)dataValue;
}
return retval;
}
This works as expected, but the image is higher than the default height
on rows and therefore it's cut. How can I achieve that the row is
automatically resized according to the height of the image? If I use
this construct (taken from Examples):
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_PAINTER,
new PaddingDecorator(
new CellPainterDecorator(
new AutomaticRowHeightTextPainter(2), CellEdgeEnum.LEFT, new
CellImagePainter())), DisplayMode.NORMAL, PICTURE_CELL_LABEL);
the cell is painted a little larger (but not enough) with the text
representation of the image (i.e., "{Image 5654601516}"). This is not
very beautiful...
TIA,
Ralf.
|
|
|
|
|
Re: Auto row height for images [message #1689036 is a reply to message #1688952] |
Sun, 22 March 2015 09:37  |
Eclipse User |
|
|
|
Am 22.03.2015 um 08:45 schrieb Dirk Fauth:
> Oh, I forgot that I implemented that feature already in ImagePainter for
> 1.2.0
>
> You just need set the calculateByHeight flag on ImagePainter to true, so
> it automatically resizes the row height.
Hi Dirk,
thanks for your fast answer. It works now as expected! NatTable rocks!!!
Regards,
Ralf.
|
|
|
Powered by
FUDForum. Page generated in 0.28057 seconds