Class MockPage

java.lang.Object
com.vaadin.flow.component.page.Page
com.vaadin.browserless.internal.MockPage
All Implemented Interfaces:
Serializable

public final class MockPage extends Page
A Page which records the external navigations and recreates the UI on reload(), to simulate the browser's F5.

For internal use only. May be renamed or removed in a future release.

See Also:
  • Constructor Details

    • MockPage

      public MockPage(UI ui, UIFactory uiFactory, VaadinSession session)
      Creates the page of the given UI.
      Parameters:
      ui - the UI the page belongs to
      uiFactory - creates the UI that replaces this one on a reload
      session - the session of the UI
  • Method Details

    • getLastExternalNavigationURL

      public String getLastExternalNavigationURL()
      Returns the URL the page last navigated to in its own window.
      Returns:
      the URL, or null if the page has not navigated away
    • getExternalNavigationURL

      public String getExternalNavigationURL(String windowName)
      Returns the URL last opened in the given window.
      Parameters:
      windowName - the name of the window
      Returns:
      the URL, or null if nothing was opened in that window
    • getOpenedWindows

      public Map<String,List<String>> getOpenedWindows()
      Returns the URLs opened in windows other than the page's own, by window name.
      Returns:
      the opened URLs, by window name
    • open

      public void open(String url, String windowName)
      Description copied from class: Page
      Opens the given URL in a window with the given name.

      The supplied windowName is used as the target name in a window.open call in the client. This means that special values such as "_blank", "_self", "_top", "_parent" have special meaning. An empty or null window name is also a special case.

      "", null and "_self" as windowName all causes the URL to be opened in the current window, replacing any old contents. For downloadable content you should avoid "_self" as "_self" causes the client to skip rendering of any other changes as it considers them irrelevant (the page will be replaced by the response from the URL). This can speed up the opening of a URL, but it might also put the client side into an inconsistent state if the window content is not completely replaced e.g., if the URL is downloaded instead of displayed in the browser.

      "_blank" as windowName causes the URL to always be opened in a new window or tab (depends on the browser and browser settings).

      "_top" and "_parent" as windowName works as specified by the HTML standard.

      Any other windowName will open the URL in a window with that name, either by opening a new window/tab in the browser or by replacing the contents of an existing window with that name.

      Overrides:
      open in class Page
      Parameters:
      url - the URL to open.
      windowName - the name of the window.
    • reload

      public void reload()
      Description copied from class: Page
      Reloads the page in the browser.
      Overrides:
      reload in class Page