Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » ColumnReorderEvent values incorrect
ColumnReorderEvent values incorrect [message #1059606] Mon, 20 May 2013 19:14 Go to next message
Mark Proe is currently offline Mark Proe
Messages: 29
Registered: July 2009
Junior Member
Hello,

I am using a ColumnReorderLayer in my NatTable. I have added a listener to that layer so I can be notified when a ColumnReorderEvent happened.

For the most part, the TO COLUMN and FROM COLUMN values from the ColumnReorderEvent appear to be what I'd expect. However, when I drag a column to the end of my table, things go wrong. I am seeing an invalid TO COLUMN value. (For example, if I have 7 columns in my table...When I drag a column to the right of Column 7, I would expect to see a TO COLUMN of 7. But instead, I see a value of 5?)

Thanks,
Mark
Re: ColumnReorderEvent values incorrect [message #1059679 is a reply to message #1059606] Tue, 21 May 2013 07:52 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1339
Registered: July 2012
Senior Member
Hi,

instead of relying on getBeforeToColumnPosition() you should work with the StructuralDiff objects.

The beforeColumnPosition is
a) the column position before the change applied
b) it is interpreted with inspecting another field reorderToLeftEdge

Working with the StructuralDiff objects will return the positions you expect.

columnReorderLayer.addLayerListener(new ILayerListener() {
			
	@Override
	public void handleLayerEvent(ILayerEvent event) {
		if (event instanceof ColumnReorderEvent) {
			System.out.println("BeforeToColumnPos: " + ((ColumnReorderEvent)event).getBeforeToColumnPosition());
			for (StructuralDiff diff : ((ColumnReorderEvent)event).getColumnDiffs()) {
				System.out.println("Diff " + diff.getDiffType() + ": " + diff.getAfterPositionRange().end);
			}
		}
	}
});


Greez,
Dirk
Re: ColumnReorderEvent values incorrect [message #1059747 is a reply to message #1059679] Tue, 21 May 2013 13:55 Go to previous messageGo to next message
Mark Proe is currently offline Mark Proe
Messages: 29
Registered: July 2009
Junior Member
Dirk,

I am still seeing incorrect values using your method.

BeforeToColumnPos: 5
Diff DELETE: 0
Diff ADD: 5

I am moving my first column to the right of my seventh column. So I would expect to see a value of 7.

Again, the problem only seems to be when dragging to the rightmost edge of the table. Everything appears to be correct when dragging within the middle of the table.

Mark
Re: ColumnReorderEvent values incorrect [message #1059750 is a reply to message #1059747] Tue, 21 May 2013 13:59 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1339
Registered: July 2012
Senior Member
Which version of NatTable? I am seeing things correctly with 1.0.0
Re: ColumnReorderEvent values incorrect [message #1059752 is a reply to message #1059750] Tue, 21 May 2013 14:02 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1339
Registered: July 2012
Senior Member
sorry, have to correct myself, it is working correctly if you move column 6 to 7

please file a bug
Re: ColumnReorderEvent values incorrect [message #1059782 is a reply to message #1059752] Tue, 21 May 2013 14:57 Go to previous messageGo to next message
Mark Proe is currently offline Mark Proe
Messages: 29
Registered: July 2009
Junior Member
I am using 1.0.0

Yes, dragging the second-to-last column seems to work fine for some reason. But dragging earlier columns do not.
Re: ColumnReorderEvent values incorrect [message #1059784 is a reply to message #1059782] Tue, 21 May 2013 15:06 Go to previous message
Mark Proe is currently offline Mark Proe
Messages: 29
Registered: July 2009
Junior Member
Bug created.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=408598
Previous Topic:Detecting changes in a list - without glazedlists
Next Topic:nattable in high resolution
Goto Forum:
  


Current Time: Thu Oct 23 01:49:41 GMT 2014

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

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