Search in sources :

Example 1 with IMouseAction

use of net.sourceforge.nattable.ui.action.IMouseAction in project translationstudio8 by heartsome.

the class ButtonCellPainter method run.

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

Example 2 with IMouseAction

use of net.sourceforge.nattable.ui.action.IMouseAction in project translationstudio8 by heartsome.

the class ConfigurableModeEventHandler method mouseDown.

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

Example 3 with IMouseAction

use of net.sourceforge.nattable.ui.action.IMouseAction in project translationstudio8 by heartsome.

the class ConfigurableModeEventHandler method mouseMove.

@Override
public synchronized void mouseMove(MouseEvent event) {
    IMouseAction mouseMoveAction = uiBindingRegistry.getMouseMoveAction(event);
    if (mouseMoveAction != null) {
        event.data = NatEventData.createInstanceFromEvent(event);
        mouseMoveAction.run(natTable, event);
    }
}
Also used : IMouseAction(net.sourceforge.nattable.ui.action.IMouseAction)

Example 4 with IMouseAction

use of net.sourceforge.nattable.ui.action.IMouseAction in project translationstudio8 by heartsome.

the class DefaultSelectionBindings method configureBodyMouseClickBindings.

// *** Mouse bindings ***
protected void configureBodyMouseClickBindings(UiBindingRegistry uiBindingRegistry) {
    IMouseAction action = new SelectCellAction();
    uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.NONE), action);
    uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.SHIFT), action);
    uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.CTRL), action);
    uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.SHIFT | SWT.CONTROL), action);
}
Also used : IMouseAction(net.sourceforge.nattable.ui.action.IMouseAction) SelectCellAction(net.sourceforge.nattable.selection.action.SelectCellAction)

Example 5 with IMouseAction

use of net.sourceforge.nattable.ui.action.IMouseAction in project translationstudio8 by heartsome.

the class RowOnlySelectionBindings method configureBodyMouseClickBindings.

@Override
protected void configureBodyMouseClickBindings(UiBindingRegistry uiBindingRegistry) {
    IMouseAction action = new SelectRowAction();
    uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.NONE), action);
    uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.SHIFT), action);
    uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.CTRL), action);
    uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.SHIFT | SWT.CONTROL), action);
}
Also used : IMouseAction(net.sourceforge.nattable.ui.action.IMouseAction) SelectRowAction(net.sourceforge.nattable.selection.action.SelectRowAction)

Aggregations

IMouseAction (net.sourceforge.nattable.ui.action.IMouseAction)5 Timer (java.util.Timer)1 CellVisualChangeEvent (net.sourceforge.nattable.layer.event.CellVisualChangeEvent)1 SelectCellAction (net.sourceforge.nattable.selection.action.SelectCellAction)1 SelectRowAction (net.sourceforge.nattable.selection.action.SelectRowAction)1 NatEventData (net.sourceforge.nattable.ui.NatEventData)1 IDragMode (net.sourceforge.nattable.ui.action.IDragMode)1