Source:
public void initialize() { gamesTableController = uiService.loadFxml("theme/play/games_table.fxml"); gamesTilesContainerController = uiService.loadFxml("theme/play/games_tiles_container.fxml"); chooseSortingTypeChoiceBox.setVisible(false); chooseSortingTypeChoiceBox.setConverter(new StringConverter<TilesSortingOrder>() { @Override public String toString(TilesSortingOrder tilesSortingOrder) { return i18n.get(tilesSortingOrder.getDisplayNameKey()); } @Override public TilesSortingOrder fromString(String string) { throw new UnsupportedOperationException("Not supported"); } }); ObservableList<Game> games = gameService.getGames(); filteredItems = new FilteredList<>(games); showModdedGamesCheckBox.selectedProperty().bindBidirectional(preferencesService.getPreferences().showModdedGamesProperty()); showPasswordProtectedGamesCheckBox.selectedProperty().bindBidirectional(preferencesService.getPreferences().showPasswordProtectedGamesProperty()); updateFilteredItems(); preferencesService.getPreferences().showModdedGamesProperty().addListener(new WeakChangeListener<>(filterConditionsChangedListener)); preferencesService.getPreferences().showPasswordProtectedGamesProperty().addListener(new WeakChangeListener<>(filterConditionsChangedListener)); preferencesService.getPreferences().showModdedGamesProperty().addListener(new WeakChangeListener<>(showModsColumnChangedListener)); if (tilesButton.getId().equals(preferencesService.getPreferences().getGamesViewMode())) { viewToggleGroup.selectToggle(tilesButton); tilesButton.getOnAction().handle(null); } else { viewToggleGroup.selectToggle(tableButton); tableButton.getOnAction().handle(null); gamesTableController.setModsColumnVisibility(showModdedGamesCheckBox.selectedProperty().getValue()); } viewToggleGroup.selectedToggleProperty().addListener((observable, oldValue, newValue) -> { if (newValue == null) { if (oldValue != null) { viewToggleGroup.selectToggle(oldValue); } else { viewToggleGroup.selectToggle(viewToggleGroup.getToggles().get(0)); } return; } preferencesService.getPreferences().setGamesViewMode(((ToggleButton) newValue).getId()); preferencesService.storeInBackground(); }); setSelectedGame(null); eventBus.register(this); }

Target:
public void initialize() { chooseSortingTypeChoiceBox.setVisible(false); chooseSortingTypeChoiceBox.setConverter(new StringConverter<TilesSortingOrder>() { @Override public String toString(TilesSortingOrder tilesSortingOrder) { return i18n.get(tilesSortingOrder.getDisplayNameKey()); } @Override public TilesSortingOrder fromString(String string) { throw new UnsupportedOperationException("Not supported"); } }); ObservableList<Game> games = gameService.getGames(); filteredItems = new FilteredList<>(games); showModdedGamesCheckBox.selectedProperty().bindBidirectional(preferencesService.getPreferences().showModdedGamesProperty()); showPasswordProtectedGamesCheckBox.selectedProperty().bindBidirectional(preferencesService.getPreferences().showPasswordProtectedGamesProperty()); updateFilteredItems(); preferencesService.getPreferences().showModdedGamesProperty().addListener(new WeakChangeListener<>(filterConditionsChangedListener)); preferencesService.getPreferences().showPasswordProtectedGamesProperty().addListener(new WeakChangeListener<>(filterConditionsChangedListener)); if (tilesButton.getId().equals(preferencesService.getPreferences().getGamesViewMode())) { viewToggleGroup.selectToggle(tilesButton); tilesButton.getOnAction().handle(null); } else { viewToggleGroup.selectToggle(tableButton); tableButton.getOnAction().handle(null); gamesTableController.setModsColumnVisibility(showModdedGamesCheckBox.selectedProperty().getValue()); gamesTableController.setPasswordProtectionColumnVisibility(showPasswordProtectedGamesCheckBox.selectedProperty().getValue()); } viewToggleGroup.selectedToggleProperty().addListener((observable, oldValue, newValue) -> { if (newValue == null) { if (oldValue != null) { viewToggleGroup.selectToggle(oldValue); } else { viewToggleGroup.selectToggle(viewToggleGroup.getToggles().get(0)); } return; } preferencesService.getPreferences().setGamesViewMode(((ToggleButton) newValue).getId()); preferencesService.storeInBackground(); }); setSelectedGame(null); eventBus.register(this); }