Enum Class PageVisibility

java.lang.Object
java.lang.Enum<PageVisibility>
com.vaadin.flow.component.page.PageVisibility
All Implemented Interfaces:
Serializable, Comparable<PageVisibility>, Constable

public enum PageVisibility extends Enum<PageVisibility>
Represents the visibility state of a browser page.

Uses the browser's Page Visibility API (document.hidden) combined with document.hasFocus() to distinguish between three states: fully visible and focused, visible but not focused (e.g. behind another window), and hidden (e.g. background tab or minimized window).

See Also:
  • Enum Constant Details

    • VISIBLE

      public static final PageVisibility VISIBLE
      The page is visible and focused.

      In the browser, this means !document.hidden and document.hasFocus() is true.

    • VISIBLE_NOT_FOCUSED

      public static final PageVisibility VISIBLE_NOT_FOCUSED
      The page is visible but not focused, e.g. behind another window.

      In the browser, this means !document.hidden and document.hasFocus() is false.

    • HIDDEN

      public static final PageVisibility HIDDEN
      The page is not visible, e.g. the browser tab is in the background or the window is minimized.

      In the browser, this is indicated by document.hidden being true.

  • Method Details

    • values

      public static PageVisibility[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static PageVisibility valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null