* GUI: fixed that users can select empty timing option in new tourney dialog;

This commit is contained in:
Oleg Agafonov 2021-07-26 14:42:42 +04:00
parent d3f2b537fb
commit f334b81de6
3 changed files with 23 additions and 4 deletions

View file

@ -86,7 +86,10 @@ public class NewTournamentDialog extends MageDialog {
cbTimeLimit.setModel(new DefaultComboBoxModel(MatchTimeLimit.values()));
cbSkillLevel.setModel(new DefaultComboBoxModel(SkillLevel.values()));
cbDraftCube.setModel(new DefaultComboBoxModel(SessionHandler.getDraftCubes()));
cbDraftTiming.setModel(new DefaultComboBoxModel(DraftOptions.TimingOption.values()));
cbDraftTiming.setModel(new DefaultComboBoxModel(Arrays.stream(TimingOption.values())
.filter(o -> !o.equals(TimingOption.NONE))
.toArray())
);
// update player types
int i = 2;
for (TournamentPlayerPanel tournamentPlayerPanel : players) {
@ -682,6 +685,13 @@ public class NewTournamentDialog extends MageDialog {
return;
}
}
if (tournamentType.isDraft() && tOptions.getLimitedOptions() instanceof DraftOptions) {
DraftOptions draftOptions = (DraftOptions) tOptions.getLimitedOptions();
if (draftOptions.getTiming() == TimingOption.NONE) {
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Warning, you must select draft timing option", "Warning", JOptionPane.WARNING_MESSAGE);
return;
}
}
// save last settings
onSaveSettings(0, tOptions);