Interface CloseHandler<C>

Type Parameters:
C - The type of the component.
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 CloseHandler<C>
Functional interface for handling close events in a component. Provides a two-phase protocol: shouldClose(C, List, Event, boolean) is called first to determine whether the close action should proceed, and onClose(Event, C) is called if it should.
  • Method Details

    • shouldClose

      static <C> boolean shouldClose(C component, List<CloseHandler<C>> closeHandler, Event event, boolean fireEvent)
      Helper method which returns the result of shouldClose(Event, Object), if fireEvent is true and a close handler has been defined, otherwise true.
    • fireEvent

      static <C> void fireEvent(C component, List<CloseHandler<C>> closeHandler, Event event, boolean fireEvent)
      Helper method which calls onClose(Event, Object), if fireEvent is true and a close handler has been defined.
    • shouldClose

      default boolean shouldClose(Event event, C component)
      Default implementation returns true
    • onClose

      void onClose(Event event, C component)
      Called if shouldClose(Event, Object) returned true