|
1 | 1 | package life.qbic.datamanager.views.landing;
|
2 | 2 |
|
| 3 | +import com.vaadin.flow.component.Component; |
| 4 | +import com.vaadin.flow.component.HasElement; |
3 | 5 | import com.vaadin.flow.component.button.Button;
|
4 | 6 | import com.vaadin.flow.component.button.ButtonVariant;
|
| 7 | +import com.vaadin.flow.component.html.Div; |
5 | 8 | import com.vaadin.flow.component.html.Span;
|
6 | 9 | import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
7 | 10 | import com.vaadin.flow.router.PageTitle;
|
| 11 | +import com.vaadin.flow.router.RouterLayout; |
8 | 12 | import java.io.Serial;
|
9 | 13 | import java.util.Objects;
|
10 | 14 | import life.qbic.datamanager.views.DataManagerLayout;
|
| 15 | +import life.qbic.datamanager.views.LandingPageTitleAndLogo; |
11 | 16 | import org.springframework.beans.factory.annotation.Autowired;
|
12 | 17 |
|
13 | 18 | /**
|
|
16 | 21 | * @since 1.0.0
|
17 | 22 | */
|
18 | 23 | @PageTitle("Data Manager")
|
19 |
| -public class LandingPageLayout extends DataManagerLayout { |
| 24 | +public class LandingPageLayout extends DataManagerLayout implements RouterLayout { |
20 | 25 |
|
21 | 26 | @Serial
|
22 | 27 | private static final long serialVersionUID = 8899881833038660866L;
|
23 |
| - |
24 | 28 | public Button register;
|
25 | 29 | public Button login;
|
| 30 | + private final Div landingPageContent = new Div(); |
| 31 | + private final LandingPageTitleAndLogo landingPageTitleAndLogo = new LandingPageTitleAndLogo(); |
26 | 32 |
|
27 | 33 | public LandingPageLayout(@Autowired LandingPageHandlerInterface handlerInterface) {
|
28 | 34 | Objects.requireNonNull(handlerInterface);
|
29 |
| - addClassName("landing-page-layout"); |
30 |
| - |
| 35 | + setId("landing-page-layout"); |
| 36 | + //CSS class hosting the background image for all our landing pages |
| 37 | + landingPageContent.addClassName("landing-page-content"); |
31 | 38 | createNavBarContent();
|
32 | 39 | registerToHandler(handlerInterface);
|
33 |
| - |
34 | 40 | }
|
35 | 41 |
|
36 | 42 | private void registerToHandler(LandingPageHandlerInterface handler) {
|
@@ -58,4 +64,19 @@ private HorizontalLayout createHeaderButtonLayout() {
|
58 | 64 | private void styleHeaderButtons() {
|
59 | 65 | login.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
|
60 | 66 | }
|
| 67 | + |
| 68 | + /** |
| 69 | + * {@inheritDoc} |
| 70 | + * |
| 71 | + * @param content |
| 72 | + * @throws IllegalArgumentException if content is not a {@link Component} |
| 73 | + */ |
| 74 | + @Override |
| 75 | + public void showRouterLayoutContent(HasElement content) { |
| 76 | + landingPageContent.removeAll(); |
| 77 | + //Ensures that the data manager title und UT Logo is always present in this layout |
| 78 | + landingPageContent.getElement().appendChild(landingPageTitleAndLogo.getElement()); |
| 79 | + landingPageContent.getElement().appendChild(content.getElement()); |
| 80 | + super.showRouterLayoutContent(landingPageContent); |
| 81 | + } |
61 | 82 | }
|
0 commit comments