Search in sources :

Example 1 with TripleAForumPoster

use of games.strategy.engine.pbem.TripleAForumPoster 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);
    }
}
Also used : AxisAndAlliesForumPoster(games.strategy.triplea.pbem.AxisAndAlliesForumPoster) NullForumPoster(games.strategy.engine.pbem.NullForumPoster) ArrayList(java.util.ArrayList) IForumPoster(games.strategy.engine.pbem.IForumPoster) TripleAForumPoster(games.strategy.engine.pbem.TripleAForumPoster)

Aggregations

IForumPoster (games.strategy.engine.pbem.IForumPoster)1 NullForumPoster (games.strategy.engine.pbem.NullForumPoster)1 TripleAForumPoster (games.strategy.engine.pbem.TripleAForumPoster)1 AxisAndAlliesForumPoster (games.strategy.triplea.pbem.AxisAndAlliesForumPoster)1 ArrayList (java.util.ArrayList)1