Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » NPEs on empty table (BodyCellEditorMouseEventMatcher)
NPEs on empty table (BodyCellEditorMouseEventMatcher) [message #1051993] Mon, 29 April 2013 13:35 Go to next message
Joachim Fuchs is currently offline Joachim FuchsFriend
Messages: 34
Registered: February 2013
Member
Hi,
the BodyCellEditorMouseEventMatcher as well as the RowSelectionModel seem to be very confident having done a call like
ILayerCell cell = selectionLayer.getCellByPosition(columnPosition, rowPosition);
.

The table that I am playing around with right now holds no data. Hence there are no cells. But as soon as there is a mouse click there is an NPE as well. Probably because the getCellByPosition() call returns null.

Is there a way to prevent this? I have implemented some kind of custom clicking behavior to achieve a 'full row but single row' selection behavior and 'select and show context popup menu on right click'.

Thanks for your help.

J
Re: NPEs on empty table (BodyCellEditorMouseEventMatcher) [message #1052001 is a reply to message #1051993] Mon, 29 April 2013 13:47 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Well, yes of course, the NPE is the result of clicking something that doesn't exist. So the question is, why is the cell event matcher called when you click on something that doesn't exist?
Now that sounds philosophical.

To the issue, the BodyCellEditorMouseEventMatcher (deprecated in 1.0.0 and replaced by CellEditorMouseEventMatcher by the way) is configured to only start working if the label stack contains the GridRegion.BODY label. Now if your table is empty, there should be no cell that has that label attached, as there is no cell in the body. So in fact I really wonder how the code that fires the NPE is reached for an empty table.

Could you provide a small sample that shows the issue?
Re: NPEs on empty table (BodyCellEditorMouseEventMatcher) [message #1057804 is a reply to message #1052001] Wed, 08 May 2013 21:46 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
OK, I found the reason to the exception. It happends indeed if you have a NatTable with a viewport, configured for editing, and there are not enough cells to fill the viewport area.

I created and fixed the bug by adding null checks to CellPainterMouseEventMatcher and CellEditorMouseEventMatcher. For backwards compatibility I also modified the BodyCellEditorMouseEventMatcher which will be deprecated with 1.0.0.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=407598

Sorry for not seeing the issue before. But with 1.0.0 it should be fixed.
Previous Topic:Freeze question
Next Topic:NatTable evaluation
Goto Forum:
  


Current Time: Thu Mar 28 23:26:08 GMT 2024

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

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

Back to the top