Interface KeyHandler
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Handles Key events in a form of
KeyHandler.KeyHandlerArgs and returns
KeyHandler.KeyHandlerResult.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordArguments for aKeyHandler.static final recordResult from aKeyHandler. -
Method Summary
Modifier and TypeMethodDescriptionstatic KeyHandler.KeyHandlerArgsConstructKeyHandler.KeyHandlerArgsfrom aKeyEvent.Handle Key event wrapped in aKeyHandler.KeyHandlerArgs.static KeyHandlerReturns a handler that always returns a non-consumed result.static KeyHandler.KeyHandlerResultdefault KeyHandlerthenConditionally(KeyHandler other, Predicate<KeyHandler.KeyHandlerResult> predicate) Returns a composed handler that first handlesthishandler and then handlesotherhandler ifpredicateagainst result fromthismatches.default KeyHandlerthenIfConsumed(KeyHandler other) Returns a composed handler that first handlesthishandler and then handlesotherifthisconsumed an event.default KeyHandlerthenIfNotConsumed(KeyHandler other) Returns a composed handler that first handlesthishandler and then handlesotherifthisdid not consume an event.
-
Method Details
-
handle
Handle Key event wrapped in aKeyHandler.KeyHandlerArgs.- Parameters:
args- the Key handler arguments- Returns:
- a handler result
-
thenConditionally
default KeyHandler thenConditionally(KeyHandler other, Predicate<KeyHandler.KeyHandlerResult> predicate) Returns a composed handler that first handlesthishandler and then handlesotherhandler ifpredicateagainst result fromthismatches.- Parameters:
other- the handler to handle after this handlerpredicate- the predicate test against results from this- Returns:
- a composed handler
-
thenIfConsumed
Returns a composed handler that first handlesthishandler and then handlesotherifthisconsumed an event.- Parameters:
other- the handler to handle after this handler- Returns:
- a composed handler
-
thenIfNotConsumed
Returns a composed handler that first handlesthishandler and then handlesotherifthisdid not consume an event.- Parameters:
other- the handler to handle after this handler- Returns:
- a composed handler
-
neverConsume
Returns a handler that always returns a non-consumed result.- Returns:
- a handler that always returns a non-consumed result
-
argsOf
ConstructKeyHandler.KeyHandlerArgsfrom aKeyEvent.- Parameters:
event- the Key event- Returns:
- a Key handler args
-
resultOf
- Parameters:
event- the Key eventfocus- the view- Returns:
- a Key handler result
-