Package com.vaadin.flow.component.page
Enum Class PageVisibility
- All Implemented Interfaces:
Serializable,Comparable<PageVisibility>,Constable
The visibility state of the browser page, as reported by
Page.pageVisibilitySignal().
Distinguishes three observable states ? the page is visible and focused
(VISIBLE), visible but not focused (VISIBLE_NOT_FOCUSED),
and hidden (HIDDEN) ? plus an UNKNOWN sentinel used before
the browser has reported its first value. Use it to pause work the user
cannot see, such as polling or animations:
Page page = UI.getCurrent().getPage();
Signal.effect(this, () -> {
if (page.pageVisibilitySignal().get() == PageVisibility.HIDDEN) {
pausePolling();
} else {
resumePolling();
}
});
- Since:
- 25.2
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe page is not visible, for example when its browser tab is in the background or the window is minimized.The browser has not reported a value yet.The page is visible and currently has focus ? the user is looking at this tab and it is the active window.The page is visible but does not have focus, for example when it sits behind another window or the user is interacting with a different application. -
Method Summary
Modifier and TypeMethodDescriptionstatic PageVisibilityReturns the enum constant of this class with the specified name.static PageVisibility[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
UNKNOWN
The browser has not reported a value yet. This is only the signal's initial value before the first client round-trip completes; in practice a real value is in place before any application code runs, and the signal never returns toUNKNOWNonce it has a real value. Treat it as "not known yet" if you ever observe it. -
VISIBLE
The page is visible and currently has focus ? the user is looking at this tab and it is the active window. -
VISIBLE_NOT_FOCUSED
The page is visible but does not have focus, for example when it sits behind another window or the user is interacting with a different application. -
HIDDEN
The page is not visible, for example when its browser tab is in the background or the window is minimized.
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-