com.vaadin.annotations.

Annotation Type HtmlImport

  • @Retention(RUNTIME)
    @Target(TYPE)
    @Documented
    @Repeatable(InternalContainerAnnotationForHtml.class)
    public @interface HtmlImport

    If this annotation is present on a ClientConnector class, the framework ensures the referenced HTML imports are loaded before the init method for the corresponding client-side connector is invoked.

    Note that not all browsers yet support HTML imports. If a polyfill is needed to load HTML imports, it must be loaded before HTML Imports can be loaded. There is no automatic loading of any polyfill.

    • Relative URLs are mapped to APP/PUBLISHED/[url] which are by default served from the classpath relative to the class where the annotation is defined.
    • Absolute URLs including protocol and host are used as is on the client-side.

    Note that you should (almost) always use URLs starting with frontend:// so that the framework can resolve the files to either VAADIN/frontend/es5 or VAADIN/frontend/es6 depending on if the browser supports ES6 classes (most browers) or not (IE11 and Safari <= 9). Polymer elements rely on importing dependencies using relative paths ../../other-element/other-element.html, which will not work if they are installed in different locations.

    HTML imports are added to the page after any @JavaScript dependencies added at the same time.

    Example: @HtmlImport("frontend://paper-slider/paper-slider.html") on the class com.example.MyConnector would load the file http://host.com/VAADIN/frontend/es[56]/paper-slider/paper-slider.html before the init() method of the client side connector is invoked.

    Since:

    8.0

    Author:

    Vaadin Ltd

    • Required Element Summary

      Required Elements
      Modifier and Type Required Element Description
      String[] value

      HTML file URL(s) to load before using the annotated ClientConnector in the browser.

    • Element Detail

      • value

        String[] value

        HTML file URL(s) to load before using the annotated ClientConnector in the browser.

        Returns:

        html file URL(s) to load