Documentation

Documentation versions (currently viewingVaadin 23)

You are viewing documentation for Vaadin 23. View latest documentation

Custom Widget Set and MPR

By default there is no need for a custom widget set as MPR functions by using the AppWidgetset that’s automatically built and configured by scanning the dependencies. For more information on the AppWidgetset and widget set compilation see Add-ons and Widget Set part of application environment.

Note
When using MPR you can ’t use Content Delivery Network (CDN) for the widget set. This means that the configuration <vaadin.widgetset.mode>cdn</vaadin.widgetset.mode> should be removed.

To use a custom widget set for the legacy framework embedded with MPR, add MprWidgetset annotation to your AppShellConfigurator configuration class.

@MprWidgetset("com.vaadin.mpr.DemoWidgetset")
public class Configuration implements AppShellConfigurator {
}

public class MainLayout extends Div implements RouterLayout {
}

@Route(value = "", layout = MainLayout.class)
public class RootTarget extends Div {
    public RootTarget() {
      LegacyWrapper addressbookWrapper = new LegacyWrapper(
                  new AddressbookLayout());
      add(addressbookWrapper);
    }
}

The AppWidgetset contains widget sets things found by scanning the dependencies, but at times you might only want to have specific widget sets included or you have the need for an optimized widget set with eager and lazy parts.

Note
The widget set should start with <!-- WS Compiler: manually edited --> in the module so that it’s not manually updated with imports
Note
The custom widget set XML needs to import MprWidgetSet, for example, <inherits name="com.vaadin.mpr.MprWidgetSet"/>
Tip
After changing the widget set XML, remember to recompile it. When using Vaadin Maven plugin, you can run mvn vaadin:compile.

12A9FFC1-45D9-4128-836F-689F461D4392