Search in sources :

Example 6 with MouseEventMatcher

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

the class MouseEventMatcherTest method testDefaultEquals.

@Test
public void testDefaultEquals() {
    IMouseEventMatcher matcher1 = new MouseEventMatcher();
    IMouseEventMatcher matcher2 = new MouseEventMatcher();
    Assert.assertEquals(matcher1, matcher2);
}
Also used : IMouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher) MouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher) IMouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher) Test(org.junit.Test)

Example 7 with MouseEventMatcher

use of org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher 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 8 with MouseEventMatcher

use of org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher 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)

Example 9 with MouseEventMatcher

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

the class RowHeaderResizeHoverBindings method configureUiBindings.

@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
    // Mouse move - Show resize cursor
    uiBindingRegistry.registerFirstMouseMoveBinding(new RowResizeEventMatcher(SWT.NONE, 0), new RowResizeCursorAction());
    // apply a hover styling on moving the mouse over a NatTable and clear
    // the cursor
    uiBindingRegistry.registerMouseMoveBinding(new MouseEventMatcher(GridRegion.ROW_HEADER), new HoverStylingAction(this.layer));
    // clear any hover styling if the mouse is moved out of the region area
    // uiBindingRegistry.registerMouseMoveBinding(
    // new IMouseEventMatcher() {
    // @Override
    // public boolean matches(NatTable natTable, MouseEvent event,
    // LabelStack regionLabels) {
    // return (regionLabels != null &&
    // !regionLabels.hasLabel(GridRegion.ROW_HEADER));
    // }
    // 
    // }, new ClearHoverStylingAction(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);
        }
    }, 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());
    // Row resize
    uiBindingRegistry.registerFirstMouseDragMode(new RowResizeEventMatcher(SWT.NONE, 1), new RowResizeDragMode());
    uiBindingRegistry.registerDoubleClickBinding(new RowResizeEventMatcher(SWT.NONE, 1), new AutoResizeRowAction());
    uiBindingRegistry.registerSingleClickBinding(new RowResizeEventMatcher(SWT.NONE, 1), new NoOpMouseAction());
}
Also used : RowResizeCursorAction(org.eclipse.nebula.widgets.nattable.resize.action.RowResizeCursorAction) 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) AutoResizeRowAction(org.eclipse.nebula.widgets.nattable.resize.action.AutoResizeRowAction) RowResizeDragMode(org.eclipse.nebula.widgets.nattable.resize.mode.RowResizeDragMode) ClearHoverStylingAction(org.eclipse.nebula.widgets.nattable.hover.action.ClearHoverStylingAction) RowResizeEventMatcher(org.eclipse.nebula.widgets.nattable.resize.event.RowResizeEventMatcher) 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)

Example 10 with MouseEventMatcher

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

the class DefaultColumnResizeBindings 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());
    uiBindingRegistry.registerMouseMoveBinding(new MouseEventMatcher(), new ClearCursorAction());
    // 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) AutoResizeColumnAction(org.eclipse.nebula.widgets.nattable.resize.action.AutoResizeColumnAction) ClearCursorAction(org.eclipse.nebula.widgets.nattable.ui.action.ClearCursorAction) NoOpMouseAction(org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction) ColumnResizeEventMatcher(org.eclipse.nebula.widgets.nattable.resize.event.ColumnResizeEventMatcher) ColumnResizeDragMode(org.eclipse.nebula.widgets.nattable.resize.mode.ColumnResizeDragMode)

Aggregations

MouseEventMatcher (org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher)16 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)8 HashMap (java.util.HashMap)6 AbstractUiBindingConfiguration (org.eclipse.nebula.widgets.nattable.config.AbstractUiBindingConfiguration)6 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)6 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)6 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)6 UiBindingRegistry (org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry)6 IMouseEventMatcher (org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher)6 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)5 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)5 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)5 DefaultRowHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider)5 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)5 CornerLayer (org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer)5 GridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer)5 RowHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer)5 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)5 NoOpMouseAction (org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction)5 PopupMenuAction (org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuAction)5