Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Abrupt behavior when using "EditCellCommand" through code directly
Abrupt behavior when using "EditCellCommand" through code directly [message #1220374] Wed, 11 December 2013 11:44 Go to next message
SD Khan is currently offline SD KhanFriend
Messages: 63
Registered: May 2013
Member
Hi Dirk !

I am trying to use "EditCellCommand" through code, and want's the cell to be activate in edit mode as it normally does when it has been clicked.

But when i call it like this

nattable.doCommand(new EditCellCommand(parent,getConfigRegistry(), cell));


but instead of edit mode in the same cell, another cell has been created on it's top,

Is i am missing something or it is a bug ?

Regards,
SD Khan
Re: Abrupt behavior when using "EditCellCommand" through code directly [message #1220380 is a reply to message #1220374] Wed, 11 December 2013 12:00 Go to previous messageGo to next message
SD Khan is currently offline SD KhanFriend
Messages: 63
Registered: May 2013
Member
Hi, found the issue on mine side, actually i was getting the cell from different layer, that's why it creates a new object, now getting it from
the nattable directly, and it works fine.

Thanks,
SD Khan
Re: Abrupt behavior when using "EditCellCommand" through code directly [message #1220381 is a reply to message #1220374] Wed, 11 December 2013 12:01 Go to previous messageGo to next message
Dirk Fauth is currently online Dirk FauthFriend
Messages: 1407
Registered: July 2012
Senior Member
I'm not sure what you mean? It works fine for me. The question is, are your parameters correct? What is parent? Usually this should be the NatTable instance. And where did you get the cell from.

I tried this by attaching a menu to the corner that activates editing in the first cell in the body. For a grid composition the position is col 1 / row 1. And this works as intended.

natTable.addConfiguration(new AbstractHeaderMenuConfiguration(natTable) {
	@Override
	protected PopupMenuBuilder createCornerMenu(NatTable natTable) {
		return super.createCornerMenu(natTable).withMenuItemProvider(new IMenuItemProvider() {
					
			@Override
			public void addMenuItem(final NatTable natTable, Menu popupMenu) {
				MenuItem menuItem = new MenuItem(popupMenu, SWT.PUSH);
				menuItem.setText("Edit Col1/Row1");
				menuItem.setEnabled(true);

				menuItem.addSelectionListener(new SelectionAdapter() {
					@Override
					public void widgetSelected(SelectionEvent event) {
						natTable.doCommand(new EditCellCommand(natTable,
							natTable.getConfigRegistry(),
							natTable.getCellByPosition(1, 1)));
					}
				});
			}
		});
	}
});
Re: Abrupt behavior when using "EditCellCommand" through code directly [message #1220533 is a reply to message #1220381] Thu, 12 December 2013 11:53 Go to previous messageGo to next message
SD Khan is currently offline SD KhanFriend
Messages: 63
Registered: May 2013
Member
Right, In the above code, cell does go in the edit mode but if i re-size the column then the edit mode does not gets re-size with the cell, so a sort of two cells created, one that is in the edit mode while the other is the original cell that is re-sized., How i can resolve that?
Re: Abrupt behavior when using "EditCellCommand" through code directly [message #1220640 is a reply to message #1220533] Thu, 12 December 2013 19:27 Go to previous message
Dirk Fauth is currently online Dirk FauthFriend
Messages: 1407
Registered: July 2012
Senior Member
The editor does not get noticed about resizing. If done via mouse interaction the editor should close prior performing the resize action.

If you want to support resizing an open editor you need to resize the editor control manually somehow. This is not supported right now.
Previous Topic:How to validate data by the use of commands through code directly.
Next Topic:Mouse events are not properly handled
Goto Forum:
  


Current Time: Wed Nov 26 09:15:47 GMT 2014

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

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