(final Consumer<Boolean> callback)
| 948 | } |
| 949 | |
| 950 | public void save(final Consumer<Boolean> callback) { |
| 951 | IDeckController deckController = getDeckController(); |
| 952 | if(deckController.supportsSave()) { |
| 953 | if (!StringUtils.isEmpty(deck.getName())) { |
| 954 | deckController.save(); |
| 955 | } |
| 956 | else if (deckController.supportsRename()){ |
| 957 | List<PaperCard> commanders = deck.getCommanders(); //use commander name as default deck name |
| 958 | String initialInput = commanders.isEmpty() ? "New Deck" : Lang.joinHomogenous(commanders); |
| 959 | FThreads.invokeInEdtNowOrLater(() -> { |
| 960 | FOptionPane.showInputDialog(Forge.getLocalizer().getMessage("lblNameNewDeck"), initialInput, result -> { |
| 961 | if (StringUtils.isEmpty(result)) { return; } |
| 962 | |
| 963 | deckController.saveAs(result); |
| 964 | if (callback != null) { |
| 965 | callback.accept(true); |
| 966 | } |
| 967 | }); |
| 968 | }); |
| 969 | return; |
| 970 | } |
| 971 | } |
| 972 | |
| 973 | if (callback != null) { |
| 974 | callback.accept(true); |
| 975 | } |
| 976 | } |
| 977 | |
| 978 | public void completeDraft() { |
| 979 | BoosterDraft draft = getDraft(); |
no test coverage detected