Skip to main content



      Home
Home » Eclipse Projects » NatTable » ColumnReorderEvent values incorrect
ColumnReorderEvent values incorrect [message #1059606] Mon, 20 May 2013 15:14 Go to next message
Eclipse UserFriend
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 03:52 Go to previous messageGo to next message
Eclipse UserFriend
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 09:55 Go to previous messageGo to next message
Eclipse UserFriend
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 09:59 Go to previous messageGo to next message
Eclipse UserFriend
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 10:02 Go to previous messageGo to next message
Eclipse UserFriend
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 10:57 Go to previous messageGo to next message
Eclipse UserFriend
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 11:06 Go to previous message
Eclipse UserFriend
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 Jul 24 11:24:56 EDT 2025

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

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

Back to the top