Search in sources :

Example 16 with KeyEventMatcher

use of org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher in project nebula.widgets.nattable by eclipse.

the class RowSelectionUIBindings method configureMoveUpBindings.

@Override
protected void configureMoveUpBindings(UiBindingRegistry uiBindingRegistry, IKeyAction action) {
    uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.ARROW_UP), action);
    uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT, SWT.ARROW_UP), action);
    uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.MOD1, SWT.ARROW_UP), new MoveToFirstRowAction());
    uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT | SWT.MOD1, SWT.ARROW_UP), new MoveToFirstRowAction());
}
Also used : KeyEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher) MoveToFirstRowAction(org.eclipse.nebula.widgets.nattable.selection.action.MoveToFirstRowAction)

Example 17 with KeyEventMatcher

use of org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher in project nebula.widgets.nattable by eclipse.

the class KeyEventMatcherTest method testEquals.

@Test
public void testEquals() {
    IKeyEventMatcher matcher1 = new KeyEventMatcher(12, 101);
    IKeyEventMatcher matcher2 = new KeyEventMatcher(12, 101);
    Assert.assertEquals(matcher1, matcher2);
}
Also used : KeyEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher) IKeyEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.IKeyEventMatcher) IKeyEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.IKeyEventMatcher) Test(org.junit.Test)

Example 18 with KeyEventMatcher

use of org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher in project nebula.widgets.nattable by eclipse.

the class DefaultEditBindings method configureUiBindings.

@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
    // configure the space key to activate a cell editor via keyboard
    // this is especially useful for changing the value for a checkbox
    uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, 32), new KeyEditAction());
    uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.F2), new KeyEditAction());
    uiBindingRegistry.registerKeyBinding(new LetterOrDigitKeyEventMatcher(), new KeyEditAction());
    uiBindingRegistry.registerKeyBinding(new LetterOrDigitKeyEventMatcher(SWT.MOD2), new KeyEditAction());
    uiBindingRegistry.registerSingleClickBinding(new CellEditorMouseEventMatcher(GridRegion.BODY), new MouseEditAction());
    uiBindingRegistry.registerFirstSingleClickBinding(new CellPainterMouseEventMatcher(GridRegion.BODY, MouseEventMatcher.LEFT_BUTTON, CheckBoxPainter.class), new MouseEditAction());
}
Also used : KeyEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher) LetterOrDigitKeyEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.LetterOrDigitKeyEventMatcher) KeyEditAction(org.eclipse.nebula.widgets.nattable.edit.action.KeyEditAction) CheckBoxPainter(org.eclipse.nebula.widgets.nattable.painter.cell.CheckBoxPainter) LetterOrDigitKeyEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.LetterOrDigitKeyEventMatcher) MouseEditAction(org.eclipse.nebula.widgets.nattable.edit.action.MouseEditAction) CellPainterMouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.CellPainterMouseEventMatcher) CellEditorMouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.CellEditorMouseEventMatcher)

Example 19 with KeyEventMatcher

use of org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher in project nebula.widgets.nattable by eclipse.

the class DefaultDataChangeConfiguration method configureUiBindings.

@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
    uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.MOD1, 's'), new IKeyAction() {

        @Override
        public void run(NatTable natTable, KeyEvent event) {
            natTable.doCommand(new SaveDataChangesCommand());
        }
    });
    uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.MOD1, 'd'), new IKeyAction() {

        @Override
        public void run(NatTable natTable, KeyEvent event) {
            natTable.doCommand(new DiscardDataChangesCommand());
        }
    });
}
Also used : KeyEvent(org.eclipse.swt.events.KeyEvent) DiscardDataChangesCommand(org.eclipse.nebula.widgets.nattable.datachange.command.DiscardDataChangesCommand) KeyEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher) IKeyAction(org.eclipse.nebula.widgets.nattable.ui.action.IKeyAction) SaveDataChangesCommand(org.eclipse.nebula.widgets.nattable.datachange.command.SaveDataChangesCommand) NatTable(org.eclipse.nebula.widgets.nattable.NatTable)

Example 20 with KeyEventMatcher

use of org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher in project nebula.widgets.nattable by eclipse.

the class DefaultFormulaConfiguration method configureUiBindings.

@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
    // ui binding for deleting a cell value on pressing DEL
    uiBindingRegistry.registerFirstKeyBinding(new KeyEventMatcher(SWT.DEL), new DeleteSelectionAction());
    // ui binding to perform a paste action on pressing CTRL+V
    uiBindingRegistry.registerFirstKeyBinding(new KeyEventMatcher(SWT.MOD1, 'v'), new PasteDataAction());
    // ui binding to perform paste or selection movement on ENTER
    uiBindingRegistry.registerFirstKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.CR), new PasteOrMoveSelectionAction(this.clipboard));
    // ui binding to clear the InternalCellClipboard
    uiBindingRegistry.registerFirstKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.ESC), new ClearClipboardAction(this.clipboard));
    // Mouse drag
    // trigger the handle drag operations
    // Note: we ensure a FillHandleLayerPainter is set in configureLayer
    uiBindingRegistry.registerFirstMouseDragMode(new FillHandleEventMatcher((FillHandleLayerPainter) this.selectionLayer.getLayerPainter()), new FormulaFillHandleDragMode(this.selectionLayer, this.clipboard, this.dataProvider));
}
Also used : FillHandleLayerPainter(org.eclipse.nebula.widgets.nattable.fillhandle.FillHandleLayerPainter) FormulaFillHandleDragMode(org.eclipse.nebula.widgets.nattable.formula.action.FormulaFillHandleDragMode) ClearClipboardAction(org.eclipse.nebula.widgets.nattable.copy.action.ClearClipboardAction) KeyEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher) DeleteSelectionAction(org.eclipse.nebula.widgets.nattable.edit.action.DeleteSelectionAction) PasteDataAction(org.eclipse.nebula.widgets.nattable.copy.action.PasteDataAction) PasteOrMoveSelectionAction(org.eclipse.nebula.widgets.nattable.copy.action.PasteOrMoveSelectionAction) FillHandleEventMatcher(org.eclipse.nebula.widgets.nattable.fillhandle.event.FillHandleEventMatcher)

Aggregations

KeyEventMatcher (org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher)24 MoveSelectionAction (org.eclipse.nebula.widgets.nattable.selection.action.MoveSelectionAction)3 IKeyEventMatcher (org.eclipse.nebula.widgets.nattable.ui.matcher.IKeyEventMatcher)3 Test (org.junit.Test)3 HashMap (java.util.HashMap)2 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)2 MouseEditAction (org.eclipse.nebula.widgets.nattable.edit.action.MouseEditAction)2 ColumnGroupExpandCollapseAction (org.eclipse.nebula.widgets.nattable.group.action.ColumnGroupExpandCollapseAction)2 ColumnGroupHeaderReorderDragMode (org.eclipse.nebula.widgets.nattable.group.action.ColumnGroupHeaderReorderDragMode)2 ColumnHeaderReorderDragMode (org.eclipse.nebula.widgets.nattable.group.action.ColumnHeaderReorderDragMode)2 CreateColumnGroupAction (org.eclipse.nebula.widgets.nattable.group.action.CreateColumnGroupAction)2 UngroupColumnsAction (org.eclipse.nebula.widgets.nattable.group.action.UngroupColumnsAction)2 MoveToFirstRowAction (org.eclipse.nebula.widgets.nattable.selection.action.MoveToFirstRowAction)2 AggregateDragMode (org.eclipse.nebula.widgets.nattable.ui.action.AggregateDragMode)2 CellDragMode (org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode)2 VisualRefreshCommand (org.eclipse.nebula.widgets.nattable.command.VisualRefreshCommand)1 AbstractRegistryConfiguration (org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration)1 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)1 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)1 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)1