Class KeyboardEventInit
- java.lang.Object
-
- org.pepstock.charba.client.commons.NativeObjectContainer
-
- org.pepstock.charba.client.dom.events.EventInit
-
- org.pepstock.charba.client.dom.events.KeyboardEventInit
-
public final class KeyboardEventInit extends EventInit
Initialization object for aNativeKeyboardEvent
.- Author:
- Andrea "Stock" Stocchero
-
-
Constructor Summary
Constructors Constructor Description KeyboardEventInit()
Creates an empty objectKeyboardEventInit(String key)
Creates an initialization object, setting the keyboard key value.KeyboardEventInit(NativeKeyboardEvent source)
Creates an initialization object, cloning all source event data
-
Method Summary
All Methods Instance Methods Concrete Methods Default Methods Modifier and Type Method Description String
getCode()
Returns a string, defaulting to "", that sets the value ofNativeKeyboardEvent
code, represents a physical key on the keyboard (as opposed to the character generated by pressing the key).int
getDetail()
When non-zero, provides the current (or next, depending on the event) click count.
For click events, is the current click count.
For mousedown or mouseup events, is 1 plus the current click count.
For all other, is always zero.String
getKey()
Returns a string, defaulting to "", that sets the value ofNativeKeyboardEvent
key, the value of the key pressed by the user.KeyboardLocation
getLocation()
Returns the location of the key on the keyboard or other input device.org.pepstock.charba.client.dom.events.ModifiersHandler
getModifiersHandler()
default boolean
isAltKey()
Returns true if the alt key was down when the mouse event was fired.default boolean
isCtrlKey()
Returns true if the control key was down when the mouse event was fired.default 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.default boolean
isShiftKey()
Returns true if the shift key was down when the mouse event was fired.default void
setAltKey(boolean alt)
Sets true if the alt key was down when the mouse event was fired.void
setCode(String code)
Sets a string that sets the value ofNativeKeyboardEvent
code, represents a physical key on the keyboard (as opposed to the character generated by pressing the key).default void
setCtrlKey(boolean ctrl)
Sets true if the control key was down when the mouse event was fired.void
setDetail(int detail)
Sets non-zero, provides the current (or next, depending on the event) click count.
For click events, is the current click count.
For mousedown or mouseup events, is 1 plus the current click count.
For all other, is always zerovoid
setKey(String key)
Sets a string that sets the value ofNativeKeyboardEvent
key, the value of the key pressed by the uservoid
setLocation(KeyboardLocation location)
Sets the location of the key on the keyboard or other input device.default void
setMetaKey(boolean meta)
Sets true if the meta key was down when the mouse event was fired.void
setRepeat(boolean repeat)
Sets a boolean value that is true if the given key is being held down such that it is automatically repeating.default void
setShiftKey(boolean shift)
Sets true if the shift key was down when the mouse event was fired.-
Methods inherited from class org.pepstock.charba.client.dom.events.EventInit
isBubbles, isCancelable, setBubbles, setCancelable
-
Methods inherited from class org.pepstock.charba.client.commons.NativeObjectContainer
checkAndGetColor, checkDefaultValuesArgument, empty, getArrayValue, getElement, getIncrementalId, getNativeChart, getNativeEvent, getNativeObject, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, has, has, isType, keys, loadNativeObject, remove, remove, setArrayValue, setArrayValue, setArrayValue, setElement, setEmptyValue, setNewIncrementalId, setNewIncrementalId, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, type
-
-
-
-
Constructor Detail
-
KeyboardEventInit
public KeyboardEventInit()
Creates an empty object
-
KeyboardEventInit
public KeyboardEventInit(String key)
Creates an initialization object, setting the keyboard key value.- Parameters:
key
- keyboard key initialization property.
-
KeyboardEventInit
public KeyboardEventInit(NativeKeyboardEvent source)
Creates an initialization object, cloning all source event data- Parameters:
source
- source event to clone.
-
-
Method Detail
-
getModifiersHandler
public org.pepstock.charba.client.dom.events.ModifiersHandler getModifiersHandler()
-
getKey
public String getKey()
Returns a string, defaulting to "", that sets the value ofNativeKeyboardEvent
key, the value of the key pressed by the user.- Returns:
- a string, defaulting to "", that sets the value of
NativeKeyboardEvent
key, the value of the key pressed by the user
-
setKey
public void setKey(String key)
Sets a string that sets the value ofNativeKeyboardEvent
key, the value of the key pressed by the user- Parameters:
key
- a string that sets the value ofNativeKeyboardEvent
key, the value of the key pressed by the user
-
getCode
public String getCode()
Returns a string, defaulting to "", that sets the value ofNativeKeyboardEvent
code, represents a physical key on the keyboard (as opposed to the character generated by pressing the key).- Returns:
- a string, defaulting to "", that sets the value of
NativeKeyboardEvent
code, represents a physical key on the keyboard (as opposed to the character generated by pressing the key)
-
setCode
public void setCode(String code)
Sets a string that sets the value ofNativeKeyboardEvent
code, represents a physical key on the keyboard (as opposed to the character generated by pressing the key).- Parameters:
code
- a string that sets the value ofNativeKeyboardEvent
code, represents a physical key on the keyboard (as opposed to the character generated by pressing the key)
-
getLocation
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
-
setLocation
public void setLocation(KeyboardLocation location)
Sets the location of the key on the keyboard or other input device.- Parameters:
location
- the location of the key on the keyboard or other input device
-
isRepeat
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
-
setRepeat
public void setRepeat(boolean repeat)
Sets a boolean value that is true if the given key is being held down such that it is automatically repeating.- Parameters:
repeat
- a boolean value that is true if the given key is being held down such that it is automatically repeating
-
isAltKey
public default 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
-
setAltKey
public default void setAltKey(boolean alt)
Sets true if the alt key was down when the mouse event was fired.- Parameters:
alt
- true if the alt key was down when the mouse event was fired
-
isCtrlKey
public default 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
-
setCtrlKey
public default void setCtrlKey(boolean ctrl)
Sets true if the control key was down when the mouse event was fired.- Parameters:
ctrl
- true if the control key was down when the mouse event was fired
-
isMetaKey
public default 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
-
setMetaKey
public default void setMetaKey(boolean meta)
Sets true if the meta key was down when the mouse event was fired.- Parameters:
meta
- true if the meta key was down when the mouse event was fired
-
isShiftKey
public default 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
-
setShiftKey
public default void setShiftKey(boolean shift)
Sets true if the shift key was down when the mouse event was fired.- Parameters:
shift
- true if the shift key was down when the mouse event was fired
-
getDetail
public final int getDetail()
When non-zero, provides the current (or next, depending on the event) click count.
For click events, is the current click count.
For mousedown or mouseup events, is 1 plus the current click count.
For all other, is always zero.- Returns:
- When non-zero, provides the current (or next, depending on the event) click count.
For click events, is the current click count.
For mousedown or mouseup events, is 1 plus the current click count.
For all other, is always zero
-
setDetail
public final void setDetail(int detail)
Sets non-zero, provides the current (or next, depending on the event) click count.
For click events, is the current click count.
For mousedown or mouseup events, is 1 plus the current click count.
For all other, is always zero- Parameters:
detail
- non-zero, provides the current (or next, depending on the event) click count.
For click events, is the current click count.
For mousedown or mouseup events, is 1 plus the current click count.
For all other, is always zero
-
-