forked from nus-cs2103-AY1718S2/addressbook-level4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request nus-cs2103-AY1718S2#45 from CS2103JAN2018-T15-B2/v…
…1.3YuxiangSg V1.3 yuxiangsg
- Loading branch information
Showing
43 changed files
with
982 additions
and
149 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,14 +161,58 @@ Selects the 1st person in the results of the `find` command. | |
=== Adding an appointment: `add_appointment` | ||
|
||
Adds an appointment to the address book calendar + | ||
Format: `add_appointment n/NAME S/START DATE E/END DATE` | ||
Format: `add_appointment n/NAME S/START DATE TIME E/END DATE TIME` | ||
|
||
[TIP] | ||
The date must be entered in the d/MM/yyyy format | ||
The date time must be entered in the d/MM/yyyy HH:mm format+ | ||
The name given to the appointment as its title must be unique | ||
|
||
Examples: | ||
|
||
* `add_appointment n/meet John S/11/09/2018 E/11/09/2018` | ||
* `add_appointment n/meet John S/11/09/2018 15:00 E/11/09/2018 16:00` | ||
|
||
=== remove existing appointment : `remove_appointment` | ||
|
||
Removes appointment whose title match the given search text + | ||
Format: `remove_appointment ST/SEARCH TEXT` | ||
|
||
[TIP] | ||
only the title is searched, appointment with the title that match the given search text will be removed | ||
This works as we enforces unique titles for appointments. | ||
|
||
Examples: | ||
|
||
* `remove_appointment ST/Title of the appointment` | ||
|
||
=== Editing an appointment: `edit_appointment` | ||
|
||
edit an existing appointment in the address book calendar + | ||
Format: `edit_appointment ST/SEARCH TEXT n/NEW NAME S/NEW START DATE TIME E/NEW END DATE TIME` | ||
|
||
[TIP] | ||
Make sure the search text matches the title of an existing appointment and the new title do not duplicates | ||
with other existing appointments | ||
|
||
Examples: | ||
|
||
* `edit_appointment ST/meet James n/meet John S/11/09/2018 15:00 E/11/09/2018 16:00` | ||
|
||
=== Look At a Date: `look` | ||
|
||
look at a specific date, the Calendar GUI will focus on the date + | ||
Format: `look DF/18/03/2018` | ||
|
||
[TIP] | ||
Note that the date format must be in d/MM/yyyy | ||
|
||
Examples: | ||
|
||
* `look DF/11/09/2018` | ||
|
||
=== Back to calendar Month View: `back` | ||
|
||
set the Calendar View to Month View + | ||
Format: `back` | ||
|
||
=== Listing entered commands : `history` | ||
|
||
|
@@ -269,13 +313,6 @@ There is no need to save manually. | |
_{explain how the user can enable/disable data encryption}_ | ||
// end::dataencryption[] | ||
|
||
=== remove existing appointment `[coming in v2.0]` | ||
the user is allowed to use command line to delete an existing appointment by specifying the appointment title and interval | ||
|
||
=== update existing appointment `[coming in v2.0]` | ||
the user is allowed to use command line to update an existing appointment by specifying the old appointment title and interval | ||
then the new appointment title and interval | ||
|
||
=== add task to task pad`[coming in v2.0]` | ||
the user is allowed to use command line to add a task to the task pad GUI specifying the task title , task details | ||
|
||
|
@@ -300,7 +337,14 @@ the user is allowed to use command line to remove a task to the task pad GUI sp | |
* *Add* `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG]...` + | ||
e.g. `add n/James Ho p/22224444 e/[email protected] a/123, Clementi Rd, 1234665 t/friend t/colleague` | ||
* *Add Appointment* `add_appointment n/NAME S/START DATE E/End Date` + | ||
e.g. `add_appointment n/Meet James S/14/08/2018 S/14/08/2018` | ||
e.g. `add_appointment n/Meet James S/14/08/2018 15:00 S/14/08/2018 16:00` | ||
* *Remove Appointment* `remove_appointment ST/SEARCH TEXT` + | ||
e.g. `remove_appointment ST/Title of the appointment` | ||
* *Edit Appointment* `edit_appointment ST/SEARCH TEXT n/NEW NAME S/NEW START DATE E/NEW End Date` + | ||
e.g. `edit_appointment ST/meet John n/Meet James S/14/08/2018 15:00 S/14/08/2018 16:00` | ||
* *Look At a Date* `look DF/DATE TO LOOK` + | ||
e.g. `look DF/18/03/2018` | ||
* *Back to Month View* `back` | ||
* *Clear* : `clear` | ||
* *Delete* : `delete INDEX` + | ||
e.g. `delete 3` | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
21 changes: 21 additions & 0 deletions
21
src/main/java/seedu/address/commons/events/ui/CalendarFocusEvent.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package seedu.address.commons.events.ui; | ||
|
||
import java.time.LocalDate; | ||
|
||
import seedu.address.commons.events.BaseEvent; | ||
|
||
/** | ||
* Represents a calendar GUI focus date request | ||
*/ | ||
public class CalendarFocusEvent extends BaseEvent { | ||
public final LocalDate dateToLook; | ||
|
||
public CalendarFocusEvent(LocalDate dateToLook) { | ||
this.dateToLook = dateToLook; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return this.getClass().getSimpleName(); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/seedu/address/commons/events/ui/CalendarUnfocusEvent.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package seedu.address.commons.events.ui; | ||
|
||
import seedu.address.commons.events.BaseEvent; | ||
|
||
/** | ||
* Represents a calendar GUI unfocus date request | ||
*/ | ||
public class CalendarUnfocusEvent extends BaseEvent { | ||
@Override | ||
public String toString() { | ||
return this.getClass().getSimpleName(); | ||
} | ||
} |
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
64 changes: 64 additions & 0 deletions
64
src/main/java/seedu/address/logic/commands/EditAppointmentCommand.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_END_INTERVAL; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_SEARCH_TEXT; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_START_INTERVAL; | ||
|
||
import seedu.address.logic.commands.exceptions.CommandException; | ||
import seedu.address.model.calendar.AppointmentEntry; | ||
import seedu.address.model.calendar.exceptions.EditApointmentFailException; | ||
|
||
/** | ||
* Edit an appointment in the address book's calendar. | ||
*/ | ||
public class EditAppointmentCommand extends UndoableCommand { | ||
public static final String COMMAND_WORD = "edit_appointment"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits an appointment in the calendar. " | ||
+ "Parameters: " | ||
+ PREFIX_SEARCH_TEXT + "SEARCH TEXT " | ||
+ PREFIX_NAME + "NEW NAME " | ||
+ PREFIX_START_INTERVAL + "NEW START DATE TIME " | ||
+ PREFIX_END_INTERVAL + "NEW END DATE TIME" | ||
+ "\nExample: " + COMMAND_WORD + " " | ||
+ PREFIX_SEARCH_TEXT + "Meet Peter " | ||
+ PREFIX_NAME + "Meet John " | ||
+ PREFIX_START_INTERVAL + "14/08/2018 06:12 " | ||
+ PREFIX_END_INTERVAL + "14/08/2018 07:12 "; | ||
|
||
public static final String MESSAGE_SUCCESS = "Appointment Edited: %1$s"; | ||
public static final String MESSAGE_FAIL_EDIT_APPOINTMENT = "appointment do not exit or duplicate new title"; | ||
|
||
private final AppointmentEntry toEdit; | ||
private final String searchText; | ||
|
||
/** | ||
* Creates an AddCommand to add the specified {@code AppointmentEntry} | ||
*/ | ||
public EditAppointmentCommand(String searchText, AppointmentEntry appointmentEntry) { | ||
requireNonNull(appointmentEntry); | ||
toEdit = appointmentEntry; | ||
this.searchText = searchText; | ||
} | ||
|
||
@Override | ||
public CommandResult executeUndoableCommand() throws CommandException { | ||
requireNonNull(model); | ||
try { | ||
model.editAppointment(searchText, toEdit); | ||
return new CommandResult(String.format(MESSAGE_SUCCESS, toEdit)); | ||
} catch (EditApointmentFailException e) { | ||
throw new CommandException(MESSAGE_FAIL_EDIT_APPOINTMENT); | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
return other == this // short circuit if same object | ||
|| (other instanceof EditAppointmentCommand // instanceof handles nulls | ||
&& toEdit.equals(((EditAppointmentCommand) other).toEdit)); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/seedu/address/logic/commands/LookDateCommand.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_DATE_FOCUS; | ||
|
||
import java.time.LocalDate; | ||
|
||
import seedu.address.commons.core.EventsCenter; | ||
import seedu.address.commons.events.ui.CalendarFocusEvent; | ||
|
||
/** | ||
* Look at a specific date give the date to look | ||
*/ | ||
public class LookDateCommand extends Command { | ||
public static final String COMMAND_WORD = "look"; | ||
|
||
public static final String DATE_VALIDATION = "d/MM/yyyy"; | ||
|
||
public static final String MESSAGE_DATE_CONSTRAINTS = | ||
"Date should be in the format of dd/MM/yyyy"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD | ||
+ ": Focus on a given date ." | ||
+ "Parameters: " | ||
+ PREFIX_DATE_FOCUS + "DATE TO FOCUS " | ||
+ "\nExample: " + COMMAND_WORD + " " | ||
+ PREFIX_DATE_FOCUS + "11/03/2018"; | ||
|
||
public static final String FOCUS_DATE_MESSAGE = "FOCUS ON DATE"; | ||
|
||
/** | ||
* Creates an RemoveAppointmentCommand to remove the specified {@code searchText} | ||
*/ | ||
final LocalDate dateToLook; | ||
|
||
public LookDateCommand(LocalDate dateToLook) { | ||
requireNonNull(dateToLook); | ||
this.dateToLook = dateToLook; | ||
} | ||
|
||
@Override | ||
public CommandResult execute() { | ||
EventsCenter.getInstance().post(new CalendarFocusEvent(dateToLook)); | ||
return new CommandResult(FOCUS_DATE_MESSAGE); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/seedu/address/logic/commands/RemoveAppointmentsCommand.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_SEARCH_TEXT; | ||
|
||
import seedu.address.logic.commands.exceptions.CommandException; | ||
import seedu.address.model.calendar.exceptions.AppointmentNotFoundException; | ||
|
||
/** | ||
* removes appointment whose title match with the searchText in the address book's calendar. | ||
*/ | ||
|
||
public class RemoveAppointmentsCommand extends UndoableCommand { | ||
|
||
public static final String COMMAND_WORD = "remove_appointment"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD | ||
+ ": remove appointment whose title match with the search text in the calendar. " | ||
+ "Parameters: " | ||
+ PREFIX_SEARCH_TEXT + "SEARCH TEXT " | ||
+ "\nExample: " + COMMAND_WORD + " " | ||
+ PREFIX_SEARCH_TEXT + "title of the appointment "; | ||
|
||
public static final String MESSAGE_SUCCESS = "Appointment with title %1$s removed"; | ||
public static final String MESSAGE_NO_SUCH_APPOINTMENT = "No such appointment exists in the calendar"; | ||
|
||
private final String searchText; | ||
|
||
/** | ||
* Creates an RemoveAppointmentCommand to remove the specified {@code searchText} | ||
*/ | ||
public RemoveAppointmentsCommand(String searchText) { | ||
requireNonNull(searchText); | ||
this.searchText = searchText; | ||
} | ||
|
||
@Override | ||
protected CommandResult executeUndoableCommand() throws CommandException { | ||
try { | ||
model.removeAppointment(searchText); | ||
return new CommandResult(String.format(MESSAGE_SUCCESS, searchText)); | ||
} catch (AppointmentNotFoundException e) { | ||
throw new CommandException(MESSAGE_NO_SUCH_APPOINTMENT); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/seedu/address/logic/commands/ReturnMonthViewCommand.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import seedu.address.commons.core.EventsCenter; | ||
import seedu.address.commons.events.ui.CalendarUnfocusEvent; | ||
|
||
/** | ||
* return to month view for the calendar GUI. | ||
*/ | ||
public class ReturnMonthViewCommand extends Command { | ||
public static final String COMMAND_WORD = "back"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Unfocus the Calendar to Month view.\n" | ||
+ "Example: " + COMMAND_WORD; | ||
|
||
public static final String RETURN_MONTH_VIEW_MESSAGE = "Calendar back to Month view"; | ||
|
||
@Override | ||
public CommandResult execute() { | ||
EventsCenter.getInstance().post(new CalendarUnfocusEvent()); | ||
return new CommandResult(RETURN_MONTH_VIEW_MESSAGE); | ||
} | ||
} |
Oops, something went wrong.