Class MouseEventHelper

java.lang.Object
org.eclipse.nebula.widgets.nattable.ui.util.MouseEventHelper

public final class MouseEventHelper extends Object
Helper class that provides methods for checking MouseEvent correlations.
Since:
1.4
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    eventOnSameCell(ILayer layer, org.eclipse.swt.events.MouseEvent downEvent, org.eclipse.swt.events.MouseEvent upEvent)
    Checks if the mouse down event was processed on the same cell as the mouse up event.
    static boolean
    treatAsClick(org.eclipse.swt.events.MouseEvent downEvent, org.eclipse.swt.events.MouseEvent upEvent)
    Checks if the mouse down event and the mouse up event was triggered with an accidental movement which causes a drag behavior.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • treatAsClick

      public static boolean treatAsClick(org.eclipse.swt.events.MouseEvent downEvent, org.eclipse.swt.events.MouseEvent upEvent)
      Checks if the mouse down event and the mouse up event was triggered with an accidental movement which causes a drag behavior. If the up event is in an area of 5 pixels around the down event, we suspect it was a click rather than a drag operation.
      Parameters:
      downEvent - The MouseEvent for mouse down.
      upEvent - The MouseEvent for mouse up.
      Returns:
      true if the mouse down event and the mouse up event are too close to be a drag operation and should therefore be treated as a click, false if the MouseEvent properties are quite different so a user drag operation is assumed.
    • eventOnSameCell

      public static boolean eventOnSameCell(ILayer layer, org.eclipse.swt.events.MouseEvent downEvent, org.eclipse.swt.events.MouseEvent upEvent)
      Checks if the mouse down event was processed on the same cell as the mouse up event. Is used to handle small mouse movements when clicking as a click and not as a drag operation.
      Parameters:
      layer - The layer needed to identify the column and row position according to the MouseEvent coordinates. Typically a NatTable instance.
      downEvent - The MouseEvent for mouse down.
      upEvent - The MouseEvent for mouse up.
      Returns:
      true if the mouse up event was triggered on the same cell as the initial mouse down event.