How to paint multiple images in a cell. [message #1679929] |
Mon, 16 March 2015 20:34 |
Nandita Uppalapati Messages: 16 Registered: March 2013 |
Junior Member |
|
|
I am struggling to get to paint multiple images in one cell. Some cells need one icon and some cells need two icons. So I set labels accordingly to the cells. And I set the Image Painters such that one painter paints the image to the left and another to the top.
But at a time only one image is being painted. The Label which NatTable finds first is the corresponding image that it is displaying. Is there a way to paint multiple images in the same cell?
@Override
public void accumulateConfigLabels(LabelStack configLabels, int columnPosition,
int rowPosition) {
if(dataProvider.hasImage(columnPosition, rowPosition)){
configLabels.addLabel(NatTableLabelConstants.CELL_WITH_IMAGE);
}
List<String> labels = dataProvider.getLabels(columnPosition, rowPosition);
if(labels!=null ){
for(String label: labels){
configLabels.addLabel(label);
}
}
}
ImagePainter imagePainter = new ImagePainter(mStyle.getRejectedCellImage(), true);
CellPainterDecorator imageDecorator = new CellPainterDecorator(beveledDecorator, CellEdgeEnum.TOP, imagePainter);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, imageDecorator, DisplayMode.NORMAL, OrdersNatTableLabelConstants.CELL_WITH_REJECTED_IMAGE);
ImagePainter imagePainter = new ImagePainter(style.getCellImage(), true);
CellPainterDecorator imageDecorator = new CellPainterDecorator(beveledDecorator, CellEdgeEnum.LEFT, imagePainter);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, imageDecorator, DisplayMode.NORMAL, NatTableLabelConstants.CELL_WITH_IMAGE);
natTable.addConfiguration(new NatTableConfiguration(mStyle));
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03289 seconds