diff options
author | Matti Tahvonen <matti@vaadin.com> | 2016-05-31 14:00:00 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-08-29 14:13:15 +0000 |
commit | 2d3eff80f7ff7d0ca05a48a1e5709d4d82224538 (patch) | |
tree | ee820d6f52de806d90f7ec53ba6fee380036152d /client | |
parent | ce3575500883820c16bbb53363a3d6dca5c4a6fb (diff) | |
download | vaadin-framework-2d3eff80f7ff7d0ca05a48a1e5709d4d82224538.tar.gz vaadin-framework-2d3eff80f7ff7d0ca05a48a1e5709d4d82224538.zip |
Fire actions before removing menu from the DOM (#20080)
Change-Id: Ic1cd285c697a05d186d81935f632881e4cf561bf
Diffstat (limited to 'client')
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/VMenuBar.java | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VMenuBar.java b/client/src/main/java/com/vaadin/client/ui/VMenuBar.java index 84b56d75b2..f5e83d8550 100644 --- a/client/src/main/java/com/vaadin/client/ui/VMenuBar.java +++ b/client/src/main/java/com/vaadin/client/ui/VMenuBar.java @@ -21,7 +21,6 @@ import java.util.List; import java.util.Queue; import com.google.gwt.core.client.GWT; -import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Style; @@ -438,16 +437,16 @@ public class VMenuBar extends SimpleFocusablePanel */ public void itemClick(CustomMenuItem item) { if (item.getCommand() != null) { - setSelected(null); - - if (visibleChildMenu != null) { - visibleChildMenu.hideChildren(); + try { + item.getCommand().execute(); + } finally { + setSelected(null); + if (visibleChildMenu != null) { + visibleChildMenu.hideChildren(); + } + hideParents(true); + menuVisible = false; } - - hideParents(true); - menuVisible = false; - Scheduler.get().scheduleDeferred(item.getCommand()); - } else { if (item.getSubMenu() != null && item.getSubMenu() != visibleChildMenu) { @@ -1526,23 +1525,19 @@ public class VMenuBar extends SimpleFocusablePanel // selection there openMenuAndFocusFirstIfPossible(getSelected()); } else { - final Command command = getSelected().getCommand(); - - setSelected(null); - hideParents(true); - - // #17076 keyboard selected menuitem without children: do - // not leave menu to visible ("hover open") mode - menuVisible = false; - - Scheduler.get().scheduleDeferred(new ScheduledCommand() { - @Override - public void execute() { - if (command != null) { - command.execute(); - } + try { + final Command command = getSelected().getCommand(); + if (command != null) { + command.execute(); } - }); + } finally { + setSelected(null); + hideParents(true); + + // #17076 keyboard selected menuitem without children: do + // not leave menu to visible ("hover open") mode + menuVisible = false; + } } } |