Skip to main content



      Home
Home » Eclipse Projects » NatTable » CellPainterDecorator
CellPainterDecorator [message #1181452] Mon, 11 November 2013 11:07 Go to next message
Eclipse UserFriend
I have a bean as a model object for a cell. I have registered a converter to get its string representation.

I would like to decorate that cell with a short text. This text is stored in the model bean. How can I add a CellPainterDecorator to paint that short text let's say on the right side of the cell?

The example CellPainterDecorator shows exactly what I'm looking for, but it uses image decorator and the image is not get from the cell model. It's static.
Re: CellPainterDecorator [message #1181717 is a reply to message #1181452] Mon, 11 November 2013 14:57 Go to previous messageGo to next message
Eclipse UserFriend
The more dynamic it becomes, the more you have to adjust.

If you want to show an dynamic icon, it should be enough to create the decorator without an initial image and register the image within a style against a label.

If you want to decorate with a text that is also retrieved out of the model you have to find a way how the decorator is able to retrieve the data. Haven't done anything similar before.
Re: CellPainterDecorator [message #1182593 is a reply to message #1181717] Tue, 12 November 2013 04:35 Go to previous message
Eclipse UserFriend
Ok, I have done it by overriding its convertDataType(ILayerCell cell, IConfigRegistry configRegistry) method
CellPainterDecorator painterDecorator = new CellPainterDecorator(
     new TextPainter(), 
     CellEdgeEnum.RIGHT, 
     new TextPainter() {
					
	 @Override
	 protected String convertDataType(ILayerCell cell, IConfigRegistry configRegistry) {
	      Object model = cell.getDataValue();
              if (model instanceof MerenyBod) {
                   // return model specific text
                   ...
	      }
	      return StringUtils.EMPTY;
	 }
     }, 
     true
);
Previous Topic:Pop up menu in Editable cells.
Next Topic:How to use ColumnHideShowLayer with ColumnGroupHeaderLayer
Goto Forum:
  


Current Time: Mon Jul 14 09:39:20 EDT 2025

Powered by FUDForum. Page generated in 0.05201 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top