Class SelectionUtils
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.selection.SelectionUtils
-
public final class SelectionUtils extends Object
Helper class to operate with selections.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanbothShiftAndControl(boolean withShiftMask, boolean withControlMask)static ILayerCellgetBottomRightCellInSelection(SelectionLayer selectionLayer)Returns the bottom right cell of a selected region.static <T> List<T>getSelectedRowObjects(SelectionLayer selectionLayer, IRowDataProvider<T> rowDataProvider, boolean fullySelectedRowsOnly)Inspects the current selection on the givenSelectionLayerand returns a list of the corresponding list item objects.static booleanhasConsecutiveSelection(SelectionLayer selectionLayer)Checks whether the selected region tracked by the givenSelectionLayeris consecutive or not.static booleanisConsecutive(int[] pos)Test if the numbers in the given array are consecutive.static booleanisControlOnly(boolean withShiftMask, boolean withControlMask)static booleanisShiftOnly(boolean withShiftMask, boolean withControlMask)static booleannoShiftOrControl(boolean withShiftMask, boolean withControlMask)
-
-
-
Method Detail
-
noShiftOrControl
public static boolean noShiftOrControl(boolean withShiftMask, boolean withControlMask)- Parameters:
withShiftMask- flag to indicate whether the shift masked is activewithControlMask- flag to indicate whether the control masked is active- Returns:
trueif both, shift and control mask, are not active
-
bothShiftAndControl
public static boolean bothShiftAndControl(boolean withShiftMask, boolean withControlMask)- Parameters:
withShiftMask- flag to indicate whether the shift masked is activewithControlMask- flag to indicate whether the control masked is active- Returns:
trueif both, shift and control mask are active
-
isControlOnly
public static boolean isControlOnly(boolean withShiftMask, boolean withControlMask)- Parameters:
withShiftMask- flag to indicate whether the shift masked is activewithControlMask- flag to indicate whether the control masked is active- Returns:
trueif only the control mask is active
-
isShiftOnly
public static boolean isShiftOnly(boolean withShiftMask, boolean withControlMask)- Parameters:
withShiftMask- flag to indicate whether the shift masked is activewithControlMask- flag to indicate whether the control masked is active- Returns:
trueif only the shift mask is active
-
isConsecutive
public static boolean isConsecutive(int[] pos)
Test if the numbers in the given array are consecutive. If there are duplicates or gaps in the array,falsewill be returned.- Parameters:
pos- the array of numbers to check- Returns:
trueif the numbers are consecutive,falseif there are duplicates or gaps.- Since:
- 1.4
-
hasConsecutiveSelection
public static boolean hasConsecutiveSelection(SelectionLayer selectionLayer)
Checks whether the selected region tracked by the givenSelectionLayeris consecutive or not.- Parameters:
selectionLayer- TheSelectionLayerthat tracks the selection.- Returns:
trueif the current selection is consecutive,falseif not.- Since:
- 1.4
-
getBottomRightCellInSelection
public static ILayerCell getBottomRightCellInSelection(SelectionLayer selectionLayer)
Returns the bottom right cell of a selected region. Will only return an ILayerCell if the selected region is consecutive. Otherwisenullwill be returned.- Parameters:
selectionLayer- TheSelectionLayerneeded to determine the selection.- Returns:
- The bottom right cell of a selected region or
nullif the selected region is not consecutive. - Since:
- 1.4
-
getSelectedRowObjects
public static <T> List<T> getSelectedRowObjects(SelectionLayer selectionLayer, IRowDataProvider<T> rowDataProvider, boolean fullySelectedRowsOnly)
Inspects the current selection on the givenSelectionLayerand returns a list of the corresponding list item objects. Uses theIRowDataProviderto be able to determine the row objects per selected row position.- Parameters:
selectionLayer- TheSelectionLayerto retrieve the selected row indexes from.rowDataProvider- TheIRowDataProviderto retrieve the object for the row index.fullySelectedRowsOnly- Flag to determine if only fully selected rows should be taken into account.- Returns:
- The list of all objects that are currently marked as selected.
Never
null. - Since:
- 1.4
-
-