forked from nus-cs2103-AY1819S2/addressbook-level4
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Set CommandResult, Exception & save EntryBook independently of Command #31
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…command result and exception
rlrh
changed the title
Support asynchronous commands
Get and set CommandResult, Exception independently of Command
Mar 1, 2019
rlrh
changed the title
Get and set CommandResult, Exception independently of Command
Set CommandResult, Exception & save EntryBook independently of Command
Mar 1, 2019
thomastanck
approved these changes
Mar 1, 2019
rlrh
added
the
type.Task
Something that needs to be done, but not story, bug or epic.
label
Mar 1, 2019
epicfailname
reviewed
Mar 2, 2019
initHistory(); | ||
historySnapshot.next(); | ||
commandTextField.setText(""); | ||
processCommandSuccess(); |
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.
Note to selves that this will be the second time this function is called. The first time is in the line above, within the MainWindow
's executeCommand
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Modify design to enable getting and setting of
CommandResult
andException
, andEntryBook
auto-saving, independently of anyCommand
s, with UI updating accordinglyResolves #34
Supports future commands that need to return an initial result first, do some long-running work, and then return another final result or exception, and also internal tasks that modify the model and need to return a user-facing result or exception
New:
A command can now return an initial command result first, do some long-running task that involves modifying the model, which will save itself to storage, and then update the observable command result or exception, which can then be handled appropriately by the UI.
Old:
A command can only return an initial command result, and then do some long-running task that involves modifying the model, but it will not save itself to storage, and a final command result or exception cannot be propagated.
How to Use:
In a
Command
'sexecute
method, return an initialCommandResult
, and within an asynchronous task, set theModel
'scommandResultProperty
orexceptionProperty
.Example: