Class MouseEventHelper
java.lang.Object
org.eclipse.nebula.widgets.nattable.ui.util.MouseEventHelper
Helper class that provides methods for checking
MouseEvent
correlations.- Since:
- 1.4
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleaneventOnSameCell(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 booleantreatAsClick(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.
-
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- TheMouseEventfor mouse down.upEvent- TheMouseEventfor mouse up.- Returns:
trueif 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,falseif theMouseEventproperties 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 theMouseEventcoordinates. Typically a NatTable instance.downEvent- TheMouseEventfor mouse down.upEvent- TheMouseEventfor mouse up.- Returns:
trueif the mouse up event was triggered on the same cell as the initial mouse down event.
-