From 6cc99b5932ca837499f0adedf7a5acf75c92dde6 Mon Sep 17 00:00:00 2001 From: Konstantin Krivopustov Date: Tue, 28 Mar 2017 11:28:04 +0400 Subject: [PATCH] PL-8610 Close standard Remove Confirmation dialog if delete has failed because of deletion policy --- .../cuba/gui/components/actions/RemoveAction.java | 12 +++++++++++- .../src/com/haulmont/cuba/web/WebWindowManager.java | 7 +++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/modules/gui/src/com/haulmont/cuba/gui/components/actions/RemoveAction.java b/modules/gui/src/com/haulmont/cuba/gui/components/actions/RemoveAction.java index 08d6327ccf..b6fc78ec37 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/components/actions/RemoveAction.java +++ b/modules/gui/src/com/haulmont/cuba/gui/components/actions/RemoveAction.java @@ -219,7 +219,17 @@ public class RemoveAction extends ItemTrackingAction implements Action.HasBefore new DialogAction(Type.OK, Status.PRIMARY) { @Override public void actionPerform(Component component) { - remove(selected); + try { + remove(selected); + } finally { + target.requestFocus(); + try { + //noinspection unchecked + target.setSelected(selected); + } catch (Exception e) { + // ignore + } + } } }, new DialogAction(Type.CANCEL) { diff --git a/modules/web/src/com/haulmont/cuba/web/WebWindowManager.java b/modules/web/src/com/haulmont/cuba/web/WebWindowManager.java index e95a432fdc..e82e052666 100644 --- a/modules/web/src/com/haulmont/cuba/web/WebWindowManager.java +++ b/modules/web/src/com/haulmont/cuba/web/WebWindowManager.java @@ -1262,8 +1262,11 @@ public class WebWindowManager extends WindowManager { Button button = WebComponentsHelper.createButton(); button.setCaption(action.getCaption()); button.addClickListener(event -> { - action.actionPerform(null); - ui.removeWindow(window); + try { + action.actionPerform(null); + } finally { + ui.removeWindow(window); + } }); if (StringUtils.isNotEmpty(action.getIcon())) {