Skip to main content



      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 06:44 Go to next message
Eclipse UserFriend
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 07:00 Go to previous messageGo to next message
Eclipse UserFriend
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 07:01 Go to previous messageGo to next message
Eclipse UserFriend
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 06:53 Go to previous messageGo to next message
Eclipse UserFriend
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 14:27 Go to previous message
Eclipse UserFriend
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:Mouse events are not properly handled
Next Topic:How to validate data by the use of commands through code directly.
Goto Forum:
  


Current Time: Fri Jul 04 07:29:44 EDT 2025

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

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

Back to the top