use of com.faforever.client.player.Player in project downlords-faf-client by FAForever.
the class PrivateChatTabController method setReceiver.
@Override
public void setReceiver(String username) {
super.setReceiver(username);
privateChatTabRoot.setId(username);
privateChatTabRoot.setText(username);
Player player = playerService.getPlayerForUsername(username);
privateUserInfoController.setPlayer(player);
}
use of com.faforever.client.player.Player in project downlords-faf-client by FAForever.
the class UserInfoWindowController method setPlayer.
public void setPlayer(Player player) {
this.player = player;
usernameLabel.setText(player.getUsername());
countryFlagService.loadCountryFlag(player.getCountry()).ifPresent(image -> countryImageView.setImage(image));
avatarImageView.setImage(IdenticonUtil.createIdenticon(player.getId()));
gamesPlayedLabel.setText(i18n.number(player.getNumberOfGames()));
ratingLabelGlobal.setText(i18n.number(RatingUtil.getGlobalRating(player)));
ratingLabel1v1.setText(i18n.number(RatingUtil.getLeaderboardRating(player)));
updateNameHistory(player);
CountryCode countryCode = CountryCode.getByCode(player.getCountry());
if (countryCode != null) {
// Country code is unknown to CountryCode, like A1 or A2 (from GeoIP)
countryLabel.setText(countryCode.getName());
} else {
countryLabel.setText(player.getCountry());
}
globalButton.fire();
globalButton.setSelected(true);
loadAchievements();
eventService.getPlayerEvents(player.getId()).thenAccept(events -> {
plotFactionsChart(events);
plotUnitsByCategoriesChart(events);
plotTechBuiltChart(events);
plotGamesPlayedChart();
}).exceptionally(throwable -> {
notificationService.addImmediateErrorNotification(throwable, "userInfo.statistics.errorLoading");
log.warn("Could not load player events", throwable);
return null;
});
}
use of com.faforever.client.player.Player in project downlords-faf-client by FAForever.
the class ChatUserItemControllerTest method testOnContextMenuRequested.
@Test
public void testOnContextMenuRequested() throws Exception {
WaitForAsyncUtils.asyncFx(() -> getRoot().getChildren().setAll(instance.chatUserItemRoot));
Player player = PlayerBuilder.create("junit").defaultValues().get();
instance.setPlayer(player);
WaitForAsyncUtils.waitForFxEvents();
ChatUserContextMenuController contextMenuController = mock(ChatUserContextMenuController.class);
ContextMenu contextMenu = mock(ContextMenu.class);
when(contextMenuController.getContextMenu()).thenReturn(contextMenu);
when(uiService.loadFxml("theme/chat/chat_user_context_menu.fxml")).thenReturn(contextMenuController);
ContextMenuEvent event = mock(ContextMenuEvent.class);
instance.onContextMenuRequested(event);
verify(uiService).loadFxml("theme/chat/chat_user_context_menu.fxml");
verify(contextMenuController).setPlayer(player);
verify(contextMenu).show(any(Window.class), anyDouble(), anyDouble());
}
use of com.faforever.client.player.Player in project downlords-faf-client by FAForever.
the class ChatUserItemControllerTest method testOpenGameSetsStatusToWaiting.
@Test
public void testOpenGameSetsStatusToWaiting() throws Exception {
Player player = PlayerBuilder.create("junit").defaultValues().get();
instance.setPlayer(player);
assertThat(instance.statusLabel.getText(), is(""));
player.setGame(GameBuilder.create().defaultValues().get());
WaitForAsyncUtils.waitForFxEvents();
assertThat(instance.statusLabel.getText(), is("Waiting"));
}
use of com.faforever.client.player.Player in project downlords-faf-client by FAForever.
the class ChatUserItemControllerTest method testGetPlayer.
@Test
public void testGetPlayer() throws Exception {
Player player = PlayerBuilder.create("junit").defaultValues().get();
instance.setPlayer(player);
assertThat(instance.getPlayer(), is(player));
}
Aggregations