The keyboard shortcut handler component uses the Javascript library Mousetrap (https://github.com/ccampbell/mousetrap).
Inhalt |
---|
Installation
...
To use the keyboard shortcuts handling, the following JavaScript resources must be included in the header of the used HTML template where all the other JavaScript libraries are defined (e.g. templates/Root.html):
...
Codeblock | ||||||
---|---|---|---|---|---|---|
| ||||||
initShortcuts(shortcutHolderClass, bindingConf, searchGlobal); |
shortcutHolderClass (String)
String which holds the class defining the starting point of an element for searching the shortcuts actions. (e.g. for lists the class is "jax-list-holder-div")
bindingConf (String)
For the mapping of the shortcut keys, each shortcut can be paired with an html element id which holds the action called by the fired shortcut.
Codeblock | ||||||
---|---|---|---|---|---|---|
| ||||||
{"newLI":"alt+n", "cpLI":"alt+k", "delLI":"alt+r", "selPrevLI":"alt+up"} |
searchGlobal (boolean, [optional])
Boolean parameter which indicates if the focused field is not within the shortcutHolderClass, the shortcuts should be searched document wide instead.
If no searchGlobal param is passed, it's default value "true" is taken in place.
Configuration for list related shortcuts
...
Codeblock | ||||||
---|---|---|---|---|---|---|
| ||||||
registerListShortcuts(simplifiedConf, searchGlobalList); |
simplifiedConf (String, [optional])
JSON-String for mapping each list function to a corresponding key. ("function" : "key kombination")
Codeblock | ||||||
---|---|---|---|---|---|---|
| ||||||
{"new":"alt+n", "copy":"alt+k", "delete":"alt+r", "moveUp":"alt+u", "moveDown":"alt+i", "selectPrevious":"alt+up", "selectNext":"alt+down"} |
Available id's are:
id | description | default shortcut |
---|---|---|
new | Add a new list entry | alt + ctrl + n |
copy | Copy the selected list entry | alt + ctrl + c |
delete | Delete the selected list entry | alt + ctrl + d |
moveUp | Move the selected list entry up | alt + ctrl + up |
moveDown | Move the selected list entry down | alt + ctrl + down |
selectPrevious | Selects the previous list entry | ctrl + up |
selectNext | Selects the next list entry | ctrl + down |
If no simplifiedConf param is passed, the defined default value is taken in place!
searchGlobalList (boolean, [optional])
Boolean parameter which indicates if the focus is not within a list, the first list in the view should be applied if available instead.
If no searchGlobalList param is passed, it's default value "true" is taken in place.
System Variables
To simplify the configuration of the shortcuts, the system variable shortcutConfig can be used within the javascript call.
Codeblock | ||||||
---|---|---|---|---|---|---|
| ||||||
registerListShortcuts('${shortcutConfig}', true); |
The variable shortcutConfig can be configured with the following options:
- Declaration with the config key jaxfront.html.shortcuts.keyConfiguration within the jaxfront.xml config file
- Setup throug the Global-Definitions with the function setShortcutKeyConfiguratio(String) of GlobalDefinition.java
Supported keys/shortcuts
The shortcuts should be defined as combination like "alt+n", with the plus as seperator.
The following keys are available.
Modifier keys
- shift
- ctrl
- alt
- option
- meta
- command
- mod (os dependent generic key: Windows/Linux = ctrl, Mac = command)
Special keys
- backspace
- tab
- enter
- return
- capslock
- esc
- escape
- space
- pageup
- pagedown
- end
- home
- left
- up
- right
- down
- ins
- del
Other keys
All other keys can be referenced by name like a, 3, /, $ ...
Browser support
- Internet Explorer 6+
- Safari
- Firefox
- Chrome