Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » UI Bindings in NatTable
UI Bindings in NatTable [message #1385571] Mon, 09 June 2014 15:05 Go to next message
Swapnil Basak is currently offline Swapnil BasakFriend
Messages: 12
Registered: June 2014
Junior Member
Hey,

I just recently started using NatTable and I wanted to know how to set UIbindings.

I want to capture the action "Ctrl+v" and start from the present cell and paste data in order. I understand that NatTable has no stock support for pasting data. Can someone guide me?

Thanks a lot for the help,

Re: UI Bindings in NatTable [message #1385592 is a reply to message #1385571] Mon, 09 June 2014 19:04 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1405
Registered: July 2012
Senior Member
To get an idea on how to setup UI bindings check existing ones. The DefaultSelectionBindings should be a good way to start (because the Ctrl + C) binding. By checking the corresponding copy binding, you should also get an idea on how to implement a paste action by using the SelectionLayer to identify the current cell to paste to.
Re: UI Bindings in NatTable [message #1385637 is a reply to message #1385592] Tue, 10 June 2014 08:14 Go to previous messageGo to next message
Swapnil Basak is currently offline Swapnil BasakFriend
Messages: 12
Registered: June 2014
Junior Member
Ah, this is exactly what I needed. Figured it out. Maybe the http://eclipse.org/nattable/documentation.php?page=binding can be updated to something like this to get developers started off?

Thanks again for the input.

[Updated on: Tue, 10 June 2014 08:14]

Report message to a moderator

Re: UI Bindings in NatTable [message #1385638 is a reply to message #1385637] Tue, 10 June 2014 08:20 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1405
Registered: July 2012
Senior Member
We are aware that there is a lot of documentation missing that we need to write. But thanks for the reminder!

I am planning to write a tutorial series the next months. So stay tuned on this.
Re: UI Bindings in NatTable [message #1385669 is a reply to message #1385638] Tue, 10 June 2014 11:57 Go to previous messageGo to next message
Swapnil Basak is currently offline Swapnil BasakFriend
Messages: 12
Registered: June 2014
Junior Member
Hello again.
So once I capture an IKeyAction (ctrl+v here) with a natTable instance, I am getting the selected cell coordinates by
(DefaultBodyLayerStack)((DefaultGridLayer)natTable.getLayer()).getBodyLayer().getSelectionLayer().getSelectedCellPositions();


However, to set the values in the respective cells, I need to access my own DataProvider's setDataValue method right? How do I do that? Sorry if this is too basic. I can't seem to get it.
Re: UI Bindings in NatTable [message #1385680 is a reply to message #1385669] Tue, 10 June 2014 13:15 Go to previous messageGo to next message
Swapnil Basak is currently offline Swapnil BasakFriend
Messages: 12
Registered: June 2014
Junior Member
Okay nevermind. But only way I could think of was

(DefaultBodyLayerStack)((DefaultGridLayer)natTable.getLayer()).getBodyLayer().getColumnReorderLayer().getUnderlyingLayersByColumnPosition(columnPosition);


to get the dataLayer. Any easier way?
Re: UI Bindings in NatTable [message #1385713 is a reply to message #1385680] Tue, 10 June 2014 16:02 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1405
Registered: July 2012
Senior Member
That depends what you are doing where. Typically in an action you are creating a command that is transported down the layer stack. You also create a corresponding command handler that you register at your data layer. This way you don't need to search for the layer you need to operate on.
Re: UI Bindings in NatTable [message #1403374 is a reply to message #1385713] Wed, 23 July 2014 10:41 Go to previous messageGo to next message
Swapnil Basak is currently offline Swapnil BasakFriend
Messages: 12
Registered: June 2014
Junior Member
Hey,

Sorry to bring this up again. I was working with the TreeViewer that the NatTableExamples demo has for my application. I wanted the dataprovider of the natTable to update some stuff when something happens in the treeviewer.

Long story short, if I have access to the NatTable instance, how do I get to its dataprovider? I want to be able to call the setDataValue method of my custom data provider.

Thanks a lot for the help,
Re: UI Bindings in NatTable [message #1403377 is a reply to message #1403374] Wed, 23 July 2014 11:12 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1405
Registered: July 2012
Senior Member
Only having the NatTable instance it is not possible to access the data provider. You need to know about the underlying structure, therefore you will need to have some reference to it somewhere.
Previous Topic:Sorting Nattable based on column
Next Topic:Dynamically show and hide column
Goto Forum:
  


Current Time: Sat Nov 22 01:57:12 GMT 2014

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

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