use of com.faforever.client.fx.Controller in project downlords-faf-client by FAForever.
the class ReplayDetailController method populateTeamsContainer.
private void populateTeamsContainer() {
if (!replay.getValidity().equals(Validity.VALID)) {
showRatingChangeButton.setDisable(true);
showRatingChangeButton.setText(i18n.get("game.notValid"));
} else if (!replayService.replayChangedRating(replay)) {
showRatingChangeButton.setDisable(true);
showRatingChangeButton.setText(i18n.get("game.notRatedYet"));
}
Map<Integer, PlayerStats> statsByPlayerId = teams.values().stream().flatMap(Collection::stream).collect(Collectors.toMap(PlayerStats::getPlayerId, Function.identity()));
Platform.runLater(() -> teams.forEach((team, value) -> {
List<Integer> playerIds = value.stream().map(PlayerStats::getPlayerId).collect(Collectors.toList());
TeamCardController controller = uiService.loadFxml("theme/team_card.fxml");
teamCardControllers.add(controller);
playerService.getPlayersByIds(playerIds).thenAccept(players -> controller.setPlayersInTeam(team, players, player -> {
PlayerStats playerStats = statsByPlayerId.get(player.getId());
return new Rating(playerStats.getBeforeMean(), playerStats.getBeforeDeviation());
}, RatingType.EXACT));
teamsContainer.getChildren().add(controller.getRoot());
}));
}
Aggregations