/** * Called after @FXML annotated fields are injected and so is used to update the view with the * data built in the constructor. * * <p>Retrieves history and achievement information from the account to build the charts and set * the text for attribute and username labels. * * <p>First displays the user's workout activity in the last seven days but the user is allowed to * switch between last 30 days/ last 7 days charts */ @FXML private void initialize() { // build the series from the workout history information workoutHistoryLog = HistoryAnalyser.getDailyWorkoutHistoryFromCurrentAccount(); makeWeekSeriesFromAccountHistory(); makeMonthSeriesFromAccountHistory(); // ----------------------------------------------------------// // Character attributes and avatar // Get the authenticated and up to date account and get its attributes Account account = Main.account; attributes = account.getCharacterAttributes(); // ----------------------------------------------------------// // Progress charts // immediately remove the line chart that displays the last 30 days of workout activity from // view monthLineChart.setVisible(false); // add the series to their charts weekBarChart.getData().add(seriesW); monthLineChart.getData().add(seriesM); // manage the toggling feature between month and weekRadios radioGroup = new ToggleGroup(); monthRadio.setToggleGroup(radioGroup); weekRadio.setToggleGroup(radioGroup); // Initially set week radio to selected weekRadio.setSelected(true); showAccountAttributes(); showAvatarInStackPane(); showAchievementsInListView(); }
/** * Calls a {@link HistoryAnalyser#searchForAchievementsInHistory() searchForAchievementsInHistory} * method in <code>HistoryAnalyser</code> and populates the <code>achievementListView</code> with * the <code>ArrayList</code> of <code>String</code> returned. */ private void showAchievementsInListView() { ArrayList<String> achievementNames = HistoryAnalyser.searchForAchievementsInHistory(); achievementListView.setItems(FXCollections.observableList(achievementNames)); }