Annotation Type Connect


  • @Retention(RUNTIME)
    @Target(TYPE)
    public @interface Connect
    Annotation defining the server side connector that this ClientSideConnector should connect to. The value must always by a class extending ClientConnector.

    With this annotation client side Vaadin connector is marked to have a server side counterpart. The value of the annotation is the class of server side implementation.

    Since:
    7.0
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      Class<? extends Connector> value  
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      Connect.LoadStyle loadStyle
      Depending on the used WidgetMap generator, these optional hints may be used to define how the client side components are loaded by the browser.
    • Element Detail

      • value

        Class<? extends Connector> value
        Returns:
        the server side counterpart for the annotated component connector
      • loadStyle

        Connect.LoadStyle loadStyle
        Depending on the used WidgetMap generator, these optional hints may be used to define how the client side components are loaded by the browser. The default is to eagerly load all widgets com.vaadin.server.widgetsetutils.EagerWidgetMapGenerator, but if the com.vaadin.server.widgetsetutils.WidgetMapGenerator is used by the widgetset, these load style hints are respected.

        Lazy loading of a widget implementation means the client side component is not included in the initial JavaScript application loaded when the application starts. Instead the implementation is loaded to the client when it is first needed. Lazy loaded widget can be achieved by giving Connect.LoadStyle.LAZY value in Connect annotation.

        Lazy loaded widgets don't stress the size and startup time of the client side as much as eagerly loaded widgets. On the other hand there is a slight latency when lazy loaded widgets are first used as the client side needs to visit the server to fetch the client side implementation.

        The Connect.LoadStyle.DEFERRED will also not stress the initially loaded JavaScript file. If this load style is defined, the widget implementation is preemptively loaded to the browser after the application is started and the communication to server idles. This load style kind of combines the best of both worlds.

        Fine tunings to widget loading can also be made by overriding com.vaadin.server.widgetsetutils.WidgetMapGenerator in the GWT module. Tunings might be helpful if the end users have slow connections and especially if they have high latency in their network. The com.vaadin.server.widgetsetutils.CustomWidgetMapGenerator is an abstract generator implementation for easy customization. Vaadin package also includes com.vaadin.server.widgetsetutils.LazyWidgetMapGenerator that makes as many widgets lazily loaded as possible.

        Returns:
        the hint for the widget set generator how the client side implementation should be loaded to the browser
        Since:
        6.4
        Default:
        com.vaadin.shared.ui.Connect.LoadStyle.EAGER