Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » How to detect double click on row header and do something?
How to detect double click on row header and do something? [message #1787104] Fri, 18 May 2018 18:54 Go to next message
John Galt is currently offline John GaltFriend
Messages: 44
Registered: July 2009
Member
Hello,
I want to detect a doubleclick on my row headers, and execute my own code. What is the best way to do this? I have browsed code for hours. I see UIBindings, and layer event handlers. I could not figure out a way to do this. Can someone please help.

Thanks
Re: How to detect double click on row header and do something? [message #1787110 is a reply to message #1787104] Fri, 18 May 2018 22:09 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2624
Registered: July 2012
Senior Member
        rowHeaderLayer.addConfiguration(new AbstractUiBindingConfiguration() {

            @Override
            public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
                uiBindingRegistry.registerDoubleClickBinding(MouseEventMatcher.rowHeaderLeftClick(0), new IMouseAction() {

                    @Override
                    public void run(NatTable natTable, MouseEvent event) {
                        System.out.println("Double Click Detected");
                    }
                });
            }
        });
Re: How to detect double click on row header and do something? [message #1787127 is a reply to message #1787110] Sat, 19 May 2018 11:54 Go to previous messageGo to next message
John Galt is currently offline John GaltFriend
Messages: 44
Registered: July 2009
Member
Dirk,
Thanks for the reply.

In the method itself, I need to get a hold of the rowData. I have tried various paths, but can't seem to figure out a way to get at the row data.

The code below gets me the data, but I had to use a hardcoded column location. This won't account for the case where the column has been moved.
int rowPosition = natTable.getRowPositionByY(event.y);
int rowIndex = natTable.getRowIndexByPosition(rowPosition);
natTable.getDataValueByPosition(2, rowPosition);


Using the code below, I can get at the nattable. How can I efficiently access the rowData from the natTable?
natTable.getLayer();


Thanks.
Re: How to detect double click on row header and do something? [message #1787143 is a reply to message #1787127] Sat, 19 May 2018 16:50 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2624
Registered: July 2012
Senior Member
NatTable has no direct api to retrieve a row object. You need to reference the ListDataProvider and from there get the row object.
Previous Topic:BUG: Excel like filter with same filter value
Next Topic:Editable GroupBy Bug, reproduced in the Examples Application
Goto Forum:
  


Current Time: Wed Nov 14 19:34:30 GMT 2018

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

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

Back to the top