Class NativeKeyboardEvent
- java.lang.Object
-
- org.pepstock.charba.client.dom.events.NativeBaseEvent
-
- org.pepstock.charba.client.dom.events.NativeUIEvent
-
- org.pepstock.charba.client.dom.events.NativeKeyboardEvent
-
- All Implemented Interfaces:
IsJSType
,IsCastable
@JsType(isNative=true, name="KeyboardEvent", namespace="<global>") public final class NativeKeyboardEvent extends NativeUIEvent
Describes a user interaction with the keyboard; each event describes a single interaction between the user and a key (or combination of a key with modifier keys) on the keyboard.
The event type (keydown or keyup) identifies what kind of keyboard activity occurred.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static NativeKeyboardEvent
createKeyboardEvent(String type)
Creates a new event object for a specific event type.static NativeKeyboardEvent
createKeyboardEvent(String type, KeyboardEventInit init)
Creates a new event object for a specific event type with initial configuration.static NativeKeyboardEvent
createKeyboardEvent(IsEvent type)
Creates a new event object for a specific event type.static NativeKeyboardEvent
createKeyboardEvent(IsEvent type, KeyboardEventInit init)
Creates a new event object for a specific event type with initial configuration.String
getCode()
Returns a physical key on the keyboard (as opposed to the character generated by pressing the key).
In other words, this property returns a value that isn't altered by keyboard layout or the state of the modifier keys.String
getKey()
Returns the value of the key pressed by the user, taking into consideration the state of modifier keys as well as the keyboard locale and layout.KeyboardLocation
getLocation()
Returns the location of the key on the keyboard or other input device.boolean
isAltKey()
Returns true if the alt key was down when the mouse event was fired.boolean
isCtrlKey()
Returns true if the control key was down when the mouse event was fired.boolean
isMetaKey()
Returns true if the meta key was down when the mouse event was fired.boolean
isRepeat()
Returns a boolean value that is true if the given key is being held down such that it is automatically repeating.boolean
isShiftKey()
Returns true if the shift key was down when the mouse event was fired.-
Methods inherited from class org.pepstock.charba.client.dom.events.NativeUIEvent
getDetail, getModifierState
-
Methods inherited from class org.pepstock.charba.client.dom.events.NativeBaseEvent
createEvent, createEvent, createEvent, createEvent, getCurrentTarget, getEventPhase, getTarget, getType, isBubbles, isCancelable, isDefaultPrevented, preventDefault, stopImmediatePropagation, stopPropagation
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pepstock.charba.client.dom.IsCastable
as
-
-
-
-
Method Detail
-
getKey
@JsProperty public String getKey()
Returns the value of the key pressed by the user, taking into consideration the state of modifier keys as well as the keyboard locale and layout.- Returns:
- the value of the key pressed by the user, taking into consideration the state of modifier keys as well as the keyboard locale and layout.
-
getCode
@JsProperty public String getCode()
Returns a physical key on the keyboard (as opposed to the character generated by pressing the key).
In other words, this property returns a value that isn't altered by keyboard layout or the state of the modifier keys.- Returns:
- a physical key on the keyboard (as opposed to the character generated by pressing the key)
-
isRepeat
@JsProperty public boolean isRepeat()
Returns a boolean value that is true if the given key is being held down such that it is automatically repeating.- Returns:
- a boolean value that is true if the given key is being held down such that it is automatically repeating
-
isAltKey
@JsProperty public boolean isAltKey()
Returns true if the alt key was down when the mouse event was fired.- Returns:
- true if the alt key was down when the mouse event was fired
-
isCtrlKey
@JsProperty public boolean isCtrlKey()
Returns true if the control key was down when the mouse event was fired.- Returns:
- true if the control key was down when the mouse event was fired
-
isMetaKey
@JsProperty public boolean isMetaKey()
Returns true if the meta key was down when the mouse event was fired.- Returns:
- true if the meta key was down when the mouse event was fired
-
isShiftKey
@JsProperty public boolean isShiftKey()
Returns true if the shift key was down when the mouse event was fired.- Returns:
- true if the shift key was down when the mouse event was fired
-
createKeyboardEvent
@JsOverlay public static NativeKeyboardEvent createKeyboardEvent(String type)
Creates a new event object for a specific event type.- Parameters:
type
- type of event- Returns:
- a new event object for a specific event type
-
createKeyboardEvent
@JsOverlay public static NativeKeyboardEvent createKeyboardEvent(IsEvent type)
Creates a new event object for a specific event type.- Parameters:
type
- type of event- Returns:
- a new event object for a specific event type
-
createKeyboardEvent
@JsOverlay public static NativeKeyboardEvent createKeyboardEvent(IsEvent type, KeyboardEventInit init)
Creates a new event object for a specific event type with initial configuration.- Parameters:
type
- type of eventinit
- initial configuration of the event- Returns:
- a new event object for a specific event type
-
createKeyboardEvent
@JsOverlay public static NativeKeyboardEvent createKeyboardEvent(String type, KeyboardEventInit init)
Creates a new event object for a specific event type with initial configuration.- Parameters:
type
- type of eventinit
- initial configuration of the event- Returns:
- a new event object for a specific event type
-
getLocation
@JsOverlay public KeyboardLocation getLocation()
Returns the location of the key on the keyboard or other input device.- Returns:
- the location of the key on the keyboard or other input device
-
-