public class DefaultKeyboardSupportService extends Object implements KeyboardSupportService
KeyboardSupportService| Modifier and Type | Field and Description |
|---|---|
protected static String |
FUNCTION_KEYS |
protected static Pattern |
PATTERN
Patter should find for given @0@b@#ins^1^c^#del$2$d$#bak#f10 following groups
"@0", "@b", "@#ins", "^1", "^c", "^#del", "$2", "$d", "$#bak", "#f10".
|
protected static String |
PREFIX_FUNCTION_KEYS |
protected static Pattern |
PREFIX_PATTERN
Patter should check if prefix has only !^@ without duplicates
|
protected static String |
PREFIX_SIMPLE_KEYS |
protected static String |
SIMPLE_KEYS |
| Constructor and Description |
|---|
DefaultKeyboardSupportService()
Initialize binding between key codes and it's string representations
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKeyEvent(String ctrlKeys,
org.zkoss.zk.ui.event.KeyEvent keyEvent)
Checks if given ctrlKeys contains given keyEvent
|
protected String |
convertPrefix(String prefix) |
protected String |
convertToKeyEventCode(int key)
Converts given key code to it's string representation.
|
String |
convertToKeyEventCode(org.zkoss.zk.ui.event.KeyEvent keyEvent)
Converts given keyEvent to string representation.
|
protected String |
getLabel(String key) |
String |
getToolTip(String ctrlKeys)
Returns a tool tip text for given ctrl keys
|
protected boolean |
keyCodesMatch(String keyCodeOne,
String keyCodeTwo)
Tells if two keyCodes are equal where modifiers can be in random order.
|
String |
mergeCtrlKeys(String... ctrlKeysArg)
Merges given control keys into one string with no duplicates.
|
protected Set<String> |
splitCtrlKeys(String ctrlKeys)
Splits given triggerOnKeys in key codes
|
boolean |
validateCtrlKeys(String ctrlKeys)
Checks if all ctrl keys are valid
|
protected static final String PREFIX_SIMPLE_KEYS
protected static final String PREFIX_FUNCTION_KEYS
protected static final String FUNCTION_KEYS
protected static final String SIMPLE_KEYS
protected static final Pattern PATTERN
protected static final Pattern PREFIX_PATTERN
public DefaultKeyboardSupportService()
protected Set<String> splitCtrlKeys(String ctrlKeys)
ctrlKeys - triggerOnKeys e.g. "@0^c$#del#f10"public boolean containsKeyEvent(String ctrlKeys, org.zkoss.zk.ui.event.KeyEvent keyEvent)
KeyboardSupportServicecontainsKeyEvent in interface KeyboardSupportServicectrlKeys - ctrl keyskeyEvent - key eventKeyboardSupportService.convertToKeyEventCode(KeyEvent)protected boolean keyCodesMatch(String keyCodeOne, String keyCodeTwo)
keyCodeOne - @$^#delkeyCodeTwo - $@^#delpublic String mergeCtrlKeys(String... ctrlKeysArg)
KeyboardSupportServicemergeCtrlKeys in interface KeyboardSupportServicectrlKeysArg - list of triggerOnKeys e.g. @0@b@#ins and @1@c@#inspublic boolean validateCtrlKeys(String ctrlKeys)
KeyboardSupportServicevalidateCtrlKeys in interface KeyboardSupportServicectrlKeys - ctrl keys valid.protected String convertToKeyEventCode(int key)
key - KeyEvent.DELETE which is represented by 46public String convertToKeyEventCode(org.zkoss.zk.ui.event.KeyEvent keyEvent)
KeyboardSupportServiceKeyboardSupportService.SHIFT_PREFIX,
KeyboardSupportService.ALT_PREFIX or KeyboardSupportService.CTRL_PREFIX depending on modifiers in KeyEvent.isShiftKey(),
KeyEvent.isAltKey(), KeyEvent.isCtrlKey()
e.g. KeyEvent.DELETE which is represented by 46 and SHIFT pressed it should return $#del
convertToKeyEventCode in interface KeyboardSupportServicekeyEvent - key eventpublic String getToolTip(String ctrlKeys)
KeyboardSupportServicegetToolTip in interface KeyboardSupportServicectrlKeys - control keysCopyright © 2018. All rights reserved.