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.
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 TypeMethodDescriptionvoidCalled before an item is removed from the dashboard by user interaction.
-
Method Details
-
onItemRemove
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
-