Interface FocusModel<K>

Type Parameters:
K - the focus key type
All Known Implementing Classes:
SimpleKeyedFocusModel

public interface FocusModel<K>
Manages the state of individual foci in a widget. Each instance should be specific to one widget.
Since:
7.0.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a stream of all foci in the target widget.
    boolean
    isFocused(Focus<K> focus)
    Checks if a focus is focused in the target widget.
    void
    setFocused(Focus<K> focus)
    Applies a focus to the target widget.
    static FocusModel<?>
    simple(WWidget widget)
    Creates a simple focus model for a focusable widget.
  • Method Details

    • isFocused

      boolean isFocused(Focus<K> focus)
      Checks if a focus is focused in the target widget. If the target widget is not focused itself, none of its foci should have focus.
      Parameters:
      focus - the focus to check
      Returns:
      true if the focus is focused, false otherwise
    • setFocused

      void setFocused(Focus<K> focus)
      Applies a focus to the target widget.

      This method does not need to request the GUI's focus for the widget; that is the responsibility of the caller.

      Parameters:
      focus - the focus
    • foci

      Stream<Focus<K>> foci()
      Returns a stream of all foci in the target widget.
      Returns:
      a stream of all foci in the target widget
    • simple

      static FocusModel<?> simple(WWidget widget)
      Creates a simple focus model for a focusable widget. The focus model provides the whole widget area as its only focus area.
      Parameters:
      widget - the widget
      Returns:
      the focus model