Class GridContextMenu<T>

    • Constructor Detail

      • GridContextMenu

        public GridContextMenu()
        Creates an empty context menu to be used with a Grid.
      • GridContextMenu

        public GridContextMenu​(Grid<T> target)
        Creates an empty context menu with the given target component.
        Parameters:
        target - the target component for this context menu
        See Also:
        setTarget(Component)
    • Method Detail

      • getDynamicContentHandler

        public SerializablePredicate<T> getDynamicContentHandler()
        Gets the callback function that is executed before the context menu is opened.

        The dynamic context handler allows for customizing the contents of the context menu before it is open.

        Returns:
        the callback function that is executed before opening the context menu, or null if not specified.
      • setDynamicContentHandler

        public void setDynamicContentHandler​(SerializablePredicate<T> dynamicContentHandler)
        Sets a callback that is executed before the context menu is opened.

        This callback receives the clicked item (if any) as an input parameter and further can dynamically modify the contents of the context menu. This is useful in situations where the context menu items cannot be known in advance and depend on the specific context (i.e. clicked row) and thus can be configured dynamically. The boolean return value of this callback specifies if the context menu will be opened.

        Parameters:
        dynamicContentHandler - the callback function that will be executed before opening the context menu.
      • onBeforeOpenMenu

        protected boolean onBeforeOpenMenu​(elemental.json.JsonObject eventDetail)
        Decides whether to open the menu when the ContextMenuBase.beforeOpenHandler(DomEvent) is processed, sub-classes can easily override it and perform additional operations in this phase.

        The event details are completely specified by the target component that is in charge of defining the data it sends to the server. Based on this information, this method enables for dynamically modifying the contents of the context menu. Furthermore, this method's return value specifies if the context menu will be opened.

        Overrides:
        onBeforeOpenMenu in class ContextMenuBase<GridContextMenu<T>,​GridMenuItem<T>,​GridSubMenu<T>>
        Parameters:
        eventDetail - the client side event details provided by the target component.
        Returns:
        true if the context menu should be opened, false otherwise.