Class FullscreenBinding

java.lang.Object
com.vaadin.flow.component.fullscreen.FullscreenBinding
All Implemented Interfaces:
Serializable

public final class FullscreenBinding extends Object implements 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 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. Use enter(Component) to fullscreen a single component instead.
    • enter

      public void enter(SerializableRunnable onSuccess, SerializableConsumer<PromiseAction.Error> onError)
      Like enter() but reports the outcome back to the server.
      Parameters:
      onSuccess - UI-thread callback on success, not null
      onError - UI-thread callback on failure with the browser's error, not null
    • enter

      public void enter(Component component)
      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 component is attached: the action is wired to the trigger as soon as the component attaches.

      Parameters:
      component - the component to fullscreen, not null
    • enter

      public void enter(Component component, SerializableRunnable onSuccess, SerializableConsumer<PromiseAction.Error> onError)
      Like enter(Component) but reports the outcome back to the server.
      Parameters:
      component - the component to fullscreen, not null
      onSuccess - UI-thread callback on success, not null
      onError - UI-thread callback on failure with the browser's error, not null