Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Combo box Editor is not hiding/closing sometimes
Combo box Editor is not hiding/closing sometimes [message #1731688] Mon, 09 May 2016 09:50 Go to next message
Rashmi Tr is currently offline Rashmi TrFriend
Messages: 22
Registered: November 2011
Junior Member
When I open Combo box Editor , and then I click in another field in the table, sometimes the editor is not closing/hiding. When I am scrolling in Nattable then also this editor is visible with drop down control.

I have added this Editor as below:

ComboBoxCellEditor comboBoxCellEditor = new ComboBoxCellEditor(myList, -1);
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, comboBoxCellEditor, DisplayMode.EDIT, myColumnLabel);

What should I do?

Thanks in Advance,
Rashmi
Re: Combo box Editor is not hiding/closing sometimes [message #1731689 is a reply to message #1731688] Mon, 09 May 2016 09:59 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
Which version of NatTable? I can not reproduce this. Are you able to reproduce this with the NatTable examples?
Re: Combo box Editor is not hiding/closing sometimes [message #1731691 is a reply to message #1731689] Mon, 09 May 2016 10:10 Go to previous messageGo to next message
Rashmi Tr is currently offline Rashmi TrFriend
Messages: 22
Registered: November 2011
Junior Member
Hallo Dirk,
I am using NatTable 1.4.0.... I cant reproduce it in NatTable examples. But I have this Problem.
Re: Combo box Editor is not hiding/closing sometimes [message #1731692 is a reply to message #1731691] Mon, 09 May 2016 10:18 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
Then I don't know how to help
Re: Combo box Editor is not hiding/closing sometimes [message #1732940 is a reply to message #1731692] Mon, 23 May 2016 08:51 Go to previous messageGo to next message
Rashmi Tr is currently offline Rashmi TrFriend
Messages: 22
Registered: November 2011
Junior Member
Hallo Dirk,

The Problem for not hiding/closing of ComboBoxCellEditor was in my case org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditBindings.In this Case, Editor opens with mouse click as well as with mouse move on the cell.
In this one Listener for Single click as well as one Listener for Move is registered. With Move both the Listeners are triggered.

uiBindingRegistry.registerSingleClickBinding(
new CellEditorMouseEventMatcher(GridRegion.BODY),
new MouseEditAction());

uiBindingRegistry.registerMouseDragMode(
new CellEditorMouseEventMatcher(GridRegion.BODY),
new CellEditDragMode());

Both call the Method org.eclipse.nebula.widgets.nattable.edit.EditController.editCell(ILayerCell, Composite, Object, IConfigRegistry), which creates in every call a new editorControl from the same cellEditor.
Both throw in the end a CellEditorCreatedEvent ,which is processed only when both calls are done. In the Event reference of the cellEditor is given, which will be same in both case.

layer.fireLayerEvent(new CellEditorCreatedEvent(cellEditor));

After that the Events from org.eclipse.nebula.widgets.nattable.NatTable.handleLayerEvent(ILayerEvent) will be fired.

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

@Override
public void widgetDisposed(DisposeEvent e) {
NatTable.this.activeCellEditor = null;
ActiveCellEditorRegistry.unregisterActiveCellEditor();
}
});
} else {
this.activeCellEditor = null;
ActiveCellEditorRegistry.unregisterActiveCellEditor();
}
ActiveCellEditorRegistry.registerActiveCellEditor(this.activeCellEditor);
}
Since both are working on the same CellEditor, editorEvent.getEditor() in both case returns the same Instance. But getEditorControl() always returns the last created Editor (i.e NatCombo).
With this the Editor which was created at first is not recognized and thats why it will not be closed.

The Reason for this is Nebula Bugfix for Bug 453882 in the Class org.eclipse.nebula.widgets.nattable.ui.action.DragModeEventHandler.

This throws after Focus Lost one MouseUp Event to remove the created Element after focus lost. Since after mouse click one one Cell and moving on the same cell is not really a Drag & Drop, with move on same cell
a new Element should not be created, this Fix is not necessary for CellEditDragMode.

Actually Mouse Up creates the Editor, so the NatTable lost the Focus und this focus lost calls once again Mouse Up, which creates once again an Editor.

In Example, Editor opens only with mouse click not with mouse move on the cell.Thats why i could not reproduce the error there which i was getting.

Regards,
Rashmi
Re: Combo box Editor is not hiding/closing sometimes [message #1738480 is a reply to message #1732940] Wed, 20 July 2016 09:03 Go to previous messageGo to next message
Naveen Sabapathy is currently offline Naveen SabapathyFriend
Messages: 46
Registered: July 2016
Member
I can able to reproduce the issue,

In Nattable 1.4.0, after opening a combo box we need to select a value before leaving the field, else its throwing

Jul 20, 2016 11:00:12 AM org.eclipse.nebula.widgets.nattable.edit.editor.AbstractCellEditor commit
SEVERE: Error on updating cell value: null
java.lang.NullPointerException.


But in Nattable 1.3.0, its working fine.


Re: Combo box Editor is not hiding/closing sometimes [message #1738487 is a reply to message #1738480] Wed, 20 July 2016 10:01 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
https://bugs.eclipse.org/bugs/show_bug.cgi?id=495509
Re: Combo box Editor is not hiding/closing sometimes [message #1763855 is a reply to message #1732940] Mon, 22 May 2017 09:19 Go to previous messageGo to next message
Zachary Labaysse is currently offline Zachary LabaysseFriend
Messages: 5
Registered: March 2015
Junior Member
Hello,

I have several comboboxes in my table. When I click as quickly as I can on those (I don't click at the same combobox, I click randomly), a combobox stay open, I can switch value but the displayed list (under the combobox) can't be closed. I think I'm getting the problem Rashmi told about.

It seems to be well explained but what is the solution ?
I can't figure out how to fix this without reimplementing my own Nattable (wich should a real pain).
Got any help ?

Thanks.
And anyway, great job with the Nattable !

Zachary.
Re: Combo box Editor is not hiding/closing sometimes [message #1763868 is a reply to message #1763855] Mon, 22 May 2017 10:58 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
First:
Which version of NatTable do you use? If you are still using 1.4 then consider updating to 1.5.

Second:
Do you have a custom edit binding configuration? We changed the registering of editors a while back (some years IIRC). If you still have a custom binding configuration based on the old way, try to update that to the new matchers. Have a look at the DefaultEditBindings for this.

I personally think an update to 1.5 should be the solution as I can not reproduce the issue with the current sources.
Re: Combo box Editor is not hiding/closing sometimes [message #1763871 is a reply to message #1763868] Mon, 22 May 2017 11:19 Go to previous messageGo to next message
Zachary Labaysse is currently offline Zachary LabaysseFriend
Messages: 5
Registered: March 2015
Junior Member
Thanks for the quick reply !

First :
I'm using 1.4, I consider upgrading to 1.5 but later, because we're releasing the project to the client next week and I think a such major change should be tested more than one week.

Second :
I have a custom binding configuration, which I think is based on the new way.
I use the DefaultEditBindings.

Third :
I have implemented (10 min ago), I think, a fix for this bug, using what I understood from the Rashmi explanation.
It consists of getting rid of the MouseDragMode in registry. But I cant figure out if it is a wrong way to do it.
I extended the DefaultEditBindings and commented the MouseDragMode lines. is there a better way to do it if it is the good solution ?

public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
	    	// configure the space key to activate a cell editor via keyboard
	        // this is especially useful for changing the value for a checkbox
	        uiBindingRegistry.registerKeyBinding(
	                new KeyEventMatcher(SWT.NONE, 32),
	                new KeyEditAction());
	        uiBindingRegistry.registerKeyBinding(
	                new KeyEventMatcher(SWT.NONE, SWT.F2),
	                new KeyEditAction());
	        uiBindingRegistry.registerKeyBinding(
	                new LetterOrDigitKeyEventMatcher(),
	                new KeyEditAction());
	        uiBindingRegistry.registerKeyBinding(
	                new LetterOrDigitKeyEventMatcher(SWT.MOD2),
	                new KeyEditAction());

	        uiBindingRegistry.registerSingleClickBinding(
	                new CellEditorMouseEventMatcher(GridRegion.BODY),
	                new MouseEditAction());

//		        uiBindingRegistry.registerMouseDragMode(
//		                new CellEditorMouseEventMatcher(GridRegion.BODY),
//		                new CellEditDragMode());

	        uiBindingRegistry.registerFirstSingleClickBinding(
	                new CellPainterMouseEventMatcher(GridRegion.BODY, MouseEventMatcher.LEFT_BUTTON, CheckBoxPainter.class),
	                new MouseEditAction());

	        uiBindingRegistry.registerFirstMouseDragMode(
	                new CellPainterMouseEventMatcher(GridRegion.BODY, MouseEventMatcher.LEFT_BUTTON, CheckBoxPainter.class),
	                new CellEditDragMode());
	    }
Re: Combo box Editor is not hiding/closing sometimes [message #1763878 is a reply to message #1763871] Mon, 22 May 2017 13:27 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
The real solution is to upgrade to 1.5 as we fixed the issue there. If you follow the Bugzilla ticket posted you can see what was changed in order to fix the issue. So you could also locally subclass NatCombo and override the method in charge with a fixed version. That should also fix the issue.

Not registering the CellEditDragMode is also a solution. But that means the mouseDown and mouseUp need to happen on the same pixel. If you move the mouse slightly it becomes a drag and the NatCombo does not open anymore. Which can be also quite annoying.
Re: Combo box Editor is not hiding/closing sometimes [message #1771478 is a reply to message #1731688] Fri, 25 August 2017 12:28 Go to previous messageGo to next message
Christian Renninghoff is currently offline Christian RenninghoffFriend
Messages: 1
Registered: August 2017
Junior Member
I also have this problem with 1.5.

I didn´t get a NPE but the ComboBox is drawn twice if i slightly move my mouse while clicking it. The second box stays forever in its place and cannot be closed. If you move the table to another position you are able to edit again and open another second box and so on.

I tried it with the examples application and it didn´t occured there. The difference between the examples and my application is that the examples always use a selection layer. Slight moves result in a selection of one or multiple cells.

So i tried adding a selection layer to my app and the problem seems to be gone so far. I´m not sure but it seems to me like a bug that is mostly hidden when a selection layer is active. Any chance of getting this worked without a selection layer?

Thanks in advance.
Re: Combo box Editor is not hiding/closing sometimes [message #1771496 is a reply to message #1771478] Fri, 25 August 2017 16:32 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
Editing without selection? You are the first person in 7 years that asks me about that. Not sure if this works as quite some code checks for selection on editing. Would need to check if this is possible.

Sounds like the edit action is called multiple times and the first opened editor is not closed so the references are lost.

Can't tell more until I have time to investigate on this.
Previous Topic:Background color in a cell
Next Topic:Deselecting the cell after selection does not edit the cell
Goto Forum:
  


Current Time: Mon Sep 24 15:34:28 GMT 2018

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

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

Back to the top