Class FullscreenBinding
java.lang.Object
com.vaadin.flow.component.fullscreen.FullscreenBinding
- All Implemented Interfaces:
Serializable
Fluent surface returned from
Fullscreen.onClick(T). Each enter
action attaches one RequestFullscreenAction to the underlying
Trigger.
Actions come in two flavours: fire-and-forget (no callbacks) and observed
(with onSuccess/onError callbacks). onError receives
an PromiseAction.Error record with the browser's error name and message — the
spec-documented rejection is NotAllowedError (no gesture /
permissions policy). Both consumers are required in the observed form — pass
() -> {} or err -> {} to opt out of one.
Button fullscreenButton = new Button("Fullscreen");
Fullscreen.onClick(fullscreenButton).enter(videoPanel,
() -> Notification.show("Entered fullscreen"), err -> Notification
.show("Could not enter fullscreen: " + err.message()));
Component fullscreen moves the target into a Vaadin wrapper element so that
themes and overlay components (Notification, ComboBox popups, …) keep working
while fullscreen is active. The component is restored to its original
position when fullscreen exits, whether via Fullscreen.exit(), the
user pressing Escape, or a later request superseding this one.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidenter()Enters fullscreen for the entire page (document.documentElement) when the underlying trigger fires.voidEnters fullscreen for the given component when the underlying trigger fires.voidenter(Component component, SerializableRunnable onSuccess, SerializableConsumer<PromiseAction.Error> onError) Likeenter(Component)but reports the outcome back to the server.voidenter(SerializableRunnable onSuccess, SerializableConsumer<PromiseAction.Error> onError) Likeenter()but reports the outcome back to the server.
-
Method Details
-
enter
public void enter()Enters fullscreen for the entire page (document.documentElement) when the underlying trigger fires. Themes and overlay components work correctly in this mode. Useenter(Component)to fullscreen a single component instead. -
enter
public void enter(SerializableRunnable onSuccess, SerializableConsumer<PromiseAction.Error> onError) Likeenter()but reports the outcome back to the server.- Parameters:
onSuccess- UI-thread callback on success, notnullonError- UI-thread callback on failure with the browser's error, notnull
-
enter
Enters fullscreen for the given component when the underlying trigger fires. The component is moved into a Vaadin wrapper element and the rest of the view is hidden so themes and overlay components keep working. The component is restored to its original DOM position when fullscreen exits.Safe to call before
componentis attached: the action is wired to the trigger as soon as the component attaches.- Parameters:
component- the component to fullscreen, notnull
-
enter
public void enter(Component component, SerializableRunnable onSuccess, SerializableConsumer<PromiseAction.Error> onError) Likeenter(Component)but reports the outcome back to the server.- Parameters:
component- the component to fullscreen, notnullonSuccess- UI-thread callback on success, notnullonError- UI-thread callback on failure with the browser's error, notnull
-