Skip to content
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

Merged
merged 10 commits into from Apr 9, 2016

Conversation

xinan
Copy link
Contributor

@xinan xinan commented Apr 5, 2016

Fixes #1460

  • Now it will prompt for save if the current board is dirty, instead of alerting all the time but does not provide option to save.
  • It also does not clear the current board before the New action is confirmed. So it is fine to cancel a New action.
  • Instead of opening an empty board without any panels. Boards > New now opens up a fresh board with a single empty panel. (Default panel name and no filter.)

@HansNewbie
Copy link
Contributor

@xinan no worries, close & reopen to trigger travis

+ "Do you want to save them?";

public ConfirmChangesDialog(Stage stage) {
super(AlertType.CONFIRMATION);
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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() {
Copy link
Contributor

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.

@HansNewbie
Copy link
Contributor

Mostly cosmetic change.

1 thing needed: test for the confirmation dialog. Look at guitests>DialogMessageTests.

@HansNewbie
Copy link
Contributor

Update me when ready for another review.

@xinan
Copy link
Contributor Author

xinan commented Apr 8, 2016

@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
Copy link
Contributor

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();
Copy link
Contributor

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

}

/**
* 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.
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

logger.info("New board creation cancelled");
return;
}
public final boolean promptToSaveCurrentBoard() {
Copy link
Contributor

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

@damithc
Copy link
Contributor

damithc commented Apr 9, 2016

@HansNewbie any more comments?

@HansNewbie
Copy link
Contributor

Looks good. No more comments.

@xinan xinan merged commit 70af3b8 into HubTurbo:master Apr 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants