Interface DashboardItemRemoveHandler

All Superinterfaces:
Serializable
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface DashboardItemRemoveHandler extends Serializable
Handler for intercepting item removal from the dashboard.

When a handler is set via Dashboard.setItemRemoveHandler(com.vaadin.flow.component.dashboard.DashboardItemRemoveHandler), automatic removal is disabled. The handler must explicitly call DashboardItemRemoveEvent.removeItem() to proceed with removal.

Example usage with a confirmation dialog:

 dashboard.setItemRemoveHandler(event -> {
     ConfirmDialog dialog = new ConfirmDialog();
     dialog.setText("Remove this widget?");
     dialog.addConfirmListener(e -> event.removeItem());
     dialog.open();
 });
 
Author:
Vaadin Ltd.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called before an item is removed from the dashboard by user interaction.
  • Method Details

    • onItemRemove

      void onItemRemove(DashboardItemRemoveEvent event)
      Called before an item is removed from the dashboard by user interaction.

      When this handler is invoked, the removal has been prevented on the client side. To proceed with the removal, call DashboardItemRemoveEvent.removeItem(). To prevent removal, simply do not call that method.

      Parameters:
      event - the event containing the item to be removed and its context