Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » activateCell() method doesn't get called(The activateCell() method is supposed to be called by itself when a cell is selected, but it doesn't get called.)
activateCell() method doesn't get called [message #1084930] Mon, 12 August 2013 08:22 Go to next message
Ali Malik is currently offline Ali MalikFriend
Messages: 27
Registered: August 2013
Junior Member
Hi,

I am using a custom editor for the NatTable.

I need to show a combo box editor in selective cells of a column, not all of them.

For this, I decided to use a custom editor, which implements the ICellEditor Interface.

I overrode the public Control activateCell(Composite , Object , Character EditModeEnum , ICellEditHandler , ILayerCell ,IConfigRegistry )

Though, I haven't yet implemented the functionality, but the method should be called when i select the cell.

I call it like this:
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR, new CustomEditor(),
DisplayMode.NORMAL, QueryTreeTable.COLUMN_TWO_LABEL);


Any suggestions on what am I doing wrong?
Re: activateCell() method doesn't get called [message #1085114 is a reply to message #1084930] Mon, 12 August 2013 13:22 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Quote:
I need to show a combo box editor in selective cells of a column, not all of them


What do you mean by that?

I think you need to register against DisplayMode.EDIT
Re: activateCell() method doesn't get called [message #1085659 is a reply to message #1085114] Tue, 13 August 2013 07:28 Go to previous messageGo to next message
Ali Malik is currently offline Ali MalikFriend
Messages: 27
Registered: August 2013
Junior Member
I meant some cells should show TextPainter, and some should show ComboBoxPainter.
That EDIT or NORMAL weren't a problem.

I got it solved by reading another thread.
The problem was i had to bind the Custom Editor with the UiBindingRegistry. I did it and it is working fine, now, with the following code.

            CustomEditor editor = new CustomEditor( bodyDataProvider, configRegistry );
            
            UiBindingRegistry uiBindingRegistry = natTable.getUiBindingRegistry();
            
            uiBindingRegistry.registerFirstSingleClickBinding(
            	    new BodyCellEditorMouseEventMatcher(editor.getClass()), 
            	    new MouseEditAction());
            

            configRegistry.registerConfigAttribute(
                    EditConfigAttributes.CELL_EDITOR, editor,
                    DisplayMode.NORMAL, QueryTreeTable.COLUMN_TWO_LABEL);


Thank you for your help, Dirk. Do you know any reason why do we have to bind it like this? I mean why doens't it bind it through some internal mechanism?

Regards,
Ali Ahmad Malik
Re: activateCell() method doesn't get called [message #1085692 is a reply to message #1085659] Tue, 13 August 2013 08:31 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Which version are you using? Using NatTable 1.0 should bind the editor automatically. There the BodyCellEditorMouseEventMatcher is deprecated.
Previous Topic:ColumnGroupHeaderLayer expand/collapse and Selection, ColumnResize, etc.
Next Topic:Multiple Selection is not enforced after setting flag in the selection model.
Goto Forum:
  


Current Time: Fri Apr 19 20:16:41 GMT 2024

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

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

Back to the top