Skip to content

Commit

Permalink
fix: Update how MPR annotations are given
Browse files Browse the repository at this point in the history
Since all other annotations should be on the
AppShellConfiguration implementation class
in v19+ also MPR should only look for the
annotations on the configuration class.

part of vaadin/multiplatform-runtime#83
  • Loading branch information
caalador committed Apr 27, 2021
1 parent 209d632 commit 9c866f3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
7 changes: 3 additions & 4 deletions articles/tools/mpr/configuration/custom-ui.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,16 @@ public class MyCustomUI extends MprUI {
You need to call `super.init(request)` if you need to override the init method

Then you need to tell the application that this class should be used with the
annotation `@LegacyUI()`.
annotation `@LegacyUI()` by defining it in a class implementing `AppShellConfigurator`.

[source,java]
----
@Route("")
@LegacyUI(MyCustomUI.class)
public class MainLayout extends Div {
public class Configuration implements AppShellConfigurator {
}
----

Now when navigating to the "" (root) route you will get a MyCustomUI instead of the
Now using the application you will get a MyCustomUI instead of the
default MprUI.

<<../overview#,<- Go back to the overview>>
11 changes: 5 additions & 6 deletions articles/tools/mpr/configuration/legacy-theme.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ layout: page
= Legacy theme in MPR

By default the theme used with MPR is 'valo' and this can be changed with
adding the `MprTheme` annotation with the wanted theme name to your root navigation
level, RouterLayout or to the top level @Route.

The closest instance found will be used for first initialization for
a `UI` instance, but the recommendation would be to put it always on the
top most `RouterLayout` in the view chain.
adding the `MprTheme` annotation with the wanted theme name to your `AppShellConfigurator`
configuration class.

[NOTE]
Runtime changing of the theme is not supported
Expand All @@ -21,6 +17,9 @@ Runtime changing of the theme is not supported
[source,java]
----
@MprTheme("reindeer")
public class Configuration implements AppShellConfigurator {
}
public class MainLayout extends Div implements RouterLayout {
}
Expand Down
11 changes: 5 additions & 6 deletions articles/tools/mpr/configuration/legacy-widgetset.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@ When using MPR you can not use CDN for the widgetset. This means that the config
`<vaadin.widgetset.mode>cdn</vaadin.widgetset.mode>` should be removed.

To use a custom widgetset for the legacy framework embedded with MPR,
just add `MprWidgetset` annotation to your root navigation level,
RouterLayout or to the top level @Route.

The closest instance found
will be used for first initialization for a `UI` instance, but the recommendation
would be to put it always on the top most `RouterLayout` in the view chain.
just add `MprWidgetset` annotation to your `AppShellConfigurator`
configuration class.

.Sample widgetset definition
[source,java]
----
@MprWidgetset("com.vaadin.mpr.DemoWidgetset")
public class Configuration implements AppShellConfigurator {
}
public class MainLayout extends Div implements RouterLayout {
}
Expand Down

0 comments on commit 9c866f3

Please sign in to comment.