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

Method onClose

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

Source from the content-addressed store, hash-verified

1003 );
1004
1005 @Override
1006 public void onClose(final Consumer<Boolean> canCloseCallback) {
1007 if (getDeckController().isSaved() || !allowSave() || canCloseCallback == null) {
1008 super.onClose(canCloseCallback); //can skip prompt if draft saved
1009 return;
1010 }
1011 FOptionPane.showOptionDialog(Forge.getLocalizer().getMessage("lblSaveChangesCurrentDeck"), "",
1012 FOptionPane.QUESTION_ICON, onCloseOptions, result -> {
1013 if (result == 0) {
1014 save(canCloseCallback);
1015 } else if (result == 1) {
1016 getDeckController().exitWithoutSaving(); //reload if not saving changes
1017 canCloseCallback.accept(true);
1018 } else {
1019 canCloseCallback.accept(false);
1020 }
1021 });
1022 }
1023
1024 @Override
1025 public boolean keyDown(int keyCode) {

Callers

nothing calls this directly

Calls 9

getDeckControllerMethod · 0.95
allowSaveMethod · 0.95
showOptionDialogMethod · 0.95
getLocalizerMethod · 0.95
saveMethod · 0.95
isSavedMethod · 0.65
exitWithoutSavingMethod · 0.65
getMessageMethod · 0.45
acceptMethod · 0.45

Tested by

no test coverage detected