Class InputEvent
java.lang.Object
java.util.EventObject
java.awt.AWTEvent
vaadinx.awt.event.ComponentEvent
vaadinx.awt.event.InputEvent
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
KeyEvent, MouseEvent
Port of
InputEvent. Abstract parent of
MouseEvent and KeyEvent. Extends our ComponentEvent
— AWT does the same — so the instanceof chain from our leaf event
up to ComponentEvent still walks through InputEvent as users expect.
Modifier constants (the *_DOWN_MASK set) have identical values to
AWT's so bit arithmetic carries across. The legacy *_MASK set
(deprecated since JDK 9) is kept for user code that hasn't migrated yet.
Static utilities delegate to java.awt.event.InputEvent — constants
are compatible, so there's no point re-deriving the logic.
Consuming an event marks it; it does not suppress anything
consume() / isConsumed() are ported faithfully and the flag
round-trips across listeners exactly as in Swing — the "listener A consumes,
listener B checks" idiom works unchanged. What consuming cannot do here
is cancel the platform's default action: in Swing, consuming a
KEY_PRESSED in a text field stops the character being inserted,
whereas the browser has already inserted it by the time the keystroke reaches
the server. Nothing in this emulator runs after listener notification
for a consume to gate — see Component.processKeyEvent — so the flag is
read-back state, not a veto. R_match_swing_errors sub-bucket (c), documented rather than WARNed:
the storage half is exactly faithful, so an onUnimplemented on every
consume() call would be both wrong and deafening. See D_event_consume.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intDeprecated.static final intDeprecated.static final intstatic final intDeprecated.static final intstatic final intDeprecated.static final intstatic final intDeprecated.static final intstatic final intDeprecated.static final intstatic final intDeprecated.static final intstatic final intDeprecated.Fields inherited from class ComponentEvent
COMPONENT_FIRST, COMPONENT_HIDDEN, COMPONENT_LAST, COMPONENT_MOVED, COMPONENT_RESIZED, COMPONENT_SHOWNFields inherited from class AWTEvent
ACTION_EVENT_MASK, ADJUSTMENT_EVENT_MASK, COMPONENT_EVENT_MASK, consumed, CONTAINER_EVENT_MASK, FOCUS_EVENT_MASK, HIERARCHY_BOUNDS_EVENT_MASK, HIERARCHY_EVENT_MASK, id, INPUT_METHOD_EVENT_MASK, INVOCATION_EVENT_MASK, ITEM_EVENT_MASK, KEY_EVENT_MASK, MOUSE_EVENT_MASK, MOUSE_MOTION_EVENT_MASK, MOUSE_WHEEL_EVENT_MASK, PAINT_EVENT_MASK, RESERVED_ID_MAX, TEXT_EVENT_MASK, WINDOW_EVENT_MASK, WINDOW_FOCUS_EVENT_MASK, WINDOW_STATE_EVENT_MASKFields inherited from class EventObject
source -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInputEvent(Component source, int id, long when, int modifiers) -
Method Summary
Modifier and TypeMethodDescriptionvoidconsume()Marks this event consumed.static intgetMaskForButton(int button) Bit mask for a 1-indexed button (1 → BUTTON1_DOWN_MASK, …).intDeprecated.intstatic StringgetModifiersExText(int modifiers) Localised "Shift+Ctrl+Button1" string for a modifiersEx value.longgetWhen()booleanbooleanbooleanbooleanbooleanbooleanMethods inherited from class ComponentEvent
getComponent, paramStringMethods inherited from class EventObject
getSource
-
Field Details
-
SHIFT_MASK
-
CTRL_MASK
-
META_MASK
-
ALT_MASK
-
ALT_GRAPH_MASK
-
BUTTON1_MASK
-
BUTTON2_MASK
-
BUTTON3_MASK
-
SHIFT_DOWN_MASK
public static final int SHIFT_DOWN_MASK- See Also:
-
CTRL_DOWN_MASK
public static final int CTRL_DOWN_MASK- See Also:
-
META_DOWN_MASK
public static final int META_DOWN_MASK- See Also:
-
ALT_DOWN_MASK
public static final int ALT_DOWN_MASK- See Also:
-
BUTTON1_DOWN_MASK
public static final int BUTTON1_DOWN_MASK- See Also:
-
BUTTON2_DOWN_MASK
public static final int BUTTON2_DOWN_MASK- See Also:
-
BUTTON3_DOWN_MASK
public static final int BUTTON3_DOWN_MASK- See Also:
-
ALT_GRAPH_DOWN_MASK
public static final int ALT_GRAPH_DOWN_MASK- See Also:
-
-
Constructor Details
-
InputEvent
-
-
Method Details
-
getWhen
public long getWhen() -
getModifiers
Deprecated.Legacy modifiers (deprecated). Real AWT stored two fields; we store the extended set and return it unchanged — user code checking specific bits should usegetModifiersEx()with the*_DOWN_MASKconstants anyway. -
getModifiersEx
public int getModifiersEx() -
isShiftDown
public boolean isShiftDown() -
isControlDown
public boolean isControlDown() -
isMetaDown
public boolean isMetaDown() -
isAltDown
public boolean isAltDown() -
isAltGraphDown
public boolean isAltGraphDown() -
consume
public void consume()Marks this event consumed. Public here, as in the JDK —AWTEventdeclares itprotectedand conditional on the event id, andInputEventwidens it and drops the condition.Sets the flag and nothing more; see the class javadoc for what that does and does not buy you.
-
isConsumed
public boolean isConsumed()- Overrides:
isConsumedin classAWTEvent- Returns:
- whether
consume()has been called on this event
-
getMaskForButton
public static int getMaskForButton(int button) Bit mask for a 1-indexed button (1 → BUTTON1_DOWN_MASK, …). Delegates to AWT — the constants match, and any bounds handling stays centralised. -
getModifiersExText
Localised "Shift+Ctrl+Button1" string for a modifiersEx value. Delegates to AWT — constants match and the formatting is locale-aware.
-