diff --git a/flow-server/src/main/java/com/vaadin/flow/component/Key.java b/flow-server/src/main/java/com/vaadin/flow/component/Key.java index ab2018cdf0f..26da2edceb7 100644 --- a/flow-server/src/main/java/com/vaadin/flow/component/Key.java +++ b/flow-server/src/main/java/com/vaadin/flow/component/Key.java @@ -15,417 +15,1796 @@ */ package com.vaadin.flow.component; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; + /** - * Keyboard keys. + * An interface to represent keyboard keys. + *
+ * See
+ * https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values
*/
-public class Key {
+@FunctionalInterface
+public interface Key extends Serializable {
+
+ /**
+ * The user agent wasn't able to map the event's virtual keycode to a
+ * specific key value. This can happen due to hardware or software
+ * constraints, or because of constraints around the platform on which the
+ * user agent is running.
+ */
+ Key UNIDENTIFIED = Key.of("Unidentified");
+
+ /**
+ * The Alt
(Alternative) key.
+ */
+ Key ALT = Key.of("Alt");
+
+ /**
+ * The AltGr
or AltGraph
(Alternate Graphics) key.
+ * Enables the ISO Level 3 shift modifier (where Shift
is the
+ * level 2 modifier).
+ */
+ Key ALT_GRAPH = Key.of("AltGraph");
+
+ /**
+ * The Caps Lock
key. Toggles the capital character lock on and
+ * off for subsequent input.
+ */
+ Key CAPS_LOCK = Key.of("CapsLock");
+
+ /**
+ * The Control
, Ctrl
, or Ctl
key.
+ * Allows typing control characters.
+ */
+ Key CONTROL = Key.of("Control");
+
+ /**
+ * The Fn
(Function modifier) key. Used to allow generating
+ * function key (F1
-F15
, for instance) characters
+ * on keyboards without a dedicated function key area. Often handled in
+ * hardware so that events aren't generated for this key.
+ */
+ Key FN = Key.of("Fn");
+
+ /**
+ * The FnLock
or F-Lock
(Function Lock) key.
+ * Toggles the function key mode described by "Fn" on and off. Often handled
+ * in hardware so that events aren't generated for this key.
+ */
+ Key FN_LOCK = Key.of("FnLock");
+
+ /**
+ * The Hyper
key.
+ */
+ Key HYPER = Key.of("Hyper");
+
+ /**
+ * The Meta
key. Allows issuing special command inputs. This is
+ * the Windows
logo key, or the Command
or
+ * ⌘
key on Mac keyboards.
+ */
+ Key META = Key.of("Meta");
+
+ /**
+ * The NumLock
(Number Lock) key. Toggles the numeric keypad
+ * between number entry some other mode (often directional arrows).
+ */
+ Key NUM_LOCK = Key.of("NumLock");
+
+ /**
+ * The Scroll Lock
key. Toggles beteen scrolling and cursor
+ * movement modes.
+ */
+ Key SCROLL_LOCK = Key.of("ScrollLock");
+
+ /**
+ * The Shift
key. Modifies keystrokes to allow typing upper (or
+ * other) case letters, and to support typing punctuation and other special
+ * characters.
+ */
+ Key SHIFT = Key.of("Shift");
+
+ /**
+ * The Super
key.
+ */
+ Key SUPER = Key.of("Super");
+
+ /**
+ * The Symbol
modifier key (found on certain virtual
+ * keyboards).
+ */
+ Key SYMBOL = Key.of("Symbol");
+
+ /**
+ * The Symbol Lock
key.
+ */
+ Key SYMBOL_LOCK = Key.of("SymbolLock");
+
+ /**
+ * The Enter
or ↵
key (sometimes labeled
+ * Return
).
+ */
+ Key ENTER = Key.of("Enter");
+
+ /**
+ * The Horizontal Tab key, Tab
.
+ */
+ Key TAB = Key.of("Tab");
+
+ /**
+ * The space key, Space Bar
.
+ */
+ Key SPACE = Key.of(" ");
+
+ /**
+ * The down arrow key.
+ */
+ Key ARROW_DOWN = Key.of("ArrowDown");
+
+ /**
+ * The left arrow key.
+ */
+ Key ARROW_LEFT = Key.of("ArrowLeft");
+
+ /**
+ * The right arrow key.
+ */
+ Key ARROW_RIGHT = Key.of("ArrowRight");
+
+ /**
+ * The up arrow key.
+ */
+ Key ARROW_UP = Key.of("ArrowUp");
+
+ /**
+ * The End
key. Moves to the end of content.
+ */
+ Key END = Key.of("End");
+
+ /**
+ * The Home
key. Moves to the start of content.
+ */
+ Key HOME = Key.of("Home");
+
+ /**
+ * The Page Down
(or PgDn
) key. Scrolls down or
+ * displays the next page of content.
+ */
+ Key PAGE_DOWN = Key.of("PageDown");
+
+ /**
+ * The Page Up
(or PgUp
) key. Scrolls up or
+ * displays the previous page of content.
+ */
+ Key PAGE_UP = Key.of("PageUp");
+
+ /**
+ * The Backspace
key. This key is labeled Delete
+ * on Mac keyboards.
+ */
+ Key BACKSPACE = Key.of("Backspace");
+
+ /**
+ * The Clear
key. Removes the currently selected input.
+ */
+ Key CLEAR = Key.of("Clear");
+
+ /**
+ * The Copy
key (on certain extended keyboards).
+ */
+ Key COPY = Key.of("Copy");
+
+ /**
+ * The Cursor Select key, CrSel
.
+ */
+ Key CR_SEL = Key.of("CrSel");
+
+ /**
+ * The Cut
key (on certain extended keyboards).
+ */
+ Key CUT = Key.of("Cut");
+
+ /**
+ * The Delete key, Del
.
+ */
+ Key DELETE = Key.of("Delete", "Del");
+
+ /**
+ * Erase to End of Field. Deletes all characters from the current cursor
+ * position to the end of the current field.
+ */
+ Key ERASE_EOF = Key.of("EraseEof");
+
+ /**
+ * The ExSel
(Extend Selection) key.
+ */
+ Key EX_SEL = Key.of("ExSel");
+
+ /**
+ * The Insert key, Ins
. Toggles between inserting and
+ * overwriting text.
+ */
+ Key INSERT = Key.of("Insert");
+
+ /**
+ * Paste from the clipboard.
+ */
+ Key PASTE = Key.of("Paste");
+
+ /**
+ * Redo the last action.
+ */
+ Key REDO = Key.of("Redo");
+
+ /**
+ * Undo the last action.
+ */
+ Key UNDO = Key.of("Undo");
+
+ /**
+ * The Accept
, Commit
, or OK
key or
+ * button. Accepts the currently selected option or input method sequence
+ * conversion.
+ */
+ Key ACCEPT = Key.of("Accept");
+
+ /**
+ * The Again
key. Redoes or repeats a previous action.
+ */
+ Key AGAIN = Key.of("Again");
+
+ /**
+ * The Attn
(Attention) key.
+ */
+ Key ATTN = Key.of("Attn");
+
+ /**
+ * The Cancel
key.
+ */
+ Key CANCEL = Key.of("Cancel");
+
+ /**
+ * Shows the context menu. Typically found between the Windows
+ * (or OS
) key and the Control
key on the right
+ * side of the keyboard.
+ */
+ Key CONTEXT_MENU = Key.of("ContextMenu");
+
+ /**
+ * The Esc
(Escape) key. Typically used as an exit, cancel, or
+ * "escape this operation" button. Historically, the Escape character was
+ * used to signal the start of a special control sequence of characters
+ * called an "escape sequence."
+ */
+ Key ESCAPE = Key.of("Escape", "Esc");
+
+ /**
+ * The Execute
key.
+ */
+ Key EXECUTE = Key.of("Execute");
+
+ /**
+ * The Find
key. Opens an interface (typically a dialog box)
+ * for performing a find/search operation.
+ */
+ Key FIND = Key.of("Find");
+
+ /**
+ * The Finish
key.
+ */
+ Key FINISH = Key.of("Finish");
+
+ /**
+ * The Help
key. Opens or toggles the display of help
+ * information.
+ */
+ Key HELP = Key.of("Help");
+
+ /**
+ * The Pause
key. Pauses the current application or state, if
+ * applicable. Note: This shouldn't be confused with the
+ * "MediaPause"
key value, which is used for media controllers,
+ * rather than to control applications and processes.
+ *
+ */
+ Key PAUSE = Key.of("Pause");
+
+ /**
+ * The Play
key. Resumes a previously paused application, if
+ * applicable. Note: This shouldn't be confused with the
+ * "MediaPlay"
key value, which is used for media controllers,
+ * rather than to control applications and processes.
+ *
+ */
+ Key PLAY = Key.of("Play");
+
+ /**
+ * The Props
(Properties) key.
+ */
+ Key PROPS = Key.of("Props");
+
+ /**
+ * The Select
key.
+ */
+ Key SELECT = Key.of("Select");
+
+ /**
+ * The ZoomIn
key.
+ */
+ Key ZOOM_IN = Key.of("ZoomIn");
+
+ /**
+ * The ZoomOut
key.
+ */
+ Key ZOOM_OUT = Key.of("ZoomOut");
+
+ /**
+ * The Brightness Down key. Typically used to reduce the brightness of the
+ * display.
+ */
+ Key BRIGHTNESS_DOWN = Key.of("BrightnessDown");
+
+ /**
+ * The Brightness Up key. Typically increases the brightness of the display.
+ */
+ Key BRIGHTNESS_UP = Key.of("BrightnessUp");
+
+ /**
+ * The Eject
key. Ejects removable media (or toggles an optical
+ * storage device tray open and closed).
+ */
+ Key EJECT = Key.of("Eject");
+
+ /**
+ * The LogOff
key.
+ */
+ Key LOG_OFF = Key.of("LogOff");
+
+ /**
+ * The Power
button or key, to toggle power on and off.
+ *
+ * Note: Not all systems pass this key through to the user agent.
+ */
+ Key POWER = Key.of("Power");
+
+ /**
+ * The PowerOff
or PowerDown
key. Shuts off the
+ * system.
+ */
+ Key POWER_OFF = Key.of("PowerOff");
+
+ /**
+ * The PrintScreen
or PrtScr
key. Sometimes
+ * SnapShot
. Captures the screen and prints it or saves it to
+ * disk.
+ */
+ Key PRINT_SCREEN = Key.of("PrintScreen");
+
+ /**
+ * The Hibernate
key. This saves the state of the computer to
+ * disk and then shuts down; the computer can be returned to its previous
+ * state by restoring the saved state information.
+ */
+ Key HIBERNATE = Key.of("Hibernate");
+
+ /**
+ * The Standby
key; also known as Suspend
or
+ * Sleep
. This turns off the display and puts the computer in a
+ * low power consumption mode, without completely powering off.
+ */
+ Key STANDBY = Key.of("Standby");
+
+ /**
+ * The WakeUp
key; used to wake the computer from the
+ * hibernation or standby modes.
+ */
+ Key WAKE_UP = Key.of("WakeUp");
+
+ /**
+ * The All Candidates
key, which starts multi-candidate mode,
+ * in which multiple candidates are displayed for the ongoing input.
+ */
+ Key ALL_CANDIDATES = Key.of("AllCandidates");
+
+ /**
+ * The Alphanumeric
key.
+ */
+ Key ALPHANUMERIC = Key.of("Alphanumeric");
+
+ /**
+ * The Code Input
key, which enables code input mode, which
+ * lets the user enter characters by typing their code points (their Unicode
+ * character numbers, typically).
+ */
+ Key CODE_INPUT = Key.of("CodeInput");
+
+ /**
+ * The Compose
key.
+ */
+ Key COMPOSE = Key.of("Compose");
+
+ /**
+ * The Convert
key, which instructs the IME to convert the
+ * current input method sequence into the resulting character.
+ */
+ Key CONVERT = Key.of("Convert");
+
+ /**
+ * A dead "combining" key; that is, a key which is used in tandem with other
+ * keys to generate accented and other modified characters.
+ */
+ Key DEAD = Key.of("Dead");
+
+ /**
+ * The Final
(Final Mode) key is used on some Asian keyboards
+ * to enter final mode when using IMEs.
+ */
+ Key FINAL_MODE = Key.of("FinalMode");
+
+ /**
+ * Switches to the first character group on an
+ * ISO/IEC 9995
+ * keyboard. Each key may have multiple groups of characters, each in
+ * its own column. Pressing this key instructs the device to interpret
+ * keypresses as coming from the first column on subsequent keystrokes.
+ */
+ Key GROUP_FIRST = Key.of("GroupFirst");
+
+ /**
+ * Switches to the last character group on an
+ * ISO/IEC 9995
+ * keyboard.
+ */
+ Key GROUP_LAST = Key.of("GroupLast");
+
+ /**
+ * Switches to the next character group on an
+ * ISO/IEC 9995
+ * keyboard.
+ */
+ Key GROUP_NEXT = Key.of("GroupNext");
+
+ /**
+ * Switches to the previous character group on an
+ * ISO/IEC 9995
+ * keyboard.
+ */
+ Key GROUP_PREVIOUS = Key.of("GroupPrevious");
+
+ /**
+ * The Mode Change key. Toggles or cycles among input modes of IMEs.
+ */
+ Key MODE_CHANGE = Key.of("ModeChange");
+
+ /**
+ * The Next Candidate function key. Selects the next possible match for the
+ * ongoing input.
+ */
+ Key NEXT_CANDIDATE = Key.of("NextCandidate");
+
+ /**
+ * The NonConvert
("Don't convert") key. This accepts the
+ * current input method sequence without running conversion when using an
+ * IME.
+ */
+ Key NON_CONVERT = Key.of("NonConvert");
+
+ /**
+ * The Previous Candidate key. Selects the previous possible match for the
+ * ongoing input.
+ */
+ Key PREVIOUS_CANDIDATE = Key.of("PreviousCandidate");
+
+ /**
+ * The Process
key. Instructs the IME to process the
+ * conversion.
+ */
+ Key PROCESS = Key.of("Process");
+
+ /**
+ * The Single Candidate key. Enables single candidate mode (as opposed to
+ * multi-candidate mode); in this mode, only one candidate is displayed at a
+ * time.
+ */
+ Key SINGLE_CANDIDATE = Key.of("SingleCandidate");
+
+ /**
+ * The Hangul
(Korean character set) mode key, which toggles
+ * between Hangul and English entry modes.
+ */
+ Key HANGUL_MODE = Key.of("HangulMode");
+
+ /**
+ * Selects the Hanja mode, for converting Hangul characters to the more
+ * specific Hanja characters.
+ */
+ Key HANJA_MODE = Key.of("HanjaMode");
+
+ /**
+ * Selects the Junja mode, in which Korean is represented using single-byte
+ * Latin characters.
+ */
+ Key JUNJA_MODE = Key.of("JunjaMode");
+
+ /**
+ * The Eisu
key. This key's purpose is defined by the IME, but
+ * may be used to close the IME.
+ */
+ Key EISU = Key.of("Eisu");
/**
- * String for "Cancel
" key.
+ * The Hankaku
(half-width characters) key.
*/
- public static final String CANCEL = "Cancel";
+ Key HANKAKU = Key.of("Hankaku");
/**
- * String for "Help
" key.
+ * The Hiragana
key; selects Kana characters mode.
*/
- public static final String HELP = "Help";
+ Key HIRAGANA = Key.of("Hiragana");
/**
- * String for "Backspace
" key.
+ * Toggles between the Hiragana and Katakana writing systems.
*/
- public static final String BACKSPACE = "Backspace";
+ Key HIRAGANA_KATAKANA = Key.of("HiraganaKatakana");
/**
- * String for "Tab
" key.
+ * The Kana Mode
(Kana Lock) key.
*/
- public static final String TAB = "Tab";
+ Key KANA_MODE = Key.of("KanaMode");
/**
- * String for "Clear
" key.
+ * The Kanji Mode
key. Enables entering Japanese text using the
+ * ideographic characters of Chinese origin.
*/
- public static final String CLEAR = "Clear";
+ Key KANJI_MODE = Key.of("KanjiMode");
/**
- * String for "Enter
" key.
+ * The Katakana
key.
*/
- public static final String ENTER = "Enter";
+ Key KATAKANA = Key.of("Katakana");
/**
- * String for "Shift
" key.
+ * The Romaji
key; selects the Roman character set.
*/
- public static final String SHIFT = "Shift";
+ Key ROMAJI = Key.of("Romaji");
/**
- * String for "Control
" key.
+ * The Zenkaku
(full width) characters key.
*/
- public static final String CONTROL = "Control";
+ Key ZENKAKU = Key.of("Zenkaku");
/**
- * String for "Alt
" key.
+ * The Zenkaku/Hankaku
(full width/half width) toggle key.
*/
- public static final String ALT = "Alt";
+ Key ZENKAKU_HANAKU = Key.of("ZenkakuHanaku");
/**
- * String for "Pause
" key.
+ * The first general-purpose function key, F1
.
*/
- public static final String PAUSE = "Pause";
+ Key F1 = Key.of("F1");
/**
- * String for "CapsLock
" key.
+ * The F2
key.
*/
- public static final String CAPS_LOCK = "CapsLock";
+ Key F2 = Key.of("F2");
/**
- * String for "Escape
" key.
+ * The F3
key.
*/
- public static final String ESCAPE = "Escape";
+ Key F3 = Key.of("F3");
/**
- * String for "Convert
" key.
+ * The F4
key.
*/
- public static final String CONVERT = "Convert";
+ Key F4 = Key.of("F4");
/**
- * String for "NonConvert
" key.
+ * The F5
key.
*/
- public static final String NON_CONVERT = "NonConvert";
+ Key F5 = Key.of("F5");
/**
- * String for "Accept
" key.
+ * The F6
key.
*/
- public static final String ACCEPT = "Accept";
+ Key F6 = Key.of("F6");
/**
- * String for "ModeChange
" key.
+ * The F7
key.
*/
- public static final String MODE_CHANGE = "ModeChange";
+ Key F7 = Key.of("F7");
/**
- * String for " " (space) key.
+ * The F8
key.
*/
- public static final String SPACE = " ";
+ Key F8 = Key.of("F8");
/**
- * String for "PageUp
" key.
+ * The F9
key.
*/
- public static final String PAGE_UP = "PageUp";
+ Key F9 = Key.of("F9");
/**
- * String for "PageDown
" key.
+ * The F10
key.
*/
- public static final String PAGE_DOWN = "PageDown";
+ Key F10 = Key.of("F10");
/**
- * String for "End
" key.
+ * The F11
key.
*/
- public static final String END = "End";
+ Key F11 = Key.of("F11");
/**
- * String for "Home
" key.
+ * The F12
key.
*/
- public static final String HOME = "Home";
+ Key F12 = Key.of("F12");
/**
- * String for "ArrowLeft
" key.
+ * The F13
key.
*/
- public static final String ARROW_LEFT = "ArrowLeft";
+ Key F13 = Key.of("F13");
/**
- * String for "ArrowUp
" key.
+ * The F14
key.
*/
- public static final String ARROW_UP = "ArrowUp";
+ Key F14 = Key.of("F14");
/**
- * String for "ArrowRight
" key.
+ * The F15
key.
*/
- public static final String ARROW_RIGHT = "ArrowRight";
+ Key F15 = Key.of("F15");
/**
- * String for "ArrowDown
" key.
+ * The F16
key.
*/
- public static final String ARROW_DOWN = "ArrowDown";
+ Key F16 = Key.of("F16");
/**
- * String for "Select
" key.
+ * The F17
key.
*/
- public static final String SELECT = "Select";
+ Key F17 = Key.of("F17");
/**
- * String for "Print
" key.
+ * The F18
key.
*/
- public static final String PRINT = "Print";
+ Key F18 = Key.of("F18");
/**
- * String for "Execute
" key.
+ * The F19
key.
*/
- public static final String EXECUTE = "Execute";
+ Key F19 = Key.of("F19");
/**
- * String for "PrintScreen
" key.
+ * The F20
key.
*/
- public static final String PRINT_SCREEN = "PrintScreen";
+ Key F20 = Key.of("F20");
/**
- * String for "Insert
" key.
+ * The first general-purpose virtual function key.
*/
- public static final String INSERT = "Insert";
+ Key SOFT1 = Key.of("Soft1");
/**
- * String for "Delete
" key.
+ * The second general-purpose virtual function key.
*/
- public static final String DELETE = "Delete";
+ Key SOFT2 = Key.of("Soft2");
/**
- * String for "0
" key.
+ * The third general-purpose virtual function key.
*/
- public static final String ZERO = "0";
+ Key SOFT3 = Key.of("Soft3");
/**
- * String for "1
" key.
+ * The fourth general-purpose virtual function key.
*/
- public static final String ONE = "1";
+ Key SOFT4 = Key.of("Soft4");
/**
- * String for "2
" key.
+ * Presents a list of recently-used applications which lets the user change
+ * apps quickly.
*/
- public static final String TWO = "2";
+ Key APP_SWITCH = Key.of("AppSwitch");
/**
- * String for "3
" key.
+ * The Call
key; dials the number which has been entered.
*/
- public static final String THREE = "3";
+ Key CALL = Key.of("Call");
/**
- * String for "4
" key.
+ * The Camera
key; activates the camera.
*/
- public static final String FOUR = "4";
+ Key CAMERA = Key.of("Camera");
/**
- * String for "5
" key.
+ * The Focus
key; focuses the camera.
*/
- public static final String FIVE = "5";
+ Key CAMERA_FOCUS = Key.of("CameraFocus");
/**
- * String for "6
" key.
+ * The End Call
or Hang Up
button.
*/
- public static final String SIX = "6";
+ Key END_CALL = Key.of("EndCall");
/**
- * String for "7
" key.
+ * The Back
button.
*/
- public static final String SEVEN = "7";
+ Key GO_BACK = Key.of("GoBack");
/**
- * String for "8
" key.
+ * The Home
button, which takes the user to the phone's main
+ * screen (usually an application launcher).
*/
- public static final String EIGHT = "8";
+ Key GO_HOME = Key.of("GoHome");
/**
- * String for "9
" key.
+ * The Headset Hook
key. This is typically actually a button on
+ * the headset which is used to hang up calls and play or pause media.
*/
- public static final String NINE = "9";
+ Key HEADSET_HOOK = Key.of("HeadsetHook");
/**
- * String for ")
" key.
+ * The Redial
button, which redials the last-called number.
*/
- public static final String PARENTHESIS_RIGHT = ")";
+ Key LAST_NUMBER_REDIAL = Key.of("LastNumberRedial");
/**
- * String for "!
" key.
+ * The Notification
key.
*/
- public static final String EXCLAMATION_MARK = "!";
+ Key NOTIFICATION = Key.of("Notification");
/**
- * String for "@
" key.
+ * A button which cycles among the notification modes: silent, vibrate,
+ * ring, and so forth.
*/
- public static final String AT = "@";
+ Key MANNER_MODE = Key.of("MannerMode");
/**
- * String for "#
" key.
+ * The Voice Dial
key. Initiates voice dialing.
*/
- public static final String HASH = "#";
+ Key VOICE_DIAL = Key.of("VoiceDial");
/**
- * String for "$
" key.
+ * Switches to the previous channel.
*/
- public static final String DOLLAR = "$";
+ Key CHANNEL_DOWN = Key.of("ChannelDown");
/**
- * String for "%
" key.
+ * Switches to the next channel.
*/
- public static final String PERCENTAGE = "%";
+ Key CHANNEL_UP = Key.of("ChannelUp");
/**
- * String for "^
" key.
+ * Starts, continues, or increases the speed of fast forwarding the media.
*/
- public static final String CARET = "^";
+ Key MEDIA_FAST_FORWARD = Key.of("MediaFastForward");
/**
- * String for "&
" key.
+ * Pauses the currently playing media. Some older applications use simply
+ * "Pause" but this is not correct.
*/
- public static final String AMPERSAND = "&";
+ Key MEDIA_PAUSE = Key.of("MediaPause");
/**
- * String for "(
" key.
+ * Starts or continues playing media at normal speed, if not already doing
+ * so. Has no effect otherwise.
*/
- public static final String PARENTHESIS_LEFT = "(";
+ Key MEDIA_PLAY = Key.of("MediaPlay");
/**
- * String for "OS
" key.
+ * Toggles between playing and pausing the current media.
*/
- public static final String OS = "OS";
+ Key MEDIA_PLAY_PAUSE = Key.of("MediaPlayPause");
/**
- * String for "ContextMenu
" key.
+ * Starts or resumes recording media.
*/
- public static final String CONTEXT_MENU = "ContextMenu";
+ Key MEDIA_RECORD = Key.of("MediaRecord");
/**
- * String for "*
" key.
+ * Starts, continues, or increases the speed of rewinding the media.
*/
- public static final String ASTERISK = "*";
+ Key MEDIA_REWIND = Key.of("MediaRewind");
/**
- * String for "+
" key.
+ * Stops the current media activity (such as playing, recording, pausing,
+ * forwarding, or rewinding). Has no effect if the media is currently
+ * stopped already.
*/
- public static final String PLUS = "+";
+ Key MEDIA_STOP = Key.of("MediaStop");
/**
- * String for "-
" key.
+ * Seeks to the next media or program track.
*/
- public static final String MINUS = "-";
+ Key MEDIA_TRACK_NEXT = Key.of("MediaTrackNext");
/**
- * String for ".
" key.
+ * Seeks to the previous media or program track.
*/
- public static final String DOT = ".";
+ Key MEDIA_TRACK_PREVIOUS = Key.of("MediaTrackPrevious");
/**
- * String for "/
" key.
+ * Adjusts audio balance toward the left.
*/
- public static final String SLASH = "/";
+ Key AUDIO_BALANCE_LEFT = Key.of("AudioBalanceLeft");
/**
- * String for "NumLock
" key.
+ * Adjusts audio balance toward the right.
*/
- public static final String NUM_LOCK = "NumLock";
+ Key AUDIO_BALANCE_RIGHT = Key.of("AudioBalanceRight");
/**
- * String for "ScrollLock
" key.
+ * Decreases the amount of bass.
*/
- public static final String SCROLL_LOCK = "ScrollLock";
+ Key AUDIO_BASS_DOWN = Key.of("AudioBassDown");
/**
- * String for "VolumeMute
" key.
+ * Reduces bass boosting or cycles downward through bass boost modes or
+ * states.
*/
- public static final String VOLUME_MUTE = "VolumeMute";
+ Key AUDIO_BASS_BOOST_DOWN = Key.of("AudioBassBoostDown");
/**
- * String for "VolumeDown
" key.
+ * Toggles bass boosting on and off.
*/
- public static final String VOLUME_DOWN = "VolumeDown";
+ Key AUDIO_BASS_BOOST_TOGGLE = Key.of("AudioBassBoostToggle");
/**
- * String for "VolumeUp
" key.
+ * Increases the amount of bass boosting, or cycles upward through a set of
+ * bass boost modes or states.
*/
- public static final String VOLUME_UP = "VolumeUp";
+ Key AUDIO_BASS_BOOST_UP = Key.of("AudioBassBoostUp");
/**
- * String for ";
" key.
+ * Increases the amount of bass.
*/
- public static final String SEMICOLON = ";";
+ Key AUDIO_BASS_UP = Key.of("AudioBassUp");
/**
- * String for "=
" key.
+ * Adjusts the audio fader toward the front.
*/
- public static final String EQUAL = "=";
+ Key AUDIO_FADER_FRONT = Key.of("AudioFaderFront");
/**
- * String for ",
" key.
+ * Adjusts the audio fader toward the rear.
*/
- public static final String COMMA = ",";
+ Key AUDIO_FADER_REAR = Key.of("AudioFaderRear");
/**
- * String for "`
" key.
+ * Selects the next available surround sound mode.
*/
- public static final String BACK_TICK = "`";
+ Key AUDIO_SURROUND_MODE_NEXT = Key.of("AudioSurroundModeNext");
/**
- * String for "[
" key.
+ * Decreases the amount of treble.
*/
- public static final String SQUARE_BRACKET_LEFT = "[";
+ Key AUDIO_TREBLE_DOWN = Key.of("AudioTrebleDown");
/**
- * String for "\
" key.
+ * Increases the amount of treble.
*/
- public static final String BACKSLASH = "\\";
+ Key AUDIO_TREBLE_UP = Key.of("AudioTrebleUp");
/**
- * String for "]
" key.
+ * Decreases the audio volume.
*/
- public static final String SQUARE_BRACKET_RIGHT = "]";
+ Key AUDIO_VOLUME_DOWN = Key.of("AudioVolumeDown");
/**
- * String for ""
" key.
+ * Mutes the audio.
*/
- public static final String QUOTE = "\"";
+ Key AUDIO_VOLUME_MUTE = Key.of("AudioVolumeMute");
/**
- * String for ":
" key.
+ * Increases the audio volume.
*/
- public static final String COLON = ":";
+ Key AUDIO_VOLUME_UP = Key.of("AudioVolumeUp");
/**
- * String for "<
" key.
+ * Toggles the microphone on and off.
*/
- public static final String ANGLE_BRACKET_LEFT = "<";
+ Key MICROPHONE_TOGGLE = Key.of("MicrophoneToggle");
/**
- * String for "_
" key.
+ * Decreases the microphone's input volume.
*/
- public static final String UNDERSCORE = "_";
+ Key MICROPHONE_VOLUME_DOWN = Key.of("MicrophoneVolumeDown");
/**
- * String for ">
" key.
+ * Mutes the microphone input.
*/
- public static final String ANGLE_BRACKET_RIGHT = ">";
+ Key MICROPHONE_VOLUME_MUTE = Key.of("MicrophoneVolumeMute");
/**
- * String for "?
" key.
+ * Increases the microphone's input volume.
*/
- public static final String QUESTION_MARK = "?";
+ Key MICROPHONE_VOLUME_UP = Key.of("MicrophoneVolumeUp");
/**
- * String for "~
" key.
+ * Switches into TV viewing mode.
*/
- public static final String TILDE = "~";
+ Key TV = Key.of("TV");
/**
- * String for "{
" key.
+ * Toggles 3D TV mode on and off.
*/
- public static final String CURLY_BRACKET_LEFT = "{";
+ Key TV_3D_MODE = Key.of("TV3DMode");
/**
- * String for "|
" key.
+ * Toggles between antenna and cable inputs.
*/
- public static final String PIPE = "|";
+ Key TV_ANTENNA_CABLE = Key.of("TVAntennaCable");
/**
- * String for "}
" key.
+ * Toggles audio description mode on and off.
*/
- public static final String CURLY_BRACKET_RIGHT = "}";
+ Key TV_AUDIO_DESCRIPTION = Key.of("TVAudioDescription");
/**
- * String for "Meta
" key.
+ * Decreases the audio description's mixing volume; reduces the volume of
+ * the audio descriptions relative to the program sound.
*/
- public static final String META = "Meta";
+ Key TV_AUDIO_DESCRIPTION_MIX_DOWN = Key.of("TVAudioDescriptionMixDown");
/**
- * String for "AltGraph
" key.
+ * Increases the audio description's mixing volume; increases the volume of
+ * the audio descriptions relative to the program sound.
*/
- public static final String ALT_GRAPH = "AltGraph";
+ Key TV_AUDIO_DESCRIPTION_MIX_UP = Key.of("TVAudioDescriptionMixUp");
- private Key() {
+ /**
+ * Displays or hides the media contents available for playback (this may be
+ * a channel guide showing the currently airing programs, or a list of media
+ * files to play).
+ */
+ Key TV_CONTENTS_MENU = Key.of("TVContentsMenu");
+
+ /**
+ * Displays or hides the TV's data service menu.
+ */
+ Key TV_DATA_SERVICE = Key.of("TVDataService");
+
+ /**
+ * Cycles the input mode on an external TV.
+ */
+ Key TV_INPUT = Key.of("TVInput");
+
+ /**
+ * Switches to the input "Component 1."
+ */
+ Key TV_INPUT_COMPONENT1 = Key.of("TVInputComponent1");
+
+ /**
+ * Switches to the input "Component 2."
+ */
+ Key TV_INPUT_COMPONENT2 = Key.of("TVInputComponent2");
+
+ /**
+ * Switches to the input "Composite 1."
+ */
+ Key TV_INPUT_COMPOSITE1 = Key.of("TVInputComposite1");
+
+ /**
+ * Switches to the input "Composite 2."
+ */
+ Key TV_INPUT_COMPOSITE2 = Key.of("TVInputComposite2");
+
+ /**
+ * Switches to the input "HDMI 1."
+ */
+ Key TV_INPUT_HDMI1 = Key.of("TVInputHDMI1");
+
+ /**
+ * Switches to the input "HDMI 2."
+ */
+ Key TV_INPUT_HDMI2 = Key.of("TVInputHDMI2");
+
+ /**
+ * Switches to the input "HDMI 3."
+ */
+ Key TV_INPUT_HDMI3 = Key.of("TVInputHDMI3");
+
+ /**
+ * Switches to the input "HDMI 4."
+ */
+ Key TV_INPUT_HDMI4 = Key.of("TVInputHDMI4");
+
+ /**
+ * Switches to the input "VGA 1."
+ */
+ Key TV_INPUT_VGA1 = Key.of("TVInputVGA1");
+
+ /**
+ * The Media Context menu key.
+ */
+ Key TV_MEDIA_CONTEXT = Key.of("TVMediaContext");
+
+ /**
+ * Toggle the TV's network connection on and off.
+ */
+ Key TV_NETWORK = Key.of("TVNetwork");
+
+ /**
+ * Put the TV into number entry mode.
+ */
+ Key TV_NUMBER_ENTRY = Key.of("TVNumberEntry");
+
+ /**
+ * The device's power button.
+ */
+ Key TV_POWER = Key.of("TVPower");
+
+ /**
+ * Radio button.
+ */
+ Key TV_RADIO_SERVICE = Key.of("TVRadioService");
+
+ /**
+ * Satellite button.
+ */
+ Key TV_SATELLITE = Key.of("TVSatellite");
+
+ /**
+ * Broadcast Satellite button.
+ */
+ Key TV_SATELLITE_BS = Key.of("TVSatelliteBS");
+
+ /**
+ * Communication Satellite button.
+ */
+ Key TV_SATELLITE_CS = Key.of("TVSatelliteCS");
+
+ /**
+ * Toggles among available satellites.
+ */
+ Key TV_SATELLITE_TOGGLE = Key.of("TVSatelliteToggle");
+
+ /**
+ * Selects analog terrestrial television service (analog cable or antenna
+ * reception).
+ */
+ Key TV_TERRESTRIAL_ANALOG = Key.of("TVTerrestrialAnalog");
+
+ /**
+ * Selects digital terrestrial television service (digital cable or antenna
+ * reception).
+ */
+ Key TV_TERRESTRIAL_DIGITAL = Key.of("TVTerrestrialDigital");
+
+ /**
+ * Timer programming button.
+ */
+ Key TV_TIMER = Key.of("TVTimer");
+
+ /**
+ * Changes the input mode on an external audio/video receiver (AVR) unit.
+ */
+ Key AVR_INPUT = Key.of("AVRInput");
+
+ /**
+ * Toggles the power on an external AVR unit.
+ */
+ Key AVR_POWER = Key.of("AVRPower");
+
+ /**
+ * General-purpose media function key, color-coded red; this has index 0
+ * among the colored keys.
+ */
+ Key COLOR_F0_RED = Key.of("ColorF0Red");
+
+ /**
+ * General-purpose media function key, color-coded green; this has index 1
+ * among the colored keys.
+ */
+ Key COLOR_F1_GREEN = Key.of("ColorF1Green");
+
+ /**
+ * General-purpose media function key, color-coded yellow; this has index 2
+ * among the colored keys.
+ */
+ Key COLOR_F2_YELLOW = Key.of("ColorF2Yellow");
+
+ /**
+ * General-purpose media function key, color-coded blue; this has index 3
+ * among the colored keys.
+ */
+ Key COLOR_F3_BLUE = Key.of("ColorF3Blue");
+
+ /**
+ * General-purpose media function key, color-coded grey; this has index 4
+ * among the colored keys.
+ */
+ Key COLOR_F4_GREY = Key.of("ColorF4Grey");
+
+ /**
+ * General-purpose media function key, color-coded brown; this has index 5
+ * among the colored keys.
+ */
+ Key COLOR_F5_BROWN = Key.of("ColorF5Brown");
+
+ /**
+ * Toggles closed captioning on and off.
+ */
+ Key CLOSED_CAPTION_TOGGLE = Key.of("ClosedCaptionToggle");
+
+ /**
+ * Adjusts the brightness of the device by toggling between two brightness
+ * levels or by cycling among multiple brightness levels.
+ */
+ Key DIMMER = Key.of("Dimmer");
+
+ /**
+ * Cycles among video sources.
+ */
+ Key DISPLAY_SWAP = Key.of("DisplaySwap");
+
+ /**
+ * Switches the input source to the Digital Video Recorder (DVR).
+ */
+ Key DVR = Key.of("DVR");
+
+ /**
+ * The Exit button, which exits the current application or menu.
+ */
+ Key EXIT = Key.of("Exit");
+
+ /**
+ * Clears the program or content stored in the first favorites list slot.
+ */
+ Key FAVORITE_CLEAR0 = Key.of("FavoriteClear0");
+
+ /**
+ * Clears the program or content stored in the second favorites list slot.
+ */
+ Key FAVORITE_CLEAR1 = Key.of("FavoriteClear1");
+
+ /**
+ * Clears the program or content stored in the third favorites list slot.
+ */
+ Key FAVORITE_CLEAR2 = Key.of("FavoriteClear2");
+
+ /**
+ * Clears the program or content stored in the fourth favorites list slot.
+ */
+ Key FAVORITE_CLEAR3 = Key.of("FavoriteClear3");
+
+ /**
+ * Selects (recalls) the program or content stored in the first favorites
+ * list slot.
+ */
+ Key FAVORITE_RECALL0 = Key.of("FavoriteRecall0");
+
+ /**
+ * Selects (recalls) the program or content stored in the second favorites
+ * list slot.
+ */
+ Key FAVORITE_RECALL1 = Key.of("FavoriteRecall1");
+
+ /**
+ * Selects (recalls) the program or content stored in the third favorites
+ * list slot.
+ */
+ Key FAVORITE_RECALL2 = Key.of("FavoriteRecall2");
+
+ /**
+ * Selects (recalls) the program or content stored in the fourth favorites
+ * list slot.
+ */
+ Key FAVORITE_RECALL3 = Key.of("FavoriteRecall3");
+
+ /**
+ * Stores the current program or content into the first favorites list slot.
+ */
+ Key FAVORITE_STORE0 = Key.of("FavoriteStore0");
+
+ /**
+ * Stores the current program or content into the second favorites list
+ * slot.
+ */
+ Key FAVORITE_STORE1 = Key.of("FavoriteStore1");
+
+ /**
+ * Stores the current program or content into the third favorites list slot.
+ */
+ Key FAVORITE_STORE2 = Key.of("FavoriteStore2");
+
+ /**
+ * Stores the current program or content into the fourth favorites list
+ * slot.
+ */
+ Key FAVORITE_STORE3 = Key.of("FavoriteStore3");
+
+ /**
+ * Toggles the display of the program or content guide.
+ */
+ Key GUIDE = Key.of("Guide");
+
+ /**
+ * If the guide is currently displayed, this button tells the guide to
+ * display the next day's content.
+ */
+ Key GUIDE_NEXT_DAY = Key.of("GuideNextDay");
+
+ /**
+ * If the guide is currently displayed, this button tells the guide to
+ * display the previous day's content.
+ */
+ Key GUIDE_PREVIOUS_DAY = Key.of("GuidePreviousDay");
+
+ /**
+ * Toggles the display of information about the currently selected content,
+ * program, or media.
+ */
+ Key INFO = Key.of("Info");
+
+ /**
+ * Tells the device to perform an instant replay (typically some form of
+ * jumping back a short amount of time then playing it again, possibly but
+ * not usually in slow motion).
+ */
+ Key INSTANT_REPLAY = Key.of("InstantReplay");
+
+ /**
+ * Opens content linked to the current program, if available and possible.
+ */
+ Key LINK = Key.of("Link");
+
+ /**
+ * Lists the current program.
+ */
+ Key LIST_PROGRAM = Key.of("ListProgram");
+
+ /**
+ * Toggles a display listing currently available live content or programs.
+ */
+ Key LIVE_CONTENT = Key.of("LiveContent");
+
+ /**
+ * Locks or unlocks the currently selected content or program.
+ */
+ Key LOCK = Key.of("Lock");
+
+ /**
+ * Presents a list of media applications, such as photo viewers, audio and
+ * video players, and games.
+ */
+ Key MEDIA_APPS = Key.of("MediaApps");
+
+ /**
+ * The Audio Track key.
+ */
+ Key MEDIA_AUDIO_TRACK = Key.of("MediaAudioTrack");
+
+ /**
+ * Jumps back to the last-viewed content, program, or other media.
+ */
+ Key MEDIA_LAST = Key.of("MediaLast");
+
+ /**
+ * Skips backward to the previous content or program.
+ */
+ Key MEDIA_SKIP_BACKWARD = Key.of("MediaSkipBackward");
+
+ /**
+ * Skips forward to the next content or program.
+ */
+ Key MEDIA_SKIP_FORWARD = Key.of("MediaSkipForward");
+
+ /**
+ * Steps backward to the previous content or program.
+ */
+ Key MEDIA_STEP_BACKWARD = Key.of("MediaStepBackward");
+
+ /**
+ * Steps forward to the next content or program.
+ */
+ Key MEDIA_STEP_FORWARD = Key.of("MediaStepForward");
+
+ /**
+ * Top Menu button; opens the media's main menu, such as on a DVD or Blu-Ray
+ * disc.
+ */
+ Key MEDIA_TOP_MENU = Key.of("MediaTopMenu");
+
+ /**
+ * Navigates into a submenu or option.
+ */
+ Key NAVIGATE_IN = Key.of("NavigateIn");
+
+ /**
+ * Navigates to the next item.
+ */
+ Key NAVIGATE_NEXT = Key.of("NavigateNext");
+
+ /**
+ * Navigates out of the current screen or menu.
+ */
+ Key NAVIGATE_OUT = Key.of("NavigateOut");
+
+ /**
+ * Navigates to the previous item.
+ */
+ Key NAVIGATE_PREVIOUS = Key.of("NavigatePrevious");
+
+ /**
+ * Cycles to the next channel in the favorites list.
+ */
+ Key NEXT_FAVORITE_CHANNEL = Key.of("NextFavoriteChannel");
+
+ /**
+ * Cycles to the next saved user profile, if this feature is supported and
+ * multiple profiles exist.
+ */
+ Key NEXT_USER_PROFILE = Key.of("NextUserProfile");
+
+ /**
+ * Opens the user interface for selecting on demand content or programs to
+ * watch.
+ */
+ Key ON_DEMAND = Key.of("OnDemand");
+
+ /**
+ * Starts the process of pairing the remote with a device to be controlled.
+ */
+ Key PAIRING = Key.of("Pairing");
+
+ /**
+ * A button to move the picture-in-picture view downward.
+ */
+ Key PINP_DOWN = Key.of("PinPDown");
+
+ /**
+ * A button to control moving the picture-in-picture view.
+ */
+ Key PINP_MOVE = Key.of("PinPMove");
+
+ /**
+ * Toggles display of the picture-in-picture view on and off.
+ */
+ Key PINP_TOGGLE = Key.of("PinPToggle");
+
+ /**
+ * A button to move the picture-in-picture view upward.
+ */
+ Key PINP_UP = Key.of("PinPUp");
+
+ /**
+ * Decreases the media playback rate.
+ */
+ Key PLAY_SPEED_DOWN = Key.of("PlaySpeedDown");
+
+ /**
+ * Returns the media playback rate to normal.
+ */
+ Key PLAY_SPEED_RESET = Key.of("PlaySpeedReset");
+
+ /**
+ * Increases the media playback rate.
+ */
+ Key PLAY_SPEED_UP = Key.of("PlaySpeedUp");
+
+ /**
+ * Toggles random media (also known as "shuffle mode") on and off.
+ */
+ Key RANDOM_TOGGLE = Key.of("RandomToggle");
+
+ /**
+ * A code sent when the remote control's battery is low. This doesn't
+ * actually correspond to a physical key at all.
+ */
+ Key RC_LOW_BATTERY = Key.of("RcLowBattery");
+
+ /**
+ * Cycles among the available media recording speeds.
+ */
+ Key RECORD_SPEED_NEXT = Key.of("RecordSpeedNext");
+
+ /**
+ * Toggles radio frequency (RF) input bypass mode on and off. RF bypass mode
+ * passes RF input directly to the RF output without any processing or
+ * filtering.
+ */
+ Key RF_BYPASS = Key.of("RfBypass");
+
+ /**
+ * Toggles the channel scan mode on and off; this is a mode which flips
+ * through channels automatically until the user stops the scan.
+ */
+ Key SCAN_CHANNELS_TOGGLE = Key.of("ScanChannelsToggle");
+
+ /**
+ * Cycles through the available screen display modes.
+ */
+ Key SCREEN_MODE_NEXT = Key.of("ScreenModeNext");
+
+ /**
+ * Toggles display of the device's settings screen on and off.
+ */
+ Key SETTINGS = Key.of("Settings");
+
+ /**
+ * Toggles split screen display mode on and off.
+ */
+ Key SPLIT_SCREEN_TOGGLE = Key.of("SplitScreenToggle");
+
+ /**
+ * Cycles among input modes on an external set-top box (STB).
+ */
+ Key STB_INPUT = Key.of("STBInput");
+
+ /**
+ * Toggles on and off an external STB.
+ */
+ Key STB_POWER = Key.of("STBPower");
+
+ /**
+ * Toggles the display of subtitles on and off if they're available.
+ */
+ Key SUBTITLE = Key.of("Subtitle");
+
+ /**
+ * Toggles display of
+ * teletext, if
+ * available.
+ */
+ Key TELETEXT = Key.of("Teletext");
+
+ /**
+ * Cycles through the available video modes.
+ */
+ Key VIDEO_MODE_NEXT = Key.of("VideoModeNext");
+
+ /**
+ * Causes the device to identify itself in some fashion, such as by flashing
+ * a light, briefly changing the brightness of indicator lights, or emitting
+ * a tone.
+ */
+ Key WINK = Key.of("Wink");
+
+ /**
+ * Toggles between full-screen and scaled content display, or otherwise
+ * change the magnification level.
+ */
+ Key ZOOM_TOGGLE = Key.of("ZoomToggle");
+
+ /**
+ * Presents a list of possible corrections for a word which was incorrectly
+ * identified.
+ */
+ Key SPEECH_CORRECTION_LIST = Key.of("SpeechCorrectionList");
+
+ /**
+ * Toggles between dictation mode and command/control mode. This lets the
+ * speech engine know whether to interpret spoken words as input text or as
+ * commands.
+ */
+ Key SPEECH_INPUT_TOGGLE = Key.of("SpeechInputToggle");
+
+ /**
+ * Closes the current document or message. Must not exit the application.
+ */
+ Key CLOSE = Key.of("Close");
+
+ /**
+ * Creates a new document or message.
+ */
+ Key NEW = Key.of("New");
+
+ /**
+ * Opens an existing document or message.
+ */
+ Key OPEN = Key.of("Open");
+
+ /**
+ * Prints the current document or message.
+ */
+ Key PRINT = Key.of("Print");
+
+ /**
+ * Saves the current document or message.
+ */
+ Key SAVE = Key.of("Save");
+
+ /**
+ * Starts spell checking the current document.
+ */
+ Key SPELL_CHECK = Key.of("SpellCheck");
+
+ /**
+ * Opens the user interface to forward a message.
+ */
+ Key MAIL_FORWARD = Key.of("MailForward");
+
+ /**
+ * Opens the user interface to reply to a message.
+ */
+ Key MAIL_REPLY = Key.of("MailReply");
+
+ /**
+ * Sends the current message.
+ */
+ Key MAIL_SEND = Key.of("MailSend");
+
+ /**
+ * The Calculator
key. This is often used as a generic
+ * application launcher key (APPCOMMAND_LAUNCH_APP2
).
+ */
+ Key LAUNCH_CALCULATOR = Key.of("LaunchCalculator");
+
+ /**
+ * The Calendar
key.
+ */
+ Key LAUNCH_CALENDAR = Key.of("LaunchCalendar");
+
+ /**
+ * The Contacts
key.
+ */
+ Key LAUNCH_CONTACTS = Key.of("LaunchContacts");
+
+ /**
+ * The Mail
key.
+ */
+ Key LAUNCH_MAIL = Key.of("LaunchMail");
+
+ /**
+ * The Media Player
key.
+ */
+ Key LAUNCH_MEDIA_PLAYER = Key.of("LaunchMediaPlayer");
+
+ /**
+ * The Music Player
key.
+ */
+ Key LAUNCH_MUSIC_PLAYER = Key.of("LaunchMusicPlayer");
+
+ /**
+ * The My Computer
key on Windows keyboards. This is often used
+ * as a generic application launcher key
+ * (APPCOMMAND_LAUNCH_APP1
).
+ */
+ Key LAUNCH_MY_COMPUTER = Key.of("LaunchMyComputer");
+
+ /**
+ * The Phone
key, to open the phone dialer application if one
+ * is present.
+ */
+ Key LAUNCH_PHONE = Key.of("LaunchPhone");
+
+ /**
+ * The Screen Saver
key.
+ */
+ Key LAUNCH_SCREEN_SAVER = Key.of("LaunchScreenSaver");
+
+ /**
+ * The Spreadsheet
key.
+ */
+ Key LAUNCH_SPREADSHEET = Key.of("LaunchSpreadsheet");
+
+ /**
+ * The Web Browser
key.
+ */
+ Key LAUNCH_WEB_BROWSER = Key.of("LaunchWebBrowser");
+
+ /**
+ * The WebCam
key. Opens the webcam application.
+ */
+ Key LAUNCH_WEB_CAM = Key.of("LaunchWebCam");
+
+ /**
+ * The Word Processor
key. This may be an icon of a specific
+ * word processor application, or a generic document icon.
+ */
+ Key LAUNCH_WORD_PROCESSOR = Key.of("LaunchWordProcessor");
+
+ /**
+ * The first generic application launcher button.
+ */
+ Key LAUNCH_APPLICATION1 = Key.of("LaunchApplication1");
+
+ /**
+ * The second generic application launcher button.
+ */
+ Key LAUNCH_APPLICATION2 = Key.of("LaunchApplication2");
+
+ /**
+ * The third generic application launcher button.
+ */
+ Key LAUNCH_APPLICATION3 = Key.of("LaunchApplication3");
+
+ /**
+ * The fourth generic application launcher button.
+ */
+ Key LAUNCH_APPLICATION4 = Key.of("LaunchApplication4");
+
+ /**
+ * The fifth generic application launcher button.
+ */
+ Key LAUNCH_APPLICATION5 = Key.of("LaunchApplication5");
+
+ /**
+ * The sixth generic application launcher button.
+ */
+ Key LAUNCH_APPLICATION6 = Key.of("LaunchApplication6");
+
+ /**
+ * The seventh generic application launcher button.
+ */
+ Key LAUNCH_APPLICATION7 = Key.of("LaunchApplication7");
+
+ /**
+ * The eighth generic application launcher button.
+ */
+ Key LAUNCH_APPLICATION8 = Key.of("LaunchApplication8");
+
+ /**
+ * The ninth generic application launcher button.
+ */
+ Key LAUNCH_APPLICATION9 = Key.of("LaunchApplication9");
+
+ /**
+ * The 10th generic application launcher button.
+ */
+ Key LAUNCH_APPLICATION10 = Key.of("LaunchApplication10");
+
+ /**
+ * The 11th generic application launcher button.
+ */
+ Key LAUNCH_APPLICATION11 = Key.of("LaunchApplication11");
+
+ /**
+ * The 12th generic application launcher button.
+ */
+ Key LAUNCH_APPLICATION12 = Key.of("LaunchApplication12");
+
+ /**
+ * The 13th generic application launcher button.
+ */
+ Key LAUNCH_APPLICATION13 = Key.of("LaunchApplication13");
+
+ /**
+ * The 14th generic application launcher button.
+ */
+ Key LAUNCH_APPLICATION14 = Key.of("LaunchApplication14");
+
+ /**
+ * The 15th generic application launcher button.
+ */
+ Key LAUNCH_APPLICATION15 = Key.of("LaunchApplication15");
+
+ /**
+ * The 16th generic application launcher button.
+ */
+ Key LAUNCH_APPLICATION16 = Key.of("LaunchApplication16");
+
+ /**
+ * Navigates to the previous content or page in the current Web view's
+ * history.
+ */
+ Key BROWSER_BACK = Key.of("BrowserBack");
+
+ /**
+ * Opens the user's list of bookmarks/favorites.
+ */
+ Key BROWSER_FAVORITES = Key.of("BrowserFavorites");
+
+ /**
+ * Navigates to the next content or page in the current Web view's history.
+ */
+ Key BROWSER_FORWARD = Key.of("BrowserForward");
+
+ /**
+ * Navigates to the user's preferred home page.
+ */
+ Key BROWSER_HOME = Key.of("BrowserHome");
+
+ /**
+ * Refreshes the current page or content.
+ */
+ Key BROWSER_REFRESH = Key.of("BrowserRefresh");
+
+ /**
+ * Activates the user's preferred search engine or the search interface
+ * within their browser.
+ */
+ Key BROWSER_SEARCH = Key.of("BrowserSearch");
+
+ /**
+ * Stops loading the currently displayed Web view or content.
+ */
+ Key BROWSER_STOP = Key.of("BrowserStop");
+
+ /**
+ * The decimal point key (typically .
or ,
)
+ * depending on the region.
+ */
+ Key DECIMAL = Key.of("Decimal");
+
+ /**
+ * The 11
key found on certain media numeric keypads.
+ */
+ Key KEY11 = Key.of("Key11");
+
+ /**
+ * The 12
key found on certain media numeric keypads.
+ */
+ Key KEY12 = Key.of("Key12");
+
+ /**
+ * The numeric keypad's multiplication key, *
.
+ */
+ Key MULTIPLY = Key.of("Multiply");
+
+ /**
+ * The numeric keypad's addition key, +
.
+ */
+ Key ADD = Key.of("Add");
+
+ /**
+ * The numeric keypad's division key, /.
+ */
+ Key DIVIDE = Key.of("Divide");
+
+ /**
+ * The numeric keypad's subtraction key, -.
+ */
+ Key SUBTRACT = Key.of("Subtract");
+
+ /**
+ * The numeric keypad's places separator character (in the United States,
+ * this is a comma, but elsewhere it is frequently a period).
+ */
+ Key SEPARATOR = Key.of("Separator");
+
+ /**
+ * Returns a {@link Key} instance for a printable representation of the key.
+ *
+ * The optional {@code additionalKeys} parameter can be used to create an + * instance which will match additional printable representations of the + * same key, in the rare cases where browsers don't agree. + *
+ * See https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
+ *
+ * @param key
+ * the printable representation of the key, not
+ * See https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
+ *
+ * @return the list of printable representations of the key
+ */
+ List
+ * See {@link Key} for common static instances or use
+ * {@link Key#of(String, String...)} to get an instance from an arbitrary
+ * value.
*
* @param key
* the key to match
* @param listener
* the listener to add, not
+ * See {@link Key} for common static instances or use
+ * {@link Key#of(String, String...)} to get an instance from an arbitrary
+ * value.
*
* @param key
* the key to match
* @param listener
* the listener to add, not
+ * See {@link Key} for common static instances or use
+ * {@link Key#of(String, String...)} to get an instance from an arbitrary
+ * value.
*
* @param key
* the key to match
* @param listener
* the listener to add, not null
+ * nor empty
+ * @param additionalKeys
+ * additional printable representations of the same key
+ * @return the {@link Key} instance
+ */
+ static Key of(String key, String... additionalKeys) {
+ Objects.requireNonNull(key);
+ if ("".equals(key)) {
+ throw new IllegalArgumentException("'key' cannot be empty");
+ }
+ Listkey
property in the
+ * JavaScript KeyboardEvent
.
+ * key
is a printable representation for this
+ * instance.
+ *
+ * @param key
+ * a printable representation of a key
+ * @return true, if key
is a printable representation for this
+ * instance
+ */
+ default boolean matches(String key) {
+ return getKeys().contains(key);
}
}
diff --git a/flow-server/src/main/java/com/vaadin/flow/component/KeyEventListener.java b/flow-server/src/main/java/com/vaadin/flow/component/KeyEventListener.java
index a6805658ab4..dfaeff9cc8b 100644
--- a/flow-server/src/main/java/com/vaadin/flow/component/KeyEventListener.java
+++ b/flow-server/src/main/java/com/vaadin/flow/component/KeyEventListener.java
@@ -31,7 +31,7 @@ public class KeyEventListenernull
* @param modifiers
- * the modifiers to match
+ * the optional modifiers to match
* @return a handle that can be used for removing the listener
*/
- default Registration addKeyDownListener(String key,
+ default Registration addKeyDownListener(Key key,
ComponentEventListenernull
* @param modifiers
- * the modifiers to match
+ * the optional modifiers to match
* @return a handle that can be used for removing the listener
*/
- default Registration addKeyPressListener(String key,
+ default Registration addKeyPressListener(Key key,
ComponentEventListenernull
* @param modifiers
- * the modifiers to match
+ * the optional modifiers to match
* @return a handle that can be used for removing the listener
*/
- default Registration addKeyUpListener(String key,
+ default Registration addKeyUpListener(Key key,
ComponentEventListener