Skip to content
Pauta1.4.0

Confirm dialog

MUST before anything the user made is removed, deleted, discarded or overwritten, unless the action can be taken back instead (see Window shell). One question, asked the same way everywhere: the text names the thing and what happens to it, the confirming button is the action’s own verb in red, and Cancel is the way out. Reference: Editora’s ui/CloseCoordinator.java (unsaved changes, Quit) and GitCoordinator.confirmDestructive; Torrenta’s ui/RemoveConfirm.java asks it for the torrent list, the RSS tab and every list in Settings.

  1. 1Window title: the header's words again ("Remove feed", "Unsaved changes"). A plain confirmation, no icon in the title and no app name.
  2. 2Header, when the question is long enough to need one. Editora's Git confirmations set none and put the whole message in the content; Torrenta's header names the action and the content asks the question.
  3. 3The question names the thing and the consequence. How many ("these 3 torrents", a {0,choice,…} plural), which one ("the feed “Linux ISOs” and its articles"), what stays ("The downloaded files stay on disk."), and "This cannot be undone." only when it is true. Termina's multi-line paste shows the text itself in an expandable area, so the decision is made on what will be sent.
  4. 4The action button carries the action's verb (Delete files, Remove, Discard, Quit, Close), never OK or Yes, and the danger style: red, not the accent. It is the dialog's one colored button.
  5. 5Cancel, in the catalog's word, with the CANCEL_CLOSE role: Escape and the window's close button both answer Cancel.
Unsaved changes
Save changes to Main.java before closing?
SaveDiscardCancel
Remove, files kept
Remove this torrent? The downloaded files stay on disk.
CancelRemove
A program is running
Close this tab? bash (top) is still running. Closing will end it.
CancelClose
Undo instead of a question
Undo Removed Ubuntu ISOC-z
  • Three answers when saving is an option: Save (the success style, green), Discard (danger) and Cancel, in that order. Save that fails leaves the tab open.
  • A running program is not the user’s data, so Termina words the button Close and makes Cancel the default button: dismissing the dialog by any route keeps the program alive.
  • No question at all where the action can be taken back. Mirada moves an image to the trash at once and offers Undo; Torrenta asks before removing a torrent but also keeps the removal on its undo stack for ten minutes; closing a clean tab asks nothing and Reopen Closed Tab brings it back.
PropertyValueReference
KindAlert(CONFIRMATION) owned by the window (initOwner), shown with showAndWait; the answer defaults to Cancel when the dialog is closed any other wayGitCoordinator.confirmDestructive, RemoveConfirm.ask
ButtonsA ButtonType with the action’s name and the OK_DONE role, and Cancel with CANCEL_CLOSE from the catalog, never JavaFX’s stock OK and Cancel, which are worded in the JVM’s localeRemoveConfirm.ask, Torrenta’s StockButtons
Action buttondanger style class: the theme’s .button.danger fills it -color-danger-emphasis with emphasis text. Save in the unsaved question: successMainController.styleUnsavedChangesButtons, styleQuitButtonAsDanger
Default buttonThe action, where it has the OK_DONE role (Editora’s Git confirmations, Torrenta’s Remove): Enter runs it, and red is what says so. Editora’s unsaved-changes and Quit questions give their buttons no role, so Enter does nothing. Termina’s close-running-program question makes Cancel the defaultconfirmDestructive, CloseCoordinator.unsavedAlert, Termina TerminalWindow
FontThe UI font sheet attached to the dialog pane, because a dialog is its own scene and inherits nothing from the windowTorrenta Fonts.installUiFont(DialogPane), Editora App.installUiFont (every window)
StylesheetDialogs.styled adds app.css to a dialog that needs the app’s own rules (About); the -color-* tokens and .button.danger resolve from the theme either wayDialogs
TextThe question in the content; a header only when the question needs a name over it. Counts as plurals, names in quotes, the consequence spelled outActions.removeQuestion, confirm.remove.<kind>
StringsOne key per kind, header and question both, tested to exist for every kindRemoveConfirm.Kind, RemoveConfirmTest
  • Ask before, not after. The question comes before anything changes; the removal runs only on the action button (RemoveConfirm.ask returns true on that button alone).
  • Ask once per gesture. An action on many things asks one question with the count (“Remove these 3 torrents?”, Torrenta’s “Apply to many torrents” for a bulk command). Closing every tab asks per unsaved buffer, selecting each tab first so the user sees what the question is about, and remembers a Discard answer for exactly the state that was shown (CloseCoordinator.confirmSweep).
  • Escape cancels, as does closing the dialog. Nothing is lost on a dismissal.
  • Say what it costs. A delete that cannot be undone says so; one that leaves the files says that instead. A dangerous alternative (Force with Lease, Delete Anyway) is offered beside the safe one (Pull, then Push), red, and only when the safe one has already failed.
  • Testable without a screen. The question’s words come from pure code (RemoveConfirm.header, question) and the capture hook answers the dialog through answerForCapture, so a UI test never has to press a native button.
KeyEnglish
dialog.unsaved.title / dialog.unsaved.headerUnsaved changes / Save changes to {0} before closing?
dialog.save / dialog.discard / dialog.cancelSave / Discard / Cancel
dialog.quit.header / dialog.quit.buttonQuit Editora? / Quit
dialog.discard.trackedDiscard all changes to “{0}”? This cannot be undone.
dialog.discardAll.actionDiscard All
dialog.deleteBranch.forceDelete Anyway
confirm.remove.feed.header / confirm.remove.feedRemove feed / Remove the feed “{0}” and its articles? The torrents already added stay.
actions.removeQuestion.deleteRemove this torrent and delete the downloaded files? This cannot be undone.
window.remove.button.delete / common.remove / common.cancelDelete files / Remove / Cancel
dialog.closeRunning / dialog.closeAnyway (Termina)Close this tab? / Close

Editora asks for unsaved changes, Quit with busy terminals, pinned tabs, Git discards and branch deletions, and Local History purges, all through Alert with named buttons. Torrenta’s RemoveConfirm serves the torrent list, feeds, rules, watched folders, search providers, engine profiles, categories, tags and saved views with one shape. Termina asks before closing a tab with a running program and before a multi-line paste. Mirada and Modula ask nothing: Mirada’s trash is undoable, and Modula’s preset chips remove on one click, which this template says they should not.

Pauta 1.4.0 · · Changelog · This page in the latest edition