Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Difference between region labels and config labels?
Difference between region labels and config labels? [message #1625568] Fri, 20 February 2015 13:35 Go to next message
Nils Ruhr is currently offline Nils RuhrFriend
Messages: 9
Registered: January 2015
Junior Member
Hi,

every cell in my table can have a differnt type of expression. I use config labels to tag the type. For this I override the getConfigLabelsByPosition-method and add my own labels.

Now I've noticed, that the CellEditorMouseEventMatcher uses "region labels" via the getRegionLabelsByXY-method to match the event.

Why are there two types of labels?

Thx, Nils.
Re: Difference between region labels and config labels? [message #1625645 is a reply to message #1625568] Fri, 20 February 2015 14:37 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Quote:
For this I override the getConfigLabelsByPosition


Why is everybody overriding getConfigLabelsByPosition() instead of using IConfigLabelAccumulator? Is it too complicated to create and use the accumulator compared to anonymously overriding internal methods?

No one ever explained to override getConfigLabelsByPosition(). In my tutorials I always talk about the IConfigLabelAccumulator.

https://www.eclipse.org/nattable/documentation.php?page=styling
http://www.vogella.com/tutorials/NatTable/article.html#architecture_labels

Nevertheless, that's not your question, although IMHO overriding the method is the wrong way to go because you might loose necessary labels.

The region labels are used for layer compositions to identify the region you are in. This is necessary for example to identify the action bindings for a region, since e.g. a click in the column header triggers a column selection while a click in a cell only selects the cell.
Re: Difference between region labels and config labels? [message #1630607 is a reply to message #1625645] Mon, 23 February 2015 09:31 Go to previous messageGo to next message
Nils Ruhr is currently offline Nils RuhrFriend
Messages: 9
Registered: January 2015
Junior Member
Thank you! The tutorial is very helpfull. I will change my code accordingly.

Is it possible to add custom labels to the region labels in the same manner as adding config labels? My use case is:
- For one type of expression I want to activatate the cell editor on a single click.
- For another type of expression I want to activate the cell editor on a double click.

The code I use looks similar to this one:
CellEditorMouseEventMatcher matcher = new CellEditorMouseEventMatcher(expressionType)
if(expressionType.equals(...)) {
uiBindingRegistry.registerDoubleClickBinding(matcher, new MouseEditAction());
} else {
uiBindingRegistry.registerSingleClickBinding(matcher, new MouseEditAction());
}


However the IMouseEventMatcher works only for regionLabels. The ideal solution would be to have my config labels apply to the region labels.
Re: Difference between region labels and config labels? [message #1630641 is a reply to message #1630607] Mon, 23 February 2015 09:57 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
No, and you shouldn't override or adjust the region labels!

Sounds more like you need a custom matcher. Why don't you extend the CellEditorMouseEventMatcher and add an additional check for cell labels. Like, if you are in the body, there is an editor (this is what the CellEditorMouseEventMatcher does) AND the cell label stack contains your single/double click label ...
Previous Topic:Avoid to trim text in AbstractTextPainter
Next Topic:Creating structure in Tree
Goto Forum:
  


Current Time: Tue Apr 23 17:01:35 GMT 2024

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

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

Back to the top