Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Cell DisplayMode Changed Event
Cell DisplayMode Changed Event [message #1761919] Thu, 11 May 2017 21:03 Go to next message
cenk Mising name is currently offline cenk Mising nameFriend
Messages: 157
Registered: July 2009
Senior Member
Hi,
How can I handle DisplayMode of cell changed event. Is there any event class for changing DisplayMode.
Re: Cell DisplayMode Changed Event [message #1761920 is a reply to message #1761919] Thu, 11 May 2017 21:12 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2623
Registered: July 2012
Senior Member
No there is no event fired if the DisplayMode of a cell changes. Actually that is nothing active. For example, the selection of a cell is the active part, the representation with DisplayMode.SELECT is a result of that.

Not sure what you are trying to achieve, but you probably need to check for what is causing the change.
Re: Cell DisplayMode Changed Event [message #1762967 is a reply to message #1761920] Fri, 12 May 2017 06:43 Go to previous messageGo to next message
cenk Mising name is currently offline cenk Mising nameFriend
Messages: 157
Registered: July 2009
Senior Member
I want to disable the ok/save button if cell is in edit mode. How can I do it
Re: Cell DisplayMode Changed Event [message #1763055 is a reply to message #1762967] Fri, 12 May 2017 07:31 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2623
Registered: July 2012
Senior Member
DisplayMode#EDIT is technically never applied to a cell. It is only used to retrieve configurations in an editor. And an editor is activated actively.

You can listen for the CellEditorCreatedEvent to get notified when an editor is created. And on handling the event you can register a DisposeListener to get notified once the editor is closed again.
ILayerListener listener = new ILayerListener() {

    @Override
    public void handleLayerEvent(ILayerEvent event) {
        if (event instanceof CellEditorCreatedEvent) {
            // deactivate the button when editing is enabled
            updateButton.setEnabled(false);

            CellEditorCreatedEvent editorEvent = (CellEditorCreatedEvent) event;
            ICellEditor activeCellEditor = editorEvent.getEditor();
            Control editorControl = activeCellEditor.getEditorControl();
            if (editorControl != null && !editorControl.isDisposed()) {
                editorControl.addDisposeListener(new DisposeListener() {

                    @Override
                    public void widgetDisposed(DisposeEvent e) {
                        // enable button again when editor is disposed
                        updateButton.setEnabled(true);
                    }
                });
            } else {
                // secure fallback if editor is closed immediately
                // before event handling was able to run
                updateButton.setEnabled(true);
            }
        }
    }
};
natTable.addLayerListener(listener);


As the event is only fired on the NatTable you need to use the ILayerListener and can not use an ILayerEventHandler.
Re: Cell DisplayMode Changed Event [message #1763291 is a reply to message #1762967] Fri, 12 May 2017 11:42 Go to previous messageGo to next message
cenk Mising name is currently offline cenk Mising nameFriend
Messages: 157
Registered: July 2009
Senior Member
Thankyou for your response. But I have got small problem. How can I realise column and row index of edited cell
Re: Cell DisplayMode Changed Event [message #1763295 is a reply to message #1763291] Fri, 12 May 2017 12:17 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2623
Registered: July 2012
Senior Member
Not sure what you mean. You get the reference to the ICellEditor that is activated. So you can get the column and row index information and more from that. Or what are you searching for?
Previous Topic:Loading Nattable state takes a lot of time.
Next Topic:Multiple Selection in NatTable
Goto Forum:
  


Current Time: Wed Nov 14 00:59:18 GMT 2018

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

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

Back to the top