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 09:55 Go to next message
Wojciech Brycki is currently offline Wojciech Brycki
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 11:13 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1066
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 06:11 Go to previous message
Wojciech Brycki is currently offline Wojciech Brycki
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 06:14]

Report message to a moderator

Previous Topic:CellPainter painting outside of NatTable?
Next Topic:8.7 millions LinkedList$Node after 1 night
Goto Forum:
  


Current Time: Fri Apr 18 19:21:44 EDT 2014

Powered by FUDForum. Page generated in 0.01554 seconds