|
|
|
Re: Drag the mouse to select multiple row headers to select multiple rows [message #1834803 is a reply to message #1834800] |
Wed, 18 November 2020 04:26   |
Eclipse User |
|
|
|
Then you need to add a corresponding UI binding for drag operations to the row header. This could look like this:
SelectionLayer selectionLayer = new SelectionLayer(bodyDataLayer, false);
selectionLayer.addConfiguration(new DefaultSelectionLayerConfiguration());
selectionLayer.addConfiguration(new AbstractUiBindingConfiguration() {
@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
IDragMode dragMode = new CellSelectionDragMode() {
@Override
public void fireSelectionCommand(NatTable natTable, int columnPosition, int rowPosition, boolean shiftMask, boolean controlMask) {
int localRowPosition = LayerUtil.convertRowPosition(natTable, rowPosition, selectionLayer);
selectionLayer.selectRow(0, localRowPosition, shiftMask, controlMask);
}
};
uiBindingRegistry.registerFirstMouseDragMode(
MouseEventMatcher.rowHeaderLeftClick(SWT.NONE), dragMode);
uiBindingRegistry.registerFirstMouseDragMode(
MouseEventMatcher.rowHeaderLeftClick(SWT.MOD2), dragMode);
uiBindingRegistry.registerFirstMouseDragMode(
MouseEventMatcher.rowHeaderLeftClick(SWT.MOD1), dragMode);
uiBindingRegistry.registerFirstMouseDragMode(
MouseEventMatcher.rowHeaderLeftClick(SWT.MOD2 | SWT.MOD1), dragMode);
}
});
Although I personally would prefer the creation of corresponding configurations and commandhandlers. But the coding style is up to you and I can't provide a complete clean solution in a forum.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03093 seconds