use of games.strategy.engine.framework.ui.GameChooserModel in project triplea by triplea-game.
the class GameSelectorModel method selectByName.
private GameChooserEntry selectByName() {
final String userPreferredDefaultGameName = ClientSetting.DEFAULT_GAME_NAME_PREF.value();
final GameChooserModel model = new GameChooserModel();
GameChooserEntry selectedGame = model.findByName(userPreferredDefaultGameName).orElse(null);
if (selectedGame == null && model.size() > 0) {
selectedGame = model.get(0);
}
if (selectedGame == null) {
return null;
}
if (!selectedGame.isGameDataLoaded()) {
try {
selectedGame.fullyParseGameData();
} catch (final GameParseException e) {
model.removeEntry(selectedGame);
resetToFactoryDefault();
return null;
}
}
return selectedGame;
}
Aggregations