Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Help with overriding grid line rendering methods
Help with overriding grid line rendering methods [message #1779584] Wed, 10 January 2018 00:13 Go to next message
Louis Detweiler is currently offline Louis DetweilerFriend
Messages: 100
Registered: August 2017
Senior Member
Hello,

I am trying to get it so that the vertical grid lines and a select few horizontal grid lines are larger than the other grid lines. I have for all intents and purposes a default grid layer.

The way I've been trying to go about it is by extending GridLineCellLayerPainter/SelectionLayerPainter and changing the drawHorizontalLines and drawVerticalLines methods in them to achieve the behavior that I would like to have, and then setting the layer painters for my body layer and selection layer to the new layer painters. However, when doing so all the grid lines are still rendered with a size of 1.

What am I missing?

Thanks,

Greg
Re: Help with overriding grid line rendering methods [message #1779593 is a reply to message #1779584] Wed, 10 January 2018 06:23 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Well, if you try to achieve this using the GridLineCellLayerPainter, you also need to modify the adjustCellBounds() method for the line width. Otherwise the cell painters will simply paint over the lines.

I'm not sure about your use case, but in my projects the intention was always to simply render a bigger line in some cases. Similar to the border feature in Excel. There you will notice that the grid line width does not change, only an additional border on top of the grid is painted. And that is also provided by NatTable.

There are two ways to achieve this:
- use an IOverlayPainter (or IOverlayPainter2 if more information on the layer dimensions are needed)
- use the CustomLineBorderDecorator

IMHO the CustomLineBorderDecorator is the one you are looking for. Once this painter is configured you only need to specify the label(s) at which side of the cell the border should be painted. The _4222_CellPainterExample shows an example for rendering a green border at the right border of the 5th column. Downside is that the border is painted inside the cell, so the grid lines are still visible. In your case that should not matter, as you could use the same color as the grid line and then it would look like one. But we can also think about extending the painter for inspecting the BorderModeEnum that was introduced with 1.5. If such a modification is needed, feel free to create a ticket and at best provide a patch. ;)
Re: Help with overriding grid line rendering methods [message #1780315 is a reply to message #1779593] Fri, 19 January 2018 21:38 Go to previous message
Louis Detweiler is currently offline Louis DetweilerFriend
Messages: 100
Registered: August 2017
Senior Member
Thanks, modifying adjustCellBounds() did the trick.
Previous Topic:Excel Export with .xlsx
Next Topic:Combo box drop down menu appearing outside of viewport
Goto Forum:
  


Current Time: Thu Apr 18 12:29:35 GMT 2024

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

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

Back to the top