Class MenuDownloadManager

java.lang.Object
com.vaadin.flow.component.contextmenu.MenuDownloadManager
All Implemented Interfaces:
Serializable

public class MenuDownloadManager extends Object implements Serializable
Manages the download registrations of the items of a menu, including the items of its sub menus. The menu calls update() whenever its items, or the download handler of an item, change, or whenever the component that owns the registrations changes, for example the target of a context menu.

The download registration of an item is kept on a component that stays attached while the item can be clicked: the target for a context menu, and the item itself for a menu bar. Removed items are no longer reachable from the menu, so this remembers the items that have a registration to be able to remove it.

For internal use only. May be renamed or removed in a future release.

See Also:
  • Constructor Details

    • MenuDownloadManager

      public MenuDownloadManager(Component menu, SerializableSupplier<List<MenuItem>> rootItems, SerializableFunction<MenuItem,Component> ownerProvider)
      Creates a manager for the download registrations of a menu.
      Parameters:
      menu - the menu that the items belong to, not null
      rootItems - supplies the root level items of the menu, not null
      ownerProvider - returns the component that owns the download registration of the given item, or null if such a component does not exist yet
  • Method Details

    • update

      public void update()
      Registers the download handlers of the items in the menu on the component that currently owns their registration, and removes the registrations of items that are no longer in the menu or no longer have a download handler.