Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Unwanted behaviour: SelectionChanged on Mouseover(Nattable seems to select Rows on Mouseover)
Unwanted behaviour: SelectionChanged on Mouseover [message #1669020] Thu, 12 March 2015 18:47 Go to next message
Thomas Kernstock is currently offline Thomas KernstockFriend
Messages: 29
Registered: July 2009
Location: Vienna
Junior Member
Hi,

I'm using nattable 1.2.0.201501272102 in eclipse for my application. I defined a RowselectionProvider with mutliple selection. When a user selects more than one row I check if all rows have the same features. Otherwise I show an errordialog.

Now when I press OK in that dialog an move the mouse cursor over the rows, they automatically get selected!!
Is this a bug or do I have to confige something in a nattable configuration to change that behaviour?

You can easely see what I mean by changing the _5054_SelectionProviderExample beginning at line 243 => inserting a dialog:
        selectionProvider
                .addSelectionChangedListener(new ISelectionChangedListener() {

                    @Override
                    public void selectionChanged(SelectionChangedEvent event) {
                        log("Selection changed:");

                        IStructuredSelection selection = (IStructuredSelection) event
                                .getSelection();
                        @SuppressWarnings("rawtypes")
                        Iterator it = selection.iterator();
                        while (it.hasNext()) {
                            Person selected = (Person) it.next();
                            log("  " + selected.getFirstName() + " "
                                    + selected.getLastName());
                        }
                        MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Interrupt", "Interrupt selection");
                    }

                });


Help would be really appreciated, since this behavour is not very usefull for a good UX.
Thank you in advance

Thomas

[Updated on: Thu, 12 March 2015 19:03]

Report message to a moderator

Re: Unwanted behaviour: SelectionChanged on Mouseover [message #1669097 is a reply to message #1669020] Thu, 12 March 2015 19:28 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2903
Registered: July 2012
Senior Member
Quote:
When a user selects more than one row I check if all rows have the same features. Otherwise I show an errordialog.

Quote:
this behavour is not very usefull for a good UX


Opening an error dialog on selection is good UX? Another good example for different opinions on good UX. But that's a different discussion.

You need to tell me how you perform the multi selection. Drag selection? Ctrl + left click? Key movement?
I assume you perform multi selection via drag operation, since it sounds like you are fooling the drag mode handler in NatTable. It is not stopped, which happens when the drag operation is disturbed. I thought we fixed that with 1.2.0 since we stop the drag mode if the focus is lost. Maybe you found another interaction that doesn't trigger a focus lost, although IMHO opening a dialog should trigger a focus lost event on NatTable.

Need to check that, but if the above is true, it sounds like a bug.
Re: Unwanted behaviour: SelectionChanged on Mouseover [message #1669438 is a reply to message #1669097] Thu, 12 March 2015 22:27 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2903
Registered: July 2012
Senior Member
Just tested and it seems that this is not a trivial issue. The selection change is triggered on mouseDown. Since you are opening a dialog, NatTable looses focus, but no focusLost event is triggered. But the dialog has focus, so the mouseUp event is fired to the NatTable. Therefore NatTable never receives a mouseUp and thinks it is in drag mode as the mouse was moved in between.

Please open a ticket, I will see what is possible.
Re: Unwanted behaviour: SelectionChanged on Mouseover [message #1669539 is a reply to message #1669438] Thu, 12 March 2015 23:21 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2903
Registered: July 2012
Senior Member
After some further investigation, the issue is that opening the message dialog prevents the NatTable internal event handling from processing. So the drag mode is activated after the dialog is closed, although it shouldn't have. But the mouseUp event was not able to get handled correctly, since the processing was stopped and the mouse event handling is activated afterwards.

I have no idea how to fix this internally, but you are able to deal with it if you open the dialog asynchronously. This way you don't stop the internal NatTable handling and everything works as intended.

Display.getDefault().asyncExec(new Runnable() {

                            @Override
                            public void run() {
                                MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Interrupt", "Interrupt selection");
                            }
                        });
Re: Unwanted behaviour: SelectionChanged on Mouseover [message #1670769 is a reply to message #1669097] Fri, 13 March 2015 10:27 Go to previous messageGo to next message
Thomas Kernstock is currently offline Thomas KernstockFriend
Messages: 29
Registered: July 2009
Location: Vienna
Junior Member
Hi Dirk,

Quote:
Opening an error dialog on selection is good UX? Another good example for different opinions on good UX. But that's a different discussion.


maybe I shoud have said "Infomation Dialog". I inform the User that the selection he made is not valid and unselect the items that wont fit, so he doesn't have to find out which are wrong.

Quote:
You need to tell me how you perform the multi selection. Drag selection? Ctrl + left click? Key movement?

I just klick the first Line and then <Shift> click the last line I wish to select. I didn't try/test to <Ctrl> click right now Smile

[Updated on: Fri, 13 March 2015 10:30]

Report message to a moderator

icon10.gif  Re: Unwanted behaviour: SelectionChanged on Mouseover [message #1670790 is a reply to message #1669539] Fri, 13 March 2015 10:40 Go to previous message
Thomas Kernstock is currently offline Thomas KernstockFriend
Messages: 29
Registered: July 2009
Location: Vienna
Junior Member
Dirk Fauth wrote on Thu, 12 March 2015 23:21
After some further investigation, the issue is that opening the message dialog prevents the NatTable internal event handling from processing. So the drag mode is activated after the dialog is closed, although it shouldn't have. But the mouseUp event was not able to get handled correctly, since the processing was stopped and the mouse event handling is activated afterwards.

I have no idea how to fix this internally, but you are able to deal with it if you open the dialog asynchronously. This way you don't stop the internal NatTable handling and everything works as intended.

Display.getDefault().asyncExec(new Runnable() {

                            @Override
                            public void run() {
                                MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Interrupt", "Interrupt selection");
                            }
                        });


Thank you for that solution. This works perfectly !
kr
Thomas

Previous Topic:Upgrade to 1.2.0 from 1.0.1 - Odd behavior
Next Topic:How to paint multiple images in a cell.
Goto Forum:
  


Current Time: Wed Sep 25 14:23:39 GMT 2024

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

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

Back to the top