Skip to main content



      Home
Home » Eclipse Projects » NatTable » How to capture Ctrl + A command in NatTable(I want to select all rows by using Ctrl + A, and it works, but how can I get this command.)
How to capture Ctrl + A command in NatTable [message #1726749] Wed, 16 March 2016 03:40 Go to next message
Eclipse UserFriend
First, Ctrl + A as select all rows is work in NatTable, my issue is how can I get the command when you press Ctrl + A.
Re: How to capture Ctrl + A command in NatTable [message #1726803 is a reply to message #1726749] Wed, 16 March 2016 11:16 Go to previous messageGo to next message
Eclipse UserFriend
I don't understand the question? What are you trying to do?
Re: How to capture Ctrl + A command in NatTable [message #1726850 is a reply to message #1726803] Wed, 16 March 2016 21:43 Go to previous messageGo to next message
Eclipse UserFriend
I'm sorry, I didn't make it clear. Ok, in GlazedListsFilterExample, by following steps
1. Select a row(click row number), the row was selected.
2. Press Ctrl + A, all rows were selected.

If I want to get all selected rows, I may add a button and register a SelectionListener, like this,
button.addSelectionListener(new SelectionListener() {
            
            @Override
            public void widgetSelected(SelectionEvent e) {
                natTable.getSelectionLayer().selectAll();
                ...
                [b]// then get selected list according to natTable.getSelectionLayer().getSelectedRowPositions().[/b]
            }
            
            @Override
            public void widgetDefaultSelected(SelectionEvent e) {
                // TODO Auto-generated method stub
                
            }
        });


While, now I don't want to add a button like that. Is there a listener or event to capture the "Ctrl + A" and then I put my code in it ? I don't know where to put the get selected list logic code.

Another question, when I select all rows, then resize one column width, all column width resized, is it the right behavior? Or, is there any solution to help me only resize one column with when selected all rows? Please see Setp_3.png

Thanks,
Luke
  • Attachment: Step_1.PNG
    (Size: 73.59KB, Downloaded 129 times)
  • Attachment: Step_2.PNG
    (Size: 84.50KB, Downloaded 138 times)
  • Attachment: Step_3.png
    (Size: 131.26KB, Downloaded 149 times)

[Updated on: Thu, 17 March 2016 01:59] by Moderator

Re: How to capture Ctrl + A command in NatTable [message #1726867 is a reply to message #1726850] Thu, 17 March 2016 03:43 Go to previous messageGo to next message
Eclipse UserFriend
Still don't get your requirement regarding select all.

If you want to react on something in NatTable, learn about the command-event-mechanism: http://www.vogella.com/tutorials/NatTable/article.html#architecture_commandsevents

If you want to react on selection, register a listener. There are examples in our examples app that should show this already.

There is no special event for selectAll

Alternatively create and register a command handler for the select all event.
Re: How to capture Ctrl + A command in NatTable [message #1726891 is a reply to message #1726867] Thu, 17 March 2016 06:12 Go to previous messageGo to next message
Eclipse UserFriend
Ok, When I press Ctrl + A like step2, this action will go to which layer listener in nattable? Thanks
Re: How to capture Ctrl + A command in NatTable [message #1726894 is a reply to message #1726891] Thu, 17 March 2016 06:21 Go to previous message
Eclipse UserFriend
It triggers selection, so the command handler is in the SelectionLayer. And if you want to react via listener, you need to register it in any layer above. See the examples
Previous Topic:[Resolved] How to apply background to specific column headers
Next Topic:Nattable elements are sorted after applying the filter
Goto Forum:
  


Current Time: Sun Jun 22 17:56:09 EDT 2025

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

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

Back to the top