New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Menu > Boards > New
should restore current board if save is aborted #1460
#1485
Conversation
cac70c8
to
e736de8
Compare
@xinan no worries, close & reopen to trigger travis |
+ "Do you want to save them?"; | ||
|
||
public ConfirmChangesDialog(Stage stage) { | ||
super(AlertType.CONFIRMATION); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need to merge this whole class to Util.DialogMessage
. Either use the existing Warning
dialog (not recommended) or create a new confirmation dialog in that class. We would like any dialog to be available for general use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use of the existing showYesNoWarningDialog
is not recommended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you use confirmation
type here. I think there will be some UI
difference, also. Unless if your dialog is also a warning.
On Apr 6, 2016 5:24 PM, "Liu Xinan" notifications@github.com wrote:
In src/main/java/ui/ConfirmChangesDialog.java
#1485 (comment):+import javafx.scene.control.ButtonType;
+import javafx.stage.Stage;
+
+/**
- * This class represents a confirm dialog that asks the user whether or not to save the current board before
- * switching to another board, or creating a new board.
- */
+public class ConfirmChangesDialog extends Alert {
+- private static final String DIALOG_TITLE = "Save Changes?";
- private static final String DIALOG_HEADER = "There are unsaved changes to your current board.";
- private static final String DIALOG_CONTENT = "If you choose not to save, all unsaved changes will be discarded.\n\n"
+ "Do you want to save them?";
- public ConfirmChangesDialog(Stage stage) {
super(AlertType.CONFIRMATION);
Why use of the existing showYesNoWarningDialog is not recommended?
—
You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
https://github.com/HubTurbo/HubTurbo/pull/1485/files/e736de8ed9249ffc9ffb1cc5cd3c21adfcaf0563#r58675841
private void onBoardNew() { | ||
logger.info("Menu: Boards > New"); | ||
newBoard(); | ||
public final boolean isCurrentOpenBoardDirty() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think isCurrentBoardDirty
is sufficient as we only have 1 open board. Update header comment as well.
Mostly cosmetic change. 1 thing needed: test for the confirmation dialog. Look at |
b5b74cc
to
a5f3e70
Compare
Update me when ready for another review. |
@HansNewbie Yes, it is ready! |
* Returns a boolean indicating whether we can proceed with | ||
* the new board creation. If there are no panels open, it | ||
* returns true; else a dialog is shown for the user to confirm. | ||
* Prompts a {@link BoardNameDialog} to ask the user for a new board name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update comment to ... for a board name
.
return true; | ||
public final Optional<String> promptForBoardName() { | ||
BoardNameDialog dlg = new BoardNameDialog(prefs, mainStage); | ||
Optional<String> response = dlg.showAndWait(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do return dlg.showAndWait()
?
a5f3e70
to
7b0a8d2
Compare
} | ||
|
||
/** | ||
* Creates an empty board. User will be prompted to | ||
* confirm the action if there are unclosed panels | ||
* Prompts a dialog to ask the user whether or not to save the current board. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method is doing more than just prompting. Both method name and comment misleading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of a better name. Do you have any suggestion how to name such methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can save after the prompt? Don't save in this method, I mean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I make it return a boolean
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what I have in mind.
7b0a8d2
to
a89e60b
Compare
a89e60b
to
50c0559
Compare
logger.info("New board creation cancelled"); | ||
return; | ||
} | ||
public final boolean promptToSaveCurrentBoard() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better name is isUserAgreeableToSavingBorad()
@HansNewbie any more comments? |
Looks good. No more comments. |
Fixes #1460
New
action is confirmed. So it is fine to cancel aNew
action.Boards > New
now opens up a fresh board with a single empty panel. (Default panel name and no filter.)