use of games.strategy.engine.pbem.PBEMMessagePoster in project triplea by triplea-game.
the class AbstractForumPosterPanel method waitForDone.
protected void waitForDone(final TripleAFrame frame, final IPlayerBridge bridge) {
tripleAFrame = frame;
playerBridge = bridge;
// Nothing to do if there are no PBEM messengers
pbemMessagePoster = new PBEMMessagePoster(getData(), getCurrentPlayer(), getRound(), getTitle());
if (!pbemMessagePoster.hasMessengers()) {
return;
}
if (skipPosting() || GameStepPropertiesHelper.isSkipPosting(getData())) {
return;
}
final boolean hasPosted = getHasPostedTurnSummary();
SwingUtilities.invokeLater(() -> {
removeAll();
add(actionLabel);
add(forumPosterComponent.layoutComponents(pbemMessagePoster, getForumPosterDelegate(), tripleAFrame, hasPosted, allowIncludeTerritorySummary(), allowIncludeTerritoryAllPlayersSummary(), allowIncludeProductionSummary(), allowDiceBattleDetails(), allowDiceStatistics()));
validate();
});
waitForRelease();
}
use of games.strategy.engine.pbem.PBEMMessagePoster in project triplea by triplea-game.
the class FileMenu method addPostPbem.
private JMenuItem addPostPbem() {
final JMenuItem menuPbem = new JMenuItem(SwingAction.of("Post PBEM/PBF Gamesave", e -> {
if (!PBEMMessagePoster.gameDataHasPlayByEmailOrForumMessengers(gameData)) {
return;
}
final String title = "Manual Gamesave Post";
try {
gameData.acquireReadLock();
final GameStep step = gameData.getSequence().getStep();
final PlayerID currentPlayer = (step == null ? PlayerID.NULL_PLAYERID : (step.getPlayerId() == null ? PlayerID.NULL_PLAYERID : step.getPlayerId()));
final int round = gameData.getSequence().getRound();
final HistoryLog historyLog = new HistoryLog();
historyLog.printFullTurn(gameData, true, GameStepPropertiesHelper.getTurnSummaryPlayers(gameData));
final PBEMMessagePoster poster = new PBEMMessagePoster(gameData, currentPlayer, round, title);
PBEMMessagePoster.postTurn(title, historyLog, true, poster, null, frame, null);
} finally {
gameData.releaseReadLock();
}
}));
menuPbem.setMnemonic(KeyEvent.VK_P);
menuPbem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
return menuPbem;
}
Aggregations