package app.components.navigation; import app.navigation.Navigation; import com.vaadin.flow.component.html.Label; import com.vaadin.flow.component.orderedlayout.FlexComponent; import com.vaadin.flow.component.orderedlayout.HorizontalLayout; public class NavigationHeader extends HorizontalLayout { private final Navigation navigation; private final Label seasonLabel = new Label("Season:"); private final Label matchdayLabel = new Label("Matchday:"); private final Label matchLabel = new Label("Match:"); public NavigationHeader(Navigation navigation) { this.navigation = navigation; configureLayout(); configureChildren(); } private void configureLayout() { setWidthFull(); setAlignItems(FlexComponent.Alignment.CENTER); setJustifyContentMode(FlexComponent.JustifyContentMode.END); } private void configureChildren() { removeAll(); if (navigation.isSeasonEnabled()) { add(seasonLabel, navigation.getSeasonSelect()); } if (navigation.isMatchdayEnabled()) { add(matchdayLabel, navigation.getMatchdaySelect()); } if (navigation.isMatchEnabled()) { add(matchLabel, navigation.getMatchSelect()); } } }