diff options
author | John Alhroos <john.ahlroos@itmill.com> | 2012-09-18 10:11:02 +0000 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-09-28 21:34:00 +0300 |
commit | a003c8724c1f719e3a9f3ab876396a180b19cae1 (patch) | |
tree | 909d4aac5839b421602282a2de15ff76fb295e37 /server/src/com/vaadin/event/ActionManager.java | |
parent | ca59c93fb4dbc112e5deb5f5a4b10c0c730a4be4 (diff) | |
download | vaadin-framework-a003c8724c1f719e3a9f3ab876396a180b19cae1.tar.gz vaadin-framework-a003c8724c1f719e3a9f3ab876396a180b19cae1.zip |
Merged shortcut action fix from 6.8 (#8484)
Change-Id: I1bc200afa9f4a4f3c5e469eb0b2f93278cca97a7
Diffstat (limited to 'server/src/com/vaadin/event/ActionManager.java')
-rw-r--r-- | server/src/com/vaadin/event/ActionManager.java | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/server/src/com/vaadin/event/ActionManager.java b/server/src/com/vaadin/event/ActionManager.java index 85a1bf0f12..ad643863a7 100644 --- a/server/src/com/vaadin/event/ActionManager.java +++ b/server/src/com/vaadin/event/ActionManager.java @@ -18,6 +18,7 @@ package com.vaadin.event; import java.util.HashSet; import java.util.Map; +import com.vaadin.client.ui.ShortcutActionHandler; import com.vaadin.event.Action.Container; import com.vaadin.event.Action.Handler; import com.vaadin.server.KeyMapper; @@ -187,14 +188,29 @@ public class ActionManager implements Action.Container, Action.Handler, } if (a instanceof ShortcutAction) { final ShortcutAction sa = (ShortcutAction) a; - paintTarget.addAttribute("kc", sa.getKeyCode()); + paintTarget + .addAttribute( + ShortcutActionHandler.ACTION_SHORTCUT_KEY_ATTRIBUTE, + sa.getKeyCode()); final int[] modifiers = sa.getModifiers(); if (modifiers != null) { final String[] smodifiers = new String[modifiers.length]; for (int i = 0; i < modifiers.length; i++) { smodifiers[i] = String.valueOf(modifiers[i]); } - paintTarget.addAttribute("mk", smodifiers); + paintTarget + .addAttribute( + ShortcutActionHandler.ACTION_MODIFIER_KEYS_ATTRIBUTE, + smodifiers); + } + if (sa.getTarget() != null) { + paintTarget.addAttribute( + ShortcutActionHandler.ACTION_TARGET_ATTRIBUTE, + sa.getTarget()); + paintTarget + .addAttribute( + ShortcutActionHandler.ACTION_TARGET_ACTION_ATTRIBUTE, + sa.getTargetAction()); } } paintTarget.endTag("action"); @@ -212,10 +228,14 @@ public class ActionManager implements Action.Container, Action.Handler, } public void handleActions(Map<String, Object> variables, Container sender) { - if (variables.containsKey("action") && actionMapper != null) { - final String key = (String) variables.get("action"); + if (variables + .containsKey(ShortcutActionHandler.ACTION_TARGET_ACTION_VARIABLE) + && actionMapper != null) { + final String key = (String) variables + .get(ShortcutActionHandler.ACTION_TARGET_ACTION_VARIABLE); final Action action = actionMapper.get(key); - final Object target = variables.get("actiontarget"); + final Object target = variables + .get(ShortcutActionHandler.ACTION_TARGET_VARIABLE); if (action != null) { handleAction(action, sender, target); } |