Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » How to listen for cell edit?
How to listen for cell edit? [message #1013009] Fri, 22 February 2013 10:50 Go to next message
JSB JSB is currently offline JSB JSB
Messages: 4
Registered: February 2013
Junior Member
What do I need to do to be notified when a cell enters Edit mode?
Re: How to listen for cell edit? [message #1013080 is a reply to message #1013009] Fri, 22 February 2013 13:27 Go to previous messageGo to next message
Dirk Fauth is currently online Dirk Fauth
Messages: 1233
Registered: July 2012
Senior Member
I don't think that we fire any event on activating a cell editor. It will be activated usually on executing MouseEditAction or KeyEditAction, which will trigger the corresponding edit command handlers. But before the activation some checks are performed, so only listening to that commands or actions wouldn't be enough. I would need to do some investigation on this, but currently I guess it is not possible to be notified when a cell enters edit mode.

Why do you need to know when a cell enters edit mode?
Re: How to listen for cell edit? [message #1013086 is a reply to message #1013080] Fri, 22 February 2013 13:42 Go to previous messageGo to next message
JSB JSB is currently offline JSB JSB
Messages: 4
Registered: February 2013
Junior Member
So I figured out a way to do it, basically I create a new AbstractUiBindingConfiguration and pass in an IMouseAction() that does the standard doCommand(), but in addition to this, I fire off my own cellEditListener on the control I have that contains the natTable.

Within my control i just listen to this event and be notifed when the editor shows.

The reason I want this, is so that I can get rid of a label (that I put on it when validation fails (I have a custom AbstractEditErrorHandler which allows me to commit invalid data) so that I can change styling of the cell) when it enters edit mode.
Re: How to listen for cell edit? [message #1013094 is a reply to message #1013086] Fri, 22 February 2013 14:11 Go to previous messageGo to next message
Dirk Fauth is currently online Dirk Fauth
Messages: 1233
Registered: July 2012
Senior Member
Just to be sure, do you use the current master for NatTable 1.0.0 or the 0.9.0 release? Because 1.0.0 will add support for skipping validation which will allow committing invalid data. Not sure of course if this fits your needs in detail.

But why do you change the styling of the cell when it enters edit mode? Shouldn't you change the styling after commit of valid data?
Re: How to listen for cell edit? [message #1013099 is a reply to message #1013094] Fri, 22 February 2013 14:35 Go to previous messageGo to next message
JSB JSB is currently offline JSB JSB
Messages: 4
Registered: February 2013
Junior Member
I'm using 0.9. Where can I get 1.0? How can I listen to the commit, and with 1.0, do I need to do anything special to commit invalid data?

[Updated on: Fri, 22 February 2013 14:38]

Report message to a moderator

Re: How to listen for cell edit? [message #1013110 is a reply to message #1013099] Fri, 22 February 2013 15:01 Go to previous messageGo to next message
Dirk Fauth is currently online Dirk Fauth
Messages: 1233
Registered: July 2012
Senior Member
Well 1.0.0 is in active development so you would need to check out the sources. There will be a major refactoring which is why I'm asking.

Hm, interesting question. What might also fulfill your requirements would be not to use validators but cell label overrider that apply labels for invalid data. Because as you commit the values to the model, they need to be valid but marked as invalid in terms of a warning in rendering only.
Re: How to listen for cell edit? [message #1015727 is a reply to message #1013110] Fri, 01 March 2013 17:46 Go to previous messageGo to next message
Dirk Fauth is currently online Dirk Fauth
Messages: 1233
Registered: July 2012
Senior Member
Hi,

I wrote a Blog post about cross validation in NatTable. Maybe this is helpful to you solving your requirement.

http://www.vogella.com/blog/2013/03/02/crossweak-validation-in-nattable-by-dirk-fauth/

Greez,
Dirk
Re: How to listen for cell edit? [message #1015997 is a reply to message #1015727] Mon, 04 March 2013 09:39 Go to previous messageGo to next message
JSB JSB is currently offline JSB JSB
Messages: 4
Registered: February 2013
Junior Member
This was helpful. Thanks, another question I've been wondering is if it's possible to change the SELECTION_ANCHOR_STYLE if the data has another config label associated with it.

So basically if a cell has a bgcolor of red when not selected, could we make that cell a dark red when it is selected?
Re: How to listen for cell edit? [message #1015999 is a reply to message #1015997] Mon, 04 March 2013 09:55 Go to previous message
Dirk Fauth is currently online Dirk Fauth
Messages: 1233
Registered: July 2012
Senior Member
This sounds like you want to achieve a concatenation of style labels. Like "if label A and label B are applied use style C".

This is currently not supported. Usually the styles stack up which means that you don't need to specify the whole style attribute set, but only the styles you want to override. Unfortunately the selection anchor style is already set by label, and therefore the stacking shouldn't work.
Previous Topic:Who is responsible for handling MouseWheel scroll?
Next Topic:want two TreeCheckBoxPainters in a single cell
Goto Forum:
  


Current Time: Fri Aug 01 01:57:32 EDT 2014

Powered by FUDForum. Page generated in 0.02811 seconds