Search in sources :

Example 1 with RowResizeDragMode

use of org.eclipse.nebula.widgets.nattable.resize.mode.RowResizeDragMode 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 2 with RowResizeDragMode

use of org.eclipse.nebula.widgets.nattable.resize.mode.RowResizeDragMode in project nebula.widgets.nattable by eclipse.

the class DefaultRowResizeBindings method configureUiBindings.

@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
    // Mouse move - Show resize cursor
    uiBindingRegistry.registerFirstMouseMoveBinding(new RowResizeEventMatcher(SWT.NONE, 0), new RowResizeCursorAction());
    uiBindingRegistry.registerMouseMoveBinding(new MouseEventMatcher(), new ClearCursorAction());
    // 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) RowResizeEventMatcher(org.eclipse.nebula.widgets.nattable.resize.event.RowResizeEventMatcher) AutoResizeRowAction(org.eclipse.nebula.widgets.nattable.resize.action.AutoResizeRowAction) ClearCursorAction(org.eclipse.nebula.widgets.nattable.ui.action.ClearCursorAction) RowResizeDragMode(org.eclipse.nebula.widgets.nattable.resize.mode.RowResizeDragMode) NoOpMouseAction(org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction)

Aggregations

AutoResizeRowAction (org.eclipse.nebula.widgets.nattable.resize.action.AutoResizeRowAction)2 RowResizeCursorAction (org.eclipse.nebula.widgets.nattable.resize.action.RowResizeCursorAction)2 RowResizeEventMatcher (org.eclipse.nebula.widgets.nattable.resize.event.RowResizeEventMatcher)2 RowResizeDragMode (org.eclipse.nebula.widgets.nattable.resize.mode.RowResizeDragMode)2 NoOpMouseAction (org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction)2 MouseEventMatcher (org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher)2 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)1 ClearHoverStylingAction (org.eclipse.nebula.widgets.nattable.hover.action.ClearHoverStylingAction)1 HoverStylingAction (org.eclipse.nebula.widgets.nattable.hover.action.HoverStylingAction)1 LabelStack (org.eclipse.nebula.widgets.nattable.layer.LabelStack)1 ClearCursorAction (org.eclipse.nebula.widgets.nattable.ui.action.ClearCursorAction)1 IMouseEventMatcher (org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1