MCPcopy Create free account
hub / github.com/Card-Forge/forge / save

Method save

forge-gui-mobile/src/forge/deck/FDeckEditor.java:950–976  ·  view source on GitHub ↗
(final Consumer<Boolean> callback)

Source from the content-addressed store, hash-verified

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();

Callers 4

FDeckEditorMethod · 0.95
completeDraftMethod · 0.95
onCloseMethod · 0.95
keyDownMethod · 0.95

Calls 14

getDeckControllerMethod · 0.95
supportsSaveMethod · 0.95
saveMethod · 0.95
supportsRenameMethod · 0.95
joinHomogenousMethod · 0.95
invokeInEdtNowOrLaterMethod · 0.95
showInputDialogMethod · 0.95
getLocalizerMethod · 0.95
saveAsMethod · 0.95
isEmptyMethod · 0.65
getNameMethod · 0.65
getCommandersMethod · 0.45

Tested by

no test coverage detected