Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » NatTable a suitable widget for my application?(I'm trying to assess whether I should dive into an implementation based on NatTable)
NatTable a suitable widget for my application? [message #1750883] Sat, 31 December 2016 01:43 Go to next message
Stephan Druskat is currently offline Stephan DruskatFriend
Messages: 104
Registered: October 2011
Location: Berlin, Germany
Senior Member

Hi,

I'm trying to figure out whether I should make use of NatTable as widget for my application.

Basically, I'm looking into implementing a table-based editor of span data. The table's input will usually be a single row with n columns. I need to be able to:

- Add columns dynamically (I know this is possible, seen it at DynamicColumnExample). I also need to be able to add new columns at a certain position (say, before or after a selected column). Is this possible? I'd think so, without having had a deep look at the example's source code...

- Add rows dynamically above, say, the selected row. I also guess that this is possible?

- Define spans over arbitrary n cells dynamically, is this possible? E.g., select a number of adjacent cells in a row, then fire a command (keybinding/button), then the cells get merged. Is there an example for this somewhere?

Finally, I guess that because I'd need to be able to save the changes I make, adding the NatTable widget to a 3.7-based EditorPart is the way to go, yes?

Many thanks for any insights!
Cheers
Stephan

[Updated on: Sat, 31 December 2016 01:44]

Report message to a moderator

Re: NatTable a suitable widget for my application? [message #1750893 is a reply to message #1750883] Sat, 31 December 2016 10:46 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
All features are possible, but there are no default implementations for your use cases.
There is also no example for dynamic spanning, but it is possible.

You need to implement custom IDataProvider and ISpanningDataProvider that reflect your dynamic data model and support inserting columns and rows. And you need custom commands for dynamic spanning that take the current selection to the ISpanningDataProvider which needs to keep the spanning information locally.

I don't understand your last question. NatTable is a SWT widget. Whether you want to include it in an Eclipse application (and the version doesn't count, where I would not rely on any 3.x version anymore) or a plain SWT application depends on your environment. Storing the state of a NatTable instance is something different and works with Java Properties.
Re: NatTable a suitable widget for my application? [message #1750896 is a reply to message #1750893] Sat, 31 December 2016 16:17 Go to previous messageGo to next message
Stephan Druskat is currently offline Stephan DruskatFriend
Messages: 104
Registered: October 2011
Location: Berlin, Germany
Senior Member

Hi Dirk,


Thanks very much for the prompt reply. I'll look into your suggestions.


As for my last question, I guess at its core is the question of (manual) databinding, i.e., I want the table to sync with the state of my data model, so that changes in the table are passed on directly to the data model. Is there an example (possibly within the Examples app (which I cannot access at the moment as I'm away from my desk)) that does just that?


Vice versa (i.e., syncing table with changes in the model) isn't that much of an issue as I don't expect changes to the underlying data model while the table is worked on. Although it'd be interesting to know how this could be made to work as well of course Smile.


Thanks!
Stephan
Re: NatTable a suitable widget for my application? [message #1750897 is a reply to message #1750896] Sat, 31 December 2016 18:34 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
NatTable is a viewer. You can directly show and work on your data model without any binding. If you want to separate the underlying data model from the NatTable data model you need to implement your own sync. The typical use cases I know work directly with the real data model.
Re: NatTable a suitable widget for my application? [message #1751130 is a reply to message #1750897] Wed, 04 January 2017 17:49 Go to previous messageGo to next message
Stephan Druskat is currently offline Stephan DruskatFriend
Messages: 104
Registered: October 2011
Location: Berlin, Germany
Senior Member

Thanks very much, Dirk. This has been a lot of help already.

Quote:
EDIT: I have solved the below issue already by overriding some default classes!


I have another question though: I'm currently going through the Default NatTable example to see what I can re-use. I'm looking at column headers right now.

My problem is, that my data model (at the moment) is a list of Objects which don't have properties as such, and hence I cannot simply map properties to labels as in the example. Instead, the values for the cells are calculated object by object. The objects themselves are a set of specific nodes in a graph, and I'm calculating values, e.g., by looking at outgoing relations and their target nodes.

How would I be able to set the column headers to a specific value that isn't simply "embedded" in the objects themselves?

Thanks!
Stephan

[Updated on: Wed, 04 January 2017 18:24]

Report message to a moderator

Re: NatTable a suitable widget for my application? [message #1751135 is a reply to message #1751130] Wed, 04 January 2017 19:27 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Not sure what you mean with overriding default classes. But the answer to your question is to create a custom IDataProvider. There are also examples for that.
Re: NatTable a suitable widget for my application? [message #1751163 is a reply to message #1751135] Thu, 05 January 2017 08:27 Go to previous message
Stephan Druskat is currently offline Stephan DruskatFriend
Messages: 104
Registered: October 2011
Location: Berlin, Germany
Senior Member

Thanks Dirk! The way and speed you handle user requests such as my own are admirable!
Previous Topic:Flip row and column
Next Topic:Get index of currently selected column from within custom selection binding
Goto Forum:
  


Current Time: Thu Apr 18 23:08:46 GMT 2024

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

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

Back to the top