use of games.strategy.engine.pbem.NullForumPoster in project triplea by triplea-game.
the class PbemSetupPanel method loadForumPosters.
/**
* Load the Forum poster that are stored in the GameData, and select it in the list.
* Sensitive information such as passwords are not stored in save games, so the are loaded from the LocalBeanCache
*
* @param data the game data
*/
private void loadForumPosters(final GameData data) {
// get the forum posters,
final List<IForumPoster> forumPosters = new ArrayList<>();
forumPosters.add(useCacheIfAvailable(new NullForumPoster()));
forumPosters.add(useCacheIfAvailable(new AxisAndAlliesForumPoster()));
forumPosters.add(useCacheIfAvailable(new TripleAForumPoster()));
forumPosterEditor.setBeans(forumPosters);
// now get the poster stored in the save game
final IForumPoster forumPoster = (IForumPoster) data.getProperties().get(PBEMMessagePoster.FORUM_POSTER_PROP_NAME);
if (forumPoster != null) {
// if we have a cached version, use the credentials from this, as each player has different forum login
final IForumPoster cached = (IForumPoster) LocalBeanCache.INSTANCE.getSerializable(forumPoster.getClass().getCanonicalName());
if (cached != null) {
forumPoster.setUsername(cached.getUsername());
forumPoster.setPassword(cached.getPassword());
forumPoster.setCredentialsSaved(cached.areCredentialsSaved());
}
forumPosterEditor.setSelectedBean(forumPoster);
}
}
Aggregations