Skip to main content



      Home
Home » Eclipse Projects » NatTable » Cell painting with Combination of images
Cell painting with Combination of images [message #1782700] Tue, 27 February 2018 22:53 Go to next message
Eclipse UserFriend
We have a requirement to visualize a state of the cell.

Each cell represents user's DB CRUD access so each cell has four boolean flags for create, read, update and delete. To visualize, each cell should show four images with each image showing state of that flag.

We defined 8 labels (CREATE, NO_CREATE, READ, NO_READ etc) and adding these labels based on underlying model. So at any time, each cell will have 4 labels. We want to show 4 images in each cell with each image showing the state of corresponding flag.

Based on the research and from Dirk's suggestion, CellDecoratorPainter is the preferred approach. But each cell with a label is associated with one cell painter (in this case CellDecoratorPainter) so how do we use that to render combination of these images?

One approach I could think of is, instead of creating individual labels for READ, NO_READ etc., create 4x4x2 labels like READ_CREATE_UPDATE_DELETE, NO_READ_CREATE_UPDATE_DELETE and associate each of these labels with one cell painter decorator to paint series of images accordingly.

Not sure if that is the only possible approach. If any of you come across this type of situation, can you please share some thoughts?

[Updated on: Wed, 28 February 2018 00:03] by Moderator

Re: Cell painting with Combination of images [message #1782703 is a reply to message #1782700] Wed, 28 February 2018 01:16 Go to previous messageGo to next message
Eclipse UserFriend
You could implement a custom ImagePainter that inspects the cell labels and draws images based on the labels in the label stack. Or stack CellPainterDecorators so that every decorator has an image as decoration that is only painted in case of the cell label, and has another decorator as base painter.

But honestly, writing a custom ImagePainter that inspects the labels and draws the images on occurence of a label seems to be more intuitive.
Re: Cell painting with Combination of images [message #1782739 is a reply to message #1782703] Wed, 28 February 2018 12:29 Go to previous message
Eclipse UserFriend
Dirk, thank you for taking time to reply.

After spending lots of time creating various images with combination of flags, what you suggested worked out to be best approach. I implemented CombinationImagePainter (https://gist.github.com/brsanthu/cd2f91da7777aa994e011f7acedd900a), which does paint combination of images depending on available labels at that cell.

It is working great.
Previous Topic:Make row index stable when Rowreorder is done
Next Topic:Sorting not proper
Goto Forum:
  


Current Time: Fri Jul 25 02:21:32 EDT 2025

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

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

Back to the top