Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » setDataValue of ColumnPropertyAccessor not called when using TableCellEditor(setDataValue of ColumnPropertyAccessor not called when using TableCellEditor)
setDataValue of ColumnPropertyAccessor not called when using TableCellEditor [message #1764644] Thu, 01 June 2017 07:02 Go to next message
Mathias Jankow is currently offline Mathias JankowFriend
Messages: 3
Registered: May 2017
Junior Member
Hi,

I am building a table which among other things contains a "Beitrag"-column (in Euros/year for example) and 3 tax-columns (Steuer).

see attachment:
index.php/fa/29517/0/

As you may have noticed already the Steuer-Betrag-Fields are calculated with the Beitrag-fields and the Steuer-Satz-fields. Now that's how i want it at least :D

Using only one Steuer per Beitrag worked out just fine.. in my ColumnPropertyAccessor i just updated the Steuer-Betrag-Field when either the Beitrag or Steuer-Satz-Field gets updated.

Unfortunately that doensn't work when i am working with TableCellEditor's (which you can see in the image). I use theese because one Beitrag can have several different Steuern (taxes) attached to it. If i change the Beitrag-Field.. it's still all good.. since my ColumnPropertyAccessor is still accessed. But when i change the Steuer-Satz-Field my ColumnPropertyAccessor does not get accessed. That is because in the UpdateDataCommandHandler.doCommand(UpdateDataCommand)-Method the currentValue already equals the newValue.. and therefore the ColumnPropertyAccessor.setData-Method does not get called anymore.

Not sure why the value is already updated at this point.. i'm sure there is a good reason for it.

My question: What would be the best way/place to trigger some kind of update on my Data-List when i change the values of Steuer-Satz (TableCellEditor) ?

If more info is needed.. plz ask away.
big thanks in advance.
  • Attachment: example.png
    (Size: 2.65KB, Downloaded 186 times)
Re: setDataValue of ColumnPropertyAccessor not called when using TableCellEditor [message #1764743 is a reply to message #1764644] Fri, 02 June 2017 05:12 Go to previous messageGo to next message
Dirk Fauth is currently online Dirk FauthFriend
Messages: 2624
Registered: July 2012
Senior Member
IIRC the TableCellEditor is using a JFace TableViewer underneath as editor control. And it is operating on the collection that is provided as field from the backing bean. But I would need to dig deeper again into the implementation to remember how it is working in detail.

IMHO you are trying to use a feature that is intended to be a rare case as the base implementation, and you expect it to behave the same way. To elaborate that, the TableCellEditor and TableCellPainter are used to support tables inside a cell. And nested tables do not really work the same way as the default table.

I personally think that your data model is not very stable and does not really match to a table framework. You seem to have multiple lists that you keep in sync via list index. IMHO that is not a very good OO design. If ever ony list changes by accident your model is broken. I would create an object for the taxes and keep them in one list instead of keeping multiple lists in sync.

And for the NatTable I would implement a wrapper model with one element per tax and use spanning on the first column to get the same representation as in your attachment. Nested tables are not a good way to design that kind of table.
Re: setDataValue of ColumnPropertyAccessor not called when using TableCellEditor [message #1764789 is a reply to message #1764743] Fri, 02 June 2017 09:34 Go to previous messageGo to next message
Mathias Jankow is currently offline Mathias JankowFriend
Messages: 3
Registered: May 2017
Junior Member
Thanks for the reply.

Dirk Fauth wrote on Fri, 02 June 2017 05:12

I personally think that your data model is not very stable and does not really match to a table framework. You seem to have multiple lists that you keep in sync via list index. IMHO that is not a very good OO design. If ever ony list changes by accident your model is broken. I would create an object for the taxes and keep them in one list instead of keeping multiple lists in sync.


I agree.. had this in mind aswell. Didn't bother about it yet since i'm still playing around abit.. to see what can and what can't be done. I was also thinking about using a seperate table for the taxes.. it's just much nicer to have it all in one :D


Dirk Fauth wrote on Fri, 02 June 2017 05:12

And for the NatTable I would implement a wrapper model with one element per tax and use spanning on the first column to get the same representation as in your attachment. Nested tables are not a good way to design that kind of table.


The wrapper already exists actually.. didn't try to work it into the table yet.
I will look into spanning now. As far as i can see it in the examples i won't be able to seperately edit the 3 tax fields.. meaning i only have one spanned-cell i'll do the editing in (for all 3 tax fields). Is that correct ? Because that probably wouldn't work out for me.


Again thanks for the quick answer and sorry for the 2nd Topic (equal to this one) i created.
Re: setDataValue of ColumnPropertyAccessor not called when using TableCellEditor [message #1764812 is a reply to message #1764789] Fri, 02 June 2017 11:30 Go to previous messageGo to next message
Dirk Fauth is currently online Dirk FauthFriend
Messages: 2624
Registered: July 2012
Senior Member
I don't get your point. From looking at your picture there is only row spanning in the Beitrag column. The tax columns are not spanned. Actually you don't want it to be spanned.

When you design it think about how you would do this in Excel for example. Maybe this gives you some hints on how to achieve what you want.
Re: setDataValue of ColumnPropertyAccessor not called when using TableCellEditor [message #1764821 is a reply to message #1764812] Fri, 02 June 2017 12:38 Go to previous message
Mathias Jankow is currently offline Mathias JankowFriend
Messages: 3
Registered: May 2017
Junior Member
Dirk Fauth wrote on Fri, 02 June 2017 11:30
I don't get your point. From looking at your picture there is only row spanning in the Beitrag column. The tax columns are not spanned. Actually you don't want it to be spanned.

When you design it think about how you would do this in Excel for example. Maybe this gives you some hints on how to achieve what you want.


Sorry. I just understood what you meant with your previous comment. Makes a bit more sense to me now. Forget the previous question :D

I'll try spanning all the other columns (there are much more than the Beitrag-column).

big thanks again.

[Updated on: Fri, 02 June 2017 12:39]

Report message to a moderator

Previous Topic:Unavailable dependencies in the Getting Started Tutorial
Next Topic:Text Filter column doesn't work
Goto Forum:
  


Current Time: Sun Nov 18 07:46:14 GMT 2018

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

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

Back to the top