Class KeyboardEvent
java.lang.Object
java.util.EventObject
com.vaadin.flow.component.ComponentEvent<LeafletMap>
org.vaadin.addons.componentfactory.leaflet.layer.events.LeafletEvent
org.vaadin.addons.componentfactory.leaflet.layer.events.KeyboardEvent
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
KeyDownEvent,KeyPressEvent,KeyUpEvent
Base class for keyboard events fired by a
LeafletMap when the user interacts with the
keyboard while the map is focused. Holds the details of the key that triggered the event as well
as the state of the modifier keys.- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionKeyboardEvent(LeafletMap source, boolean fromClient, String layerId, KeyboardEventType eventType, String key, String code, int keyCode, boolean ctrlKey, boolean shiftKey, boolean altKey) Creates a new keyboard event. -
Method Summary
Modifier and TypeMethodDescriptiongetCode()Returns the code of the key that triggered the eventgetKey()Returns the key value of the key represented by the eventintReturns the Unicode character code of the key that triggered the onkeypress event, or the Unicode key code of the key that triggered the onkeydown or onkeyup eventbooleanisAltKey()Returns whether the "ALT" key was pressed when the key event was triggeredbooleanReturns whether the "CTRL" key was pressed when the key event was triggeredbooleanReturns whether the "SHIFT" key was pressed when the key event was triggeredtoString()Methods inherited from class org.vaadin.addons.componentfactory.leaflet.layer.events.LeafletEvent
getLayerId, getTypeMethods inherited from class com.vaadin.flow.component.ComponentEvent
getSource, getUI, isFromClient, unregisterListener
-
Constructor Details
-
KeyboardEvent
public KeyboardEvent(LeafletMap source, boolean fromClient, String layerId, KeyboardEventType eventType, String key, String code, int keyCode, boolean ctrlKey, boolean shiftKey, boolean altKey) Creates a new keyboard event.- Parameters:
source- the map that fired the eventfromClient-trueif the event originated from the client sidelayerId- the identifier of the layer the event is associated witheventType- the type of keyboard eventkey- the key value of the key represented by the eventcode- the code of the key that triggered the eventkeyCode- the Unicode character or key code of the key that triggered the eventctrlKey- whether the "CTRL" key was pressed when the event was triggeredshiftKey- whether the "SHIFT" key was pressed when the event was triggeredaltKey- whether the "ALT" key was pressed when the event was triggered
-
-
Method Details
-
getCode
Returns the code of the key that triggered the event- Returns:
- the code
-
getKey
Returns the key value of the key represented by the event- Returns:
- the key
-
getKeyCode
public int getKeyCode()Returns the Unicode character code of the key that triggered the onkeypress event, or the Unicode key code of the key that triggered the onkeydown or onkeyup event- Returns:
- the keyCode
-
isShiftKey
public boolean isShiftKey()Returns whether the "SHIFT" key was pressed when the key event was triggered- Returns:
- the shiftKey
-
isAltKey
public boolean isAltKey()Returns whether the "ALT" key was pressed when the key event was triggered- Returns:
- the altKey
-
isCtrlKey
public boolean isCtrlKey()Returns whether the "CTRL" key was pressed when the key event was triggered- Returns:
- the ctrlKey
-
toString
- Overrides:
toStringin classLeafletEvent
-