Interface MouseHandler

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface MouseHandler
Handles mouse events in a form of MouseHandler.MouseHandlerArgs and returns MouseHandler.MouseHandlerResult. Typically used in a View. MouseHandler itself don't define any restrictions how it's used.
  • Method Details

    • handle

      Handle mouse event wrapped in a MouseHandler.MouseHandlerArgs.
      Parameters:
      args - the mouse handler arguments
      Returns:
      a handler result
    • thenConditionally

      default MouseHandler thenConditionally(MouseHandler other, Predicate<MouseHandler.MouseHandlerResult> predicate)
      Returns a composed handler that first handles this handler and then handles other handler if predicate against result from this matches.
      Parameters:
      other - the handler to handle after this handler
      predicate - the predicate test against results from this
      Returns:
      a composed handler
    • thenIfConsumed

      default MouseHandler thenIfConsumed(MouseHandler other)
      Returns a composed handler that first handles this handler and then handles other if this consumed an event.
      Parameters:
      other - the handler to handle after this handler
      Returns:
      a composed handler
    • thenIfNotConsumed

      default MouseHandler thenIfNotConsumed(MouseHandler other)
      Returns a composed handler that first handles this handler and then handles other if this did not consume an event.
      Parameters:
      other - the handler to handle after this handler
      Returns:
      a composed handler
    • neverConsume

      static MouseHandler neverConsume()
      Returns a handler that always returns a non-consumed result.
      Returns:
      a handler that always returns a non-consumed result
    • argsOf

      Parameters:
      event - the mouse event
      Returns:
      a mouse handler args
    • resultOf

      static MouseHandler.MouseHandlerResult resultOf(MouseEvent event, boolean consumed, View focus, View capture)
      Parameters:
      event - the mouse event
      consumed - flag telling if event was consumed
      focus - the view which is requesting focus
      capture - the view which captured an event
      Returns:
      a mouse handler result