Search in sources :

Example 6 with IMouseAction

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

the class ButtonCellPainter method run.

/**
 * Respond to mouse click. Simulate button press.
 */
@Override
public void run(final NatTable natTable, MouseEvent event) {
    NatEventData eventData = (NatEventData) event.data;
    this.columnPosClicked = eventData.getColumnPosition();
    this.rowPosClicked = eventData.getRowPosition();
    this.recentlyClicked = true;
    new Timer().schedule(getButtonFlashTimerTask(natTable), this.buttonFlashTime);
    natTable.fireLayerEvent(new CellVisualChangeEvent(natTable, this.columnPosClicked, this.rowPosClicked));
    for (IMouseAction listener : this.clickLiseners) {
        listener.run(natTable, event);
    }
}
Also used : IMouseAction(org.eclipse.nebula.widgets.nattable.ui.action.IMouseAction) Timer(java.util.Timer) NatEventData(org.eclipse.nebula.widgets.nattable.ui.NatEventData) CellVisualChangeEvent(org.eclipse.nebula.widgets.nattable.layer.event.CellVisualChangeEvent)

Example 7 with IMouseAction

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

the class DefaultSelectionBindings method configureBodyMouseClickBindings.

// *** Mouse bindings ***
protected void configureBodyMouseClickBindings(UiBindingRegistry uiBindingRegistry) {
    IMouseAction action = new SelectCellAction();
    uiBindingRegistry.registerMouseDownBinding(MouseEventMatcher.bodyLeftClick(SWT.NONE), action);
    uiBindingRegistry.registerMouseDownBinding(MouseEventMatcher.bodyLeftClick(SWT.MOD2), action);
    uiBindingRegistry.registerMouseDownBinding(MouseEventMatcher.bodyLeftClick(SWT.MOD1), action);
    uiBindingRegistry.registerMouseDownBinding(MouseEventMatcher.bodyLeftClick(SWT.MOD2 | SWT.MOD1), action);
}
Also used : IMouseAction(org.eclipse.nebula.widgets.nattable.ui.action.IMouseAction) SelectCellAction(org.eclipse.nebula.widgets.nattable.selection.action.SelectCellAction)

Example 8 with IMouseAction

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

the class ConfigurableModeEventHandler method mouseMove.

@Override
public synchronized void mouseMove(MouseEvent event) {
    if (event.x >= 0 && event.y >= 0) {
        IMouseAction mouseMoveAction = getUiBindingRegistry().getMouseMoveAction(event);
        if (mouseMoveAction != null) {
            event.data = NatEventData.createInstanceFromEvent(event);
            mouseMoveAction.run(this.natTable, event);
        } else {
            this.natTable.setCursor(null);
        }
    }
}
Also used : IMouseAction(org.eclipse.nebula.widgets.nattable.ui.action.IMouseAction)

Example 9 with IMouseAction

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

the class ConfigurableModeEventHandler method mouseDown.

@Override
public void mouseDown(MouseEvent event) {
    if (this.natTable.commitAndCloseActiveCellEditor()) {
        IMouseAction mouseDownAction = getUiBindingRegistry().getMouseDownAction(event);
        if (mouseDownAction != null) {
            event.data = NatEventData.createInstanceFromEvent(event);
            mouseDownAction.run(this.natTable, event);
        }
        IMouseAction singleClickAction = getUiBindingRegistry().getSingleClickAction(event);
        IMouseAction doubleClickAction = getUiBindingRegistry().getDoubleClickAction(event);
        IDragMode dragMode = getUiBindingRegistry().getDragMode(event);
        if (singleClickAction != null || doubleClickAction != null || dragMode != null) {
            switchMode(new MouseModeEventHandler(getModeSupport(), this.natTable, event, singleClickAction, doubleClickAction, dragMode));
        }
    }
}
Also used : IDragMode(org.eclipse.nebula.widgets.nattable.ui.action.IDragMode) IMouseAction(org.eclipse.nebula.widgets.nattable.ui.action.IMouseAction)

Aggregations

IMouseAction (org.eclipse.nebula.widgets.nattable.ui.action.IMouseAction)9 Timer (java.util.Timer)1 RowGroupExpandCollapseAction (org.eclipse.nebula.widgets.nattable.group.action.RowGroupExpandCollapseAction)1 CellVisualChangeEvent (org.eclipse.nebula.widgets.nattable.layer.event.CellVisualChangeEvent)1 SelectCellAction (org.eclipse.nebula.widgets.nattable.selection.action.SelectCellAction)1 SelectRowAction (org.eclipse.nebula.widgets.nattable.selection.action.SelectRowAction)1 SelectRowGroupsAction (org.eclipse.nebula.widgets.nattable.selection.action.SelectRowGroupsAction)1 NatEventData (org.eclipse.nebula.widgets.nattable.ui.NatEventData)1 IDragMode (org.eclipse.nebula.widgets.nattable.ui.action.IDragMode)1