Class GridContextMenuSupport

  • All Implemented Interfaces:

    
    public final class GridContextMenuSupport
    
                        

    Helpers for driving a GridContextMenu the way the grid's client-side connector does.

    For internal use only.

    Since:

    25.3

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static GridContextMenu<out Object> getContextMenu(Grid<out Object> grid) Gets the context menu added to the given grid.
      static void setTargetItem(Grid<out Object> grid, String itemKey, String columnInternalId) Records the row and column the context menu is about, the way the grid does when the browser reports a context menu gesture.
      static <Y> String getItemKey(Grid<Y> grid, Y item) Gets the key the grid uses for the given item.
      static String getColumnInternalId(Grid<out Object> grid, String columnKey) Gets the internal id the grid uses for the column with the given key.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • getContextMenu

         static GridContextMenu<out Object> getContextMenu(Grid<out Object> grid)

        Gets the context menu added to the given grid.

        A grid keeps no reference to its context menu, and the menu is not part of the component tree until it opens, so the only link from the grid back to the menu is the listener the menu registers on the grid element for {@value #BEFORE_OPEN_EVENT}.

        Parameters:
        grid - the grid whose context menu to get
        Returns:

        the context menu of the grid

      • setTargetItem

         static void setTargetItem(Grid<out Object> grid, String itemKey, String columnInternalId)

        Records the row and column the context menu is about, the way the grid does when the browser reports a context menu gesture.

        Parameters:
        grid - the grid the menu is attached to
        itemKey - key of the row the menu targets, or null for none
        columnInternalId - internal id of the column the menu targets, or null for none
      • getItemKey

         static <Y> String getItemKey(Grid<Y> grid, Y item)

        Gets the key the grid uses for the given item.

        Parameters:
        grid - the grid holding the item
        item - the item to get the key for
        Returns:

        the key of the item

      • getColumnInternalId

         static String getColumnInternalId(Grid<out Object> grid, String columnKey)

        Gets the internal id the grid uses for the column with the given key.

        Parameters:
        grid - the grid holding the column
        columnKey - the key of the column, as set with Grid.Column.setKey(String)
        Returns:

        the internal id of the column