Search in sources :

Example 1 with NoOpMouseAction

use of org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction in project nebula.widgets.nattable by eclipse.

the class DefaultColumnGroupHeaderLayerConfiguration method configureUiBindings.

@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
    // Column Group Header is a part of the Group Header.
    // Register the 'column group header matcher' first so that it gets
    // picked up before the more general 'column header matcher'.
    uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.NONE), new AggregateDragMode(new CellDragMode(), new ColumnGroupHeaderReorderDragMode(this.columnGroupModel)));
    uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.columnHeaderLeftClick(SWT.NONE), new AggregateDragMode(new CellDragMode(), new ColumnHeaderReorderDragMode(this.columnGroupModel)));
    // added NoOpMouseAction on single click because of Bug 428901
    if (!this.enableColumnGroupSelectionHandling) {
        uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.NONE), new NoOpMouseAction());
        uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.MOD1), new NoOpMouseAction());
        uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.MOD2), new NoOpMouseAction());
        uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.MOD1 | SWT.MOD2), new NoOpMouseAction());
    } else {
        uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.NONE), new ViewportSelectColumnGroupAction(false, false));
        uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.MOD1), new ViewportSelectColumnGroupAction(false, true));
        uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.MOD2), new ViewportSelectColumnGroupAction(true, false));
        uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.MOD1 | SWT.MOD2), new ViewportSelectColumnGroupAction(true, true));
    }
    uiBindingRegistry.registerDoubleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.NONE), new ColumnGroupExpandCollapseAction());
    uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.MOD1, 'g'), new CreateColumnGroupAction());
    uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.MOD1, 'u'), new UngroupColumnsAction());
}
Also used : ViewportSelectColumnGroupAction(org.eclipse.nebula.widgets.nattable.group.action.ViewportSelectColumnGroupAction) ColumnGroupHeaderReorderDragMode(org.eclipse.nebula.widgets.nattable.group.action.ColumnGroupHeaderReorderDragMode) KeyEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher) AggregateDragMode(org.eclipse.nebula.widgets.nattable.ui.action.AggregateDragMode) ColumnHeaderReorderDragMode(org.eclipse.nebula.widgets.nattable.group.action.ColumnHeaderReorderDragMode) CellDragMode(org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode) UngroupColumnsAction(org.eclipse.nebula.widgets.nattable.group.action.UngroupColumnsAction) ColumnGroupExpandCollapseAction(org.eclipse.nebula.widgets.nattable.group.action.ColumnGroupExpandCollapseAction) NoOpMouseAction(org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction) CreateColumnGroupAction(org.eclipse.nebula.widgets.nattable.group.action.CreateColumnGroupAction)

Example 2 with NoOpMouseAction

use of org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction in project nebula.widgets.nattable by eclipse.

the class DefaultHierarchicalTreeLayerConfiguration method configureUiBindings.

@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
    TreeExpandCollapseAction treeExpandCollapseAction = new TreeExpandCollapseAction();
    CellPainterMouseEventMatcher treeImagePainterMouseEventMatcher = new CellPainterMouseEventMatcher(GridRegion.BODY, MouseEventMatcher.LEFT_BUTTON, TreeImagePainter.class);
    uiBindingRegistry.registerFirstSingleClickBinding(treeImagePainterMouseEventMatcher, treeExpandCollapseAction);
    // Obscure any mouse down bindings for this image painter
    uiBindingRegistry.registerFirstMouseDownBinding(treeImagePainterMouseEventMatcher, new NoOpMouseAction());
    // configure a specialized ColumnReorderDragMode
    uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.columnHeaderLeftClick(SWT.NONE), new AggregateDragMode(new CellDragMode(), new HierarchicalTreeColumnReorderDragMode(this.treeLayer)));
}
Also used : AggregateDragMode(org.eclipse.nebula.widgets.nattable.ui.action.AggregateDragMode) CellDragMode(org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode) TreeExpandCollapseAction(org.eclipse.nebula.widgets.nattable.tree.action.TreeExpandCollapseAction) CellPainterMouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.CellPainterMouseEventMatcher) HierarchicalTreeColumnReorderDragMode(org.eclipse.nebula.widgets.nattable.hierarchical.action.HierarchicalTreeColumnReorderDragMode) NoOpMouseAction(org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction)

Example 3 with NoOpMouseAction

use of org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction in project nebula.widgets.nattable by eclipse.

the class DefaultTreeLayerConfiguration method configureUiBindings.

@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
    TreeExpandCollapseAction treeExpandCollapseAction = new TreeExpandCollapseAction();
    CellPainterMouseEventMatcher treeImagePainterMouseEventMatcher = new CellPainterMouseEventMatcher(GridRegion.BODY, MouseEventMatcher.LEFT_BUTTON, TreeImagePainter.class);
    uiBindingRegistry.registerFirstSingleClickBinding(treeImagePainterMouseEventMatcher, treeExpandCollapseAction);
    // Obscure any mouse down bindings for this image painter
    uiBindingRegistry.registerFirstMouseDownBinding(treeImagePainterMouseEventMatcher, new NoOpMouseAction());
}
Also used : TreeExpandCollapseAction(org.eclipse.nebula.widgets.nattable.tree.action.TreeExpandCollapseAction) CellPainterMouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.CellPainterMouseEventMatcher) NoOpMouseAction(org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction)

Example 4 with NoOpMouseAction

use of org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction in project nebula.widgets.nattable by eclipse.

the class FillHandleConfiguration method configureUiBindings.

@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
    FillHandleEventMatcher matcher = new FillHandleEventMatcher(this.painter);
    // Mouse move
    // Show fill handle cursor
    uiBindingRegistry.registerFirstMouseMoveBinding(matcher, new FillHandleCursorAction());
    uiBindingRegistry.registerMouseMoveBinding(new MouseEventMatcher(), new ClearCursorAction());
    // Mouse drag
    // trigger the handle drag operations
    uiBindingRegistry.registerFirstMouseDragMode(matcher, new FillHandleDragMode(this.selectionLayer, this.clipboard));
    // Mouse click
    // ensure no selection is triggered on mouse down on the handle
    uiBindingRegistry.registerFirstMouseDownBinding(matcher, new NoOpMouseAction());
}
Also used : FillHandleDragMode(org.eclipse.nebula.widgets.nattable.fillhandle.action.FillHandleDragMode) MouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher) FillHandleCursorAction(org.eclipse.nebula.widgets.nattable.fillhandle.action.FillHandleCursorAction) ClearCursorAction(org.eclipse.nebula.widgets.nattable.ui.action.ClearCursorAction) NoOpMouseAction(org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction) FillHandleEventMatcher(org.eclipse.nebula.widgets.nattable.fillhandle.event.FillHandleEventMatcher)

Example 5 with NoOpMouseAction

use of org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction in project nebula.widgets.nattable by eclipse.

the class ColumnHeaderResizeHoverBindings method configureUiBindings.

@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
    // Mouse move - Show resize cursor
    uiBindingRegistry.registerFirstMouseMoveBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 0), new ColumnResizeCursorAction());
    // apply a hover styling on moving the mouse over a NatTable and clear
    // the cursor
    uiBindingRegistry.registerMouseMoveBinding(new MouseEventMatcher(GridRegion.COLUMN_HEADER), new HoverStylingAction(this.layer));
    // clear any hover styling if the mouse is moved out of a NatTable
    // region
    uiBindingRegistry.registerMouseMoveBinding(new IMouseEventMatcher() {

        @Override
        public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) {
            return ((natTable != null && regionLabels == null) || regionLabels != null && regionLabels.hasLabel(GridRegion.CORNER));
        }
    }, new ClearHoverStylingAction());
    // clear any hover styling if the mouse is moved out of the NatTable
    // area
    uiBindingRegistry.registerMouseExitBinding(new IMouseEventMatcher() {

        @Override
        public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) {
            // not necessary
            return true;
        }
    }, new ClearHoverStylingAction());
    // Column resize
    uiBindingRegistry.registerFirstMouseDragMode(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 1), new ColumnResizeDragMode());
    uiBindingRegistry.registerDoubleClickBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 1), new AutoResizeColumnAction());
    uiBindingRegistry.registerSingleClickBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 1), new NoOpMouseAction());
}
Also used : ColumnResizeCursorAction(org.eclipse.nebula.widgets.nattable.resize.action.ColumnResizeCursorAction) MouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher) IMouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher) IMouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher) MouseEvent(org.eclipse.swt.events.MouseEvent) LabelStack(org.eclipse.nebula.widgets.nattable.layer.LabelStack) AutoResizeColumnAction(org.eclipse.nebula.widgets.nattable.resize.action.AutoResizeColumnAction) ColumnResizeEventMatcher(org.eclipse.nebula.widgets.nattable.resize.event.ColumnResizeEventMatcher) ColumnResizeDragMode(org.eclipse.nebula.widgets.nattable.resize.mode.ColumnResizeDragMode) ClearHoverStylingAction(org.eclipse.nebula.widgets.nattable.hover.action.ClearHoverStylingAction) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) NoOpMouseAction(org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction) ClearHoverStylingAction(org.eclipse.nebula.widgets.nattable.hover.action.ClearHoverStylingAction) HoverStylingAction(org.eclipse.nebula.widgets.nattable.hover.action.HoverStylingAction)

Aggregations

NoOpMouseAction (org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction)8 MouseEventMatcher (org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher)5 ClearCursorAction (org.eclipse.nebula.widgets.nattable.ui.action.ClearCursorAction)3 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)2 ClearHoverStylingAction (org.eclipse.nebula.widgets.nattable.hover.action.ClearHoverStylingAction)2 HoverStylingAction (org.eclipse.nebula.widgets.nattable.hover.action.HoverStylingAction)2 LabelStack (org.eclipse.nebula.widgets.nattable.layer.LabelStack)2 AutoResizeColumnAction (org.eclipse.nebula.widgets.nattable.resize.action.AutoResizeColumnAction)2 AutoResizeRowAction (org.eclipse.nebula.widgets.nattable.resize.action.AutoResizeRowAction)2 ColumnResizeCursorAction (org.eclipse.nebula.widgets.nattable.resize.action.ColumnResizeCursorAction)2 RowResizeCursorAction (org.eclipse.nebula.widgets.nattable.resize.action.RowResizeCursorAction)2 ColumnResizeEventMatcher (org.eclipse.nebula.widgets.nattable.resize.event.ColumnResizeEventMatcher)2 RowResizeEventMatcher (org.eclipse.nebula.widgets.nattable.resize.event.RowResizeEventMatcher)2 ColumnResizeDragMode (org.eclipse.nebula.widgets.nattable.resize.mode.ColumnResizeDragMode)2 RowResizeDragMode (org.eclipse.nebula.widgets.nattable.resize.mode.RowResizeDragMode)2 TreeExpandCollapseAction (org.eclipse.nebula.widgets.nattable.tree.action.TreeExpandCollapseAction)2 AggregateDragMode (org.eclipse.nebula.widgets.nattable.ui.action.AggregateDragMode)2 CellDragMode (org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode)2 CellPainterMouseEventMatcher (org.eclipse.nebula.widgets.nattable.ui.matcher.CellPainterMouseEventMatcher)2 IMouseEventMatcher (org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher)2