Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Row headers column vertical resize possibility(nattable configuration)
Row headers column vertical resize possibility [message #1114981] Mon, 23 September 2013 13:55 Go to next message
Wojciech Brycki is currently offline Wojciech BryckiFriend
Messages: 2
Registered: September 2013
Junior Member
How can I make the row headers column - in my case it's the RowHeaderLayer - to be able to be resized vertically by user (not autoresized)?

The was no such example in the nattable examples, in all examples the row header column resize possibility was blocked.

I tried to set:
dataLayer.setColumnPositionResizable(0, true);
but it didn't work.

Best regards
Wojtek
Re: Row headers column vertical resize possibility [message #1115042 is a reply to message #1114981] Mon, 23 September 2013 15:13 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Never tried it before, but I guess you need to register the corresponding bindings to the row header similar to the DefaultColumnResizeBindings. Might look like this:

public class MyRowHeaderResizeBindings extends AbstractUiBindingConfiguration {

	public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
		// Mouse move - Show resize cursor
		uiBindingRegistry.registerFirstMouseMoveBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 0), new ColumnResizeCursorAction());
		uiBindingRegistry.registerMouseMoveBinding(new MouseEventMatcher(), new ClearCursorAction());
		
		// Column resize
		uiBindingRegistry.registerFirstMouseDragMode(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 1), new ColumnResizeDragMode());
		
		uiBindingRegistry.registerDoubleClickBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 1), new AutoResizeColumnAction());
		uiBindingRegistry.registerSingleClickBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 1), new NoOpMouseAction());
	}
	
}


That configuration then needs to be added to the NatTable before calling configure().
Re: Row headers column vertical resize possibility [message #1128083 is a reply to message #1115042] Mon, 07 October 2013 10:11 Go to previous message
Wojciech Brycki is currently offline Wojciech BryckiFriend
Messages: 2
Registered: September 2013
Junior Member
This is exactly, what I wanted. Thank you Dirk.

Actually, I've added those bindings as a configuration to the corner layer, to make the resize possible also for the corner cell, not only for the row headers.

I've also registred the corner regions like this:
	public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
		// Mouse move - Show resize cursor
		uiBindingRegistry.registerFirstMouseMoveBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 0), new ColumnResizeCursorAction());
		uiBindingRegistry.registerFirstMouseMoveBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.CORNER, 0), new ColumnResizeCursorAction());
		uiBindingRegistry.registerMouseMoveBinding(new MouseEventMatcher(), new ClearCursorAction());
		
		// Column resize
		uiBindingRegistry.registerFirstMouseDragMode(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 1), new ColumnResizeDragMode());
		uiBindingRegistry.registerFirstMouseDragMode(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.CORNER, 1), new ColumnResizeDragMode());
		
		uiBindingRegistry.registerDoubleClickBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 1), new AutoResizeColumnAction());
		uiBindingRegistry.registerSingleClickBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 1), new NoOpMouseAction());
	}


Regards,
Wojtek

[Updated on: Mon, 07 October 2013 10:14]

Report message to a moderator

Previous Topic:Using Eclipse Spell Checker in Nattable
Next Topic:bookmark
Goto Forum:
  


Current Time: Thu Apr 25 11:36:09 GMT 2024

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

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

Back to the top