package com.example.application.views.results; import com.example.application.data.service.*; import com.example.application.navigation.Navigation; import com.example.application.views.main.MainView; import com.vaadin.flow.component.dependency.CssImport; import com.vaadin.flow.component.html.Div; import com.vaadin.flow.component.splitlayout.SplitLayout; import com.vaadin.flow.router.*; import org.springframework.beans.factory.annotation.Autowired; @CssImport("./views/results/results-view.css") @Route(value = "results", layout = MainView.class) @PageTitle("Schachliga DACH - Results") public class ResultsView extends Div implements HasUrlParameter { private final SplitLayout splitLayout = new SplitLayout(); private final Navigation navigation; private final MatchdayView matchdayView; private final MatchView matchView; public ResultsView(@Autowired SeasonService seasonService, @Autowired MatchdayService matchdayService, @Autowired MatchService matchService, @Autowired ChessComService chessComService, @Autowired PlayerService playerService) { this.navigation = new Navigation("results", seasonService, matchdayService, matchService); this.navigation.setAutoselectSeason(true); this.navigation.setAutoselectMatchday(true); this.matchdayView = new MatchdayView(navigation, matchService); this.matchView = new MatchView(navigation); addClassName("results-view"); configureLayout(); // disableSplit(); enableSplit(); } public void enableSplit() { removeAll(); add(splitLayout); } public void disableSplit() { removeAll(); add(matchdayView); } private void configureLayout() { setWidthFull(); setHeightFull(); splitLayout.addToPrimary(matchdayView); splitLayout.addToSecondary(matchView); splitLayout.setWidthFull(); splitLayout.setHeightFull(); } @Override public void setParameter(BeforeEvent beforeEvent, @WildcardParameter String param) { navigation.setParameter(beforeEvent, param); } }