Class AppShellSettings


  • public class AppShellSettings
    extends Object
    Initial page settings class for modifying the application shell.
    Since:
    3.0
    • Constructor Detail

      • AppShellSettings

        public AppShellSettings()
    • Method Detail

      • getRequest

        public VaadinRequest getRequest()
        Get the current request.
        Returns:
        used request
      • getUi

        public Optional<UI> getUi()
        Get the target UI instance.
        Returns:
        ui instance
      • getBrowser

        public Optional<WebBrowser> getBrowser()
        Get the web browser used for the request used for these settings.
        Returns:
        browser information
      • setViewport

        public void setViewport​(String viewport)
        Set the viewport value. Since viewport can be set only once per page, call to this method will have preference over the Viewport annotation. If the method is called multiple times, the last one will be used.
        Parameters:
        viewport - viewport value to set
      • setBodySize

        public void setBodySize​(String width,
                                String height)
        Set the body size. If the method is called multiple times, the last one will be used.
        Parameters:
        width - body with
        height - body height
      • setPageTitle

        public void setPageTitle​(String title)
        Set the page title. If the method is called multiple times, the last one will be used.
        Parameters:
        title - title
      • addInlineFromFile

        public void addInlineFromFile​(String file,
                                      Inline.Wrapping type)
        Inline contents from classpath file to append to head of initial page.
        Parameters:
        file - dependency file to read and write to head
        type - dependency type
      • addInlineFromFile

        public void addInlineFromFile​(Inline.Position position,
                                      String file,
                                      Inline.Wrapping type)
        Inline contents from classpath file to head of initial page.
        Parameters:
        position - prepend or append
        file - dependency file to read and write to head
        type - dependency type
      • addInlineFromFile

        public void addInlineFromFile​(TargetElement target,
                                      Inline.Position position,
                                      String file,
                                      Inline.Wrapping type)
        Inline contents from classpath file to head of initial page.
        Parameters:
        target - head of body
        position - prepend or append
        file - dependency file to read and write to head
        type - dependency type
      • addInlineWithContents

        public void addInlineWithContents​(String contents,
                                          Inline.Wrapping type)
        Add content to append to head of initial page.
        Parameters:
        contents - inline content to be added to the page
        type - type of content which can be JavaScript or Stylesheet (CSS)
      • addInlineWithContents

        public void addInlineWithContents​(Inline.Position position,
                                          String contents,
                                          Inline.Wrapping type)
        Add content to head of initial page.
        Parameters:
        position - prepend or append
        contents - inline content to be added to the page
        type - type of content which can be JavaScript or Stylesheet (CSS)
      • addInlineWithContents

        public void addInlineWithContents​(TargetElement target,
                                          Inline.Position position,
                                          String contents,
                                          Inline.Wrapping type)
        Add content to the specified target of initial page.
        Parameters:
        target - head of body
        position - prepend or append
        contents - inline content to be added to the page
        type - type of content which can be JavaScript or Stylesheet (CSS)
      • addLink

        public void addLink​(String href)
        Add a link to be appended to initial page head.
        Parameters:
        href - link href
      • addLink

        public void addLink​(Inline.Position position,
                            String href)
        Add a link to initial page head.
        Parameters:
        position - prepend or append
        href - link href
      • addLink

        public void addLink​(String href,
                            Map<String,​String> attributes)
        Append a link to initial page head.
        Parameters:
        href - location of the linked document
        attributes - map of attributes for link element
      • addLink

        public void addLink​(Inline.Position position,
                            String href,
                            Map<String,​String> attributes)
        Add a link to initial page head.
        Parameters:
        position - prepend or append
        href - location of the linked document
        attributes - map of attributes for link element
      • addLink

        public void addLink​(String rel,
                            String href)
        Append a link to initial page head.
        Parameters:
        rel - link relationship
        href - location of the linked document
      • addLink

        public void addLink​(Inline.Position position,
                            String rel,
                            String href)
        Add a link to initial page head.
        Parameters:
        position - prepend or append
        rel - link relationship
        href - location of the linked document
      • addFavIcon

        public void addFavIcon​(String rel,
                               String href,
                               String sizes)
        Append a fav icon link to initial page head.
        Parameters:
        rel - link relationship
        href - location of the fav icon
        sizes - size of the linked fav icon
      • addFavIcon

        public void addFavIcon​(Inline.Position position,
                               String rel,
                               String href,
                               String sizes)
        Append a fav icon link to initial page head.
        Parameters:
        position - prepend or append
        rel - link relationship
        href - location of the fav icon
        sizes - size of the linked fav icon
      • addMetaTag

        public void addMetaTag​(String name,
                               String content)
        Add a meta tag to be appended to initial page head.
        Parameters:
        name - meta tag name
        content - meta tag content
      • addMetaTag

        public void addMetaTag​(Inline.Position position,
                               String name,
                               String content)
        Add a meta tag to initial page head.
        Parameters:
        position - prepend or append
        name - meta tag name
        content - meta tag content
      • getLoadingIndicatorConfiguration

        @Deprecated
        public Optional<LoadingIndicatorConfiguration> getLoadingIndicatorConfiguration()
        Deprecated.
        It only works when useDeprecatedV14Bootstrapping is enabled. Use a UIInitListener instead if there are server-side views.
        Returns the configuration object for loading indicator.
        Returns:
        An optional instance used for configuring the loading indicator or an empty optional if UI is not available.
        Throws:
        UnsupportedOperationException - If UI is not avaialble, for example, when using client-side bootstrapping
      • getReconnectDialogConfiguration

        @Deprecated
        public Optional<ReconnectDialogConfiguration> getReconnectDialogConfiguration()
        Deprecated.
        It only works when useDeprecatedV14Bootstrapping is enabled. Use a UIInitListener instead if there are server-side views.
        Returns the configuration object for reconnect dialog.
        Returns:
        An optional instance used for reconnect dialog configuration or an empty optional if UI is not available.
        Throws:
        UnsupportedOperationException - If UI is not avaialble, for example, when using the client-side bootstrapping
      • getPushConfiguration

        @Deprecated
        public Optional<PushConfiguration> getPushConfiguration()
        Deprecated.
        It only works when useDeprecatedV14Bootstrapping is enabled. Use a UIInitListener instead if there are server-side views.
        Returns the object used for configuring the push channel.
        Returns:
        An optional instance used for push channel configuration or an empty optional if UI is not available.
        Throws:
        UnsupportedOperationException - If UI is not avaialble, for example, when using the client-side bootstrapping