Skip to content

Commit

Permalink
Add tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackYps committed Oct 22, 2023
1 parent b63598b commit 9ab725e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/com/faforever/client/api/FafApiAccessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ public class FafApiAccessor implements InitializingBean {
java.util.Map.entry(LeagueSeasonScore.class, List.of("leagueSeason", "leagueSeason.leaderboard", "leagueSeason.league",
"leagueSeasonDivisionSubdivision", "leagueSeasonDivisionSubdivision.leagueSeasonDivision")),
java.util.Map.entry(LeagueSeasonDivisionSubdivision.class, List.of("leagueSeasonDivision", "leagueSeasonDivision.leagueSeason")),
java.util.Map.entry(LeagueScoreJournal.class, List.of("leagueSeason", "leagueSeasonDivisionSubdivisionBefore", "leagueSeasonDivisionSubdivisionAfter")),
java.util.Map.entry(LeagueScoreJournal.class, List.of("leagueSeason", "leagueSeasonDivisionSubdivisionBefore", "leagueSeasonDivisionSubdivisionAfter",
"leagueSeasonDivisionSubdivisionBefore.leagueSeasonDivision", "leagueSeasonDivisionSubdivisionAfter.leagueSeasonDivision")),
java.util.Map.entry(MapVersion.class, List.of("map", "map.reviewsSummary", "map.author")),
java.util.Map.entry(MapReviewsSummary.class, List.of("map.latestVersion", "map.author", "map.reviewsSummary")),
java.util.Map.entry(Map.class, List.of("latestVersion", "author", "reviewsSummary")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public class PlayerCardController implements Controller<Node> {
private final ObjectProperty<Faction> faction = new SimpleObjectProperty<>();
private final Tooltip noteTooltip = new Tooltip();
private final Tooltip avatarTooltip = new Tooltip();
private final Tooltip divisionTooltip = new Tooltip();

@Override
public void initialize() {
Expand Down Expand Up @@ -142,6 +143,13 @@ public void initialize() {
avatarTooltip.setShowDelay(Duration.ZERO);
avatarTooltip.setShowDuration(Duration.seconds(30));
Tooltip.install(avatarImageView, avatarTooltip);

divisionTooltip.textProperty().bind(
division.map(value -> i18n.get("leaderboard.divisionName", i18n.get(value.getDivisionI18nKey()), value.getNameKey()))
.when(showing));
divisionTooltip.setShowDelay(Duration.ZERO);
divisionTooltip.setShowDuration(Duration.seconds(30));
Tooltip.install(divisionImageView, divisionTooltip);
}

private void onNoteChanged(String newValue) {
Expand Down

0 comments on commit 9ab725e

Please sign in to comment.