Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Autoscroll during Drag&Drop?(How to implement autoscroll of NatTable during dragging?)
Autoscroll during Drag&Drop? [message #1421473] Thu, 11 September 2014 12:16 Go to next message
Matthias Paul Scholz is currently offline Matthias Paul ScholzFriend
Messages: 40
Registered: May 2012
Member
Hi,

I have a NatTable with a number of items such that a vertical scroll bar gets displayed.
I've implemented Drag & Drop of table items inside of the NatTable; it is working well as long I am dragging inside of the visible area only; yet, I can't get the table to autoscroll when I drag an item over the lower bound of it.

According to the documentation of DropTargetAdapter, this should be achieved by setting event.feedback to DND.FEEDBACK_SCROLL in the dragOver() method; however, this does not seem to have any effect on the NatTable.

What is the correct way to achieve autoscrolling here?
Re: Autoscroll during Drag&Drop? [message #1421558 is a reply to message #1421473] Thu, 11 September 2014 14:27 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
First, NatTable has its own forum, so I prefer to ask questions there. Smile

Second, AFAIK NatTable doesn't support autoscroll on drag&drop operations out of the box. We provide that feature for example if you are dragging columns in a NatTable to reorder, but currently not for drag operations that started outside.
You might want to have a look at the ColumnReorderBindings (if that is the correct name). There should be a binding registered that fires a scroll event if the mouse cursor stays on the edge of the viewport. Not sure if that helps. I would need to take a closer look myself.
Re: Autoscroll during Drag&Drop? [message #1421566 is a reply to message #1421558] Thu, 11 September 2014 14:45 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Updated information:

You need to execute a ViewportDragCommand somehow, so the scrolling happens. But I don't think you are able to do this without modifying NatTable code itself.

Looks like you need to file an enhancement ticket. And maybe contributing the corresponding patch.
Re: Autoscroll during Drag&Drop? [message #1421597 is a reply to message #1421566] Thu, 11 September 2014 15:45 Go to previous messageGo to next message
Matthias Paul Scholz is currently offline Matthias Paul ScholzFriend
Messages: 40
Registered: May 2012
Member
Hi Dirk,

Thanks for looking into this.
Sorry for not being aware that there is a particular NatTable forum - you might want to move this discussion there.

I've filed an enhancement ticket (https://bugs.eclipse.org/bugs/show_bug.cgi?id=443850).

Will think about a possible solution to this based on your proposal.
Re: Autoscroll during Drag&Drop? [message #1422351 is a reply to message #1421597] Fri, 12 September 2014 18:30 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Quote:
I've implemented Drag & Drop of table items inside of the NatTable


I missed one detail in your question ... you are dragging INSIDE NatTable, not trying to drag and drop things from the outside into a NatTable.

In that case you shouldn't use SWT Drag&Drop implementations. When operating inside NatTable you should implement and register a IDragMode like the ColumnReorderDragMode or the RowReorderDragMode that executes a ViewportDragCommand on move.
But notice that in such cases the autoscroll only works if the mouse cursor hovers on the edge, still inside the NatTable. If you are moving the mouse cursor outside the NatTable area, we do not get any further events.

Maybe you could create and register a new IDragMode that enables dragging of items in NatTable. And to add the possibility to autoscroll when moving out of the NatTable area you would need to create and register an action on mouseExit that checks if the item dragging is currently active, and if so start scrolling. Of course you would need another action on mouseEnter that stops autoscrolling.

Although this would be of course nice to have in NatTable core, I think it is possible to achieve without modifying NatTable code. So I'm still curious on your contribution, but I will not wait for it to bring out the upcoming bugfix release people are waiting for.
Previous Topic:GlazedListTreeRowModel vs. TreeRowModel
Next Topic:GlazedList.clear() throws java.lang.IndexOutOfBoundsException
Goto Forum:
  


Current Time: Fri Mar 29 07:57:14 GMT 2024

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

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

Back to the top