Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Remove selection anchor
Remove selection anchor [message #1740004] Sun, 07 August 2016 21:07 Go to next message
Loris Securo is currently offline Loris SecuroFriend
Messages: 3
Registered: August 2016
Junior Member
Is it possible to not display the selection anchor that appears using the selection layer?
It seem hard coded in SelectionLayerPainter, it is only possible to change the style.
Re: Remove selection anchor [message #1740092 is a reply to message #1740004] Tue, 09 August 2016 07:00 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Change the selection anchor style to look like the selection.
Re: Remove selection anchor [message #1740140 is a reply to message #1740092] Tue, 09 August 2016 15:05 Go to previous messageGo to next message
Loris Securo is currently offline Loris SecuroFriend
Messages: 3
Registered: August 2016
Junior Member
Dirk Fauth wrote on Tue, 09 August 2016 07:00
Change the selection anchor style to look like the selection.


The problem with that approach is that since the border is still drawn, it will cover the external grid lines: http://imgur.com/qqXq7rR

But even worse is when we don't draw grid lines, then the border will cover part of the upper cell and there will be a noticeable height difference between the row header and the selected cell: http://imgur.com/IubNFaV

That's why I think there should be a way to not paint it at all.

This is the code I used for the examples:
    public static class MyTheme extends DefaultNatTableThemeConfiguration {

		public MyTheme() {
			// for no grid lines:
			renderBodyGridLines = false;
			renderColumnHeaderGridLines = false;
			renderRowHeaderGridLines = false;
			renderCornerGridLines = false;

			// selection background color
			defaultSelectionBgColor = GUIHelper.COLOR_RED;

			// anchor background color
			selectionAnchorSelectionBgColor = GUIHelper.COLOR_RED;

			// anchor internal border
			selectionAnchorBorderStyle = new BorderStyle(1, GUIHelper.COLOR_RED, LineStyleEnum.SOLID);

			// anchor selection border
			selectionAnchorGridBorderStyle = new BorderStyle(1, GUIHelper.COLOR_RED, LineStyleEnum.SOLID);
		}

	}

[Updated on: Tue, 09 August 2016 15:08]

Report message to a moderator

Re: Remove selection anchor [message #1740160 is a reply to message #1740140] Tue, 09 August 2016 22:08 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Quote:
That's why I think there should be a way to not paint it at all.


This is an open source project. Feel free to create a ticket and provide a patch via Gerrit.

In theory you simply need to add a new configuration parameter and skip the whole processing regarding the border painting in the SelectionLayerPainter.
Re: Remove selection anchor [message #1740164 is a reply to message #1740160] Tue, 09 August 2016 22:34 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
After thinking more about this, there is no need to add such a configuration parameter. The SelectionLayerPainter only exists to render the selection borders. So you achieve your desired result by not using it.

selectionLayer.setLayerPainter(new GridLineCellLayerPainter());


By adding that simple line of code there will be no rendering of the selection borders.
Re: Remove selection anchor [message #1740166 is a reply to message #1740164] Tue, 09 August 2016 23:34 Go to previous messageGo to next message
Loris Securo is currently offline Loris SecuroFriend
Messages: 3
Registered: August 2016
Junior Member
Dirk Fauth wrote on Tue, 09 August 2016 22:34
After thinking more about this, there is no need to add such a configuration parameter. The SelectionLayerPainter only exists to render the selection borders. So you achieve your desired result by not using it.

selectionLayer.setLayerPainter(new GridLineCellLayerPainter());


By adding that simple line of code there will be no rendering of the selection borders.

That was what I did, but then I added a FillHandleConfiguration which take the selection layer and substitute his painter with a FillHandleLayerPainter which extends SelectionLayerPainter and so it paints the borders again.

In the end I managed with a messy solution, creating my own FillHandleLayerPainter and remaking the whole paint method.

It would be definitely better to just decide to not draw the borders.
Re: Remove selection anchor [message #1740172 is a reply to message #1740166] Wed, 10 August 2016 05:41 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
You didn't mention the fill handle before.

As I said before, this is an open source project and we accept contributions.
Previous Topic:Hided dynamic column whose header is persisted leads to refresh issues
Next Topic:Condition based styling for cells
Goto Forum:
  


Current Time: Thu Apr 25 16:55:04 GMT 2024

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

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

Back to the top