Skip to content

Commit

Permalink
Merge pull request nus-cs2103-AY1718S2#45 from CS2103JAN2018-T15-B2/v…
Browse files Browse the repository at this point in the history
…1.3YuxiangSg

V1.3 yuxiangsg
  • Loading branch information
yuxiangSg authored Mar 27, 2018
2 parents f2ebac2 + be23b97 commit fa45379
Show file tree
Hide file tree
Showing 43 changed files with 982 additions and 149 deletions.
9 changes: 5 additions & 4 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ The sections below give more details of each component.
=== UI component

.Structure of the UI Component
image::UiClassDiagram.png[width="800"]
image::UiClassDiagramUpdated.png[width="800"]

*API* : link:{repoURL}/src/main/java/seedu/address/ui/Ui.java[`Ui.java`]

The UI consists of a `MainWindow` that is made up of parts e.g.`CommandBox`, `ResultDisplay`, `PersonListPanel`, `StatusBarFooter`, `BrowserPanel` etc. All these, including the `MainWindow`, inherit from the abstract `UiPart` class.
The UI consists of a `MainWindow` that is made up of parts e.g.`CommandBox`, `ResultDisplay`, `PersonListPanel`, `CalendarPanel`, `StatusBarFooter`, `BrowserPanel` etc. All these, including the `MainWindow`, inherit from the abstract `UiPart` class.

The `UI` component uses JavaFx UI framework. The layout of these UI parts are defined in matching `.fxml` files that are in the `src/main/resources/view` folder. For example, the layout of the link:{repoURL}/src/main/java/seedu/address/ui/MainWindow.java[`MainWindow`] is specified in link:{repoURL}/src/main/resources/view/MainWindow.fxml[`MainWindow.fxml`]

Expand Down Expand Up @@ -197,7 +197,7 @@ image::DeletePersonSdForLogic.png[width="800"]
=== Model component

.Structure of the Model Component
image::ModelClassDiagram.png[width="800"]
image::ModelClassDiagramUpdated.png[width="800"]

*API* : link:{repoURL}/src/main/java/seedu/address/model/Model.java[`Model.java`]

Expand All @@ -206,6 +206,7 @@ The `Model`,
* stores a `UserPref` object that represents the user's preferences.
* stores the Address Book data.
* exposes an unmodifiable `ObservableList<Person>` that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change.
* exposes an Calendar that the Calendar GUI response to any changes made to the Calendar
* does not depend on any of the other three components.

*Method* : GradientDescent.java
Expand All @@ -218,7 +219,7 @@ The `Model`,
=== Storage component

.Structure of the Storage Component
image::StorageClassDiagram.png[width="800"]
image::StorageClassDiagramUpdated.png[width="800"]

*API* : link:{repoURL}/src/main/java/seedu/address/storage/Storage.java[`Storage.java`]

Expand Down
66 changes: 55 additions & 11 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down Expand Up @@ -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

Expand All @@ -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`
Expand Down
Binary file added docs/images/ModelClassDiagramUpdated.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/StorageClassDiagramUpdated.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/UiClassDiagramUpdated.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public AddressBookChangedEvent(ReadOnlyAddressBook data) {
@Override
public String toString() {
return "number of persons " + data.getPersonList().size() + ", number of tags " + data.getTagList().size()
+ "number of appointment entires " + data.getMyCalendarEntries().size();
+ ", number of appointment entires " + data.getMyCalendarEntries().size();
}
}
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();
}
}
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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import static seedu.address.logic.parser.CliSyntax.PREFIX_START_INTERVAL;

import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.insuranceCalendar.AppointmentEntry;
import seedu.address.model.person.exceptions.DuplicateAppointmentException;
import seedu.address.model.calendar.AppointmentEntry;
import seedu.address.model.calendar.exceptions.DuplicateAppointmentException;

/**
* Adds a appointment to the address book's calendar.
Expand All @@ -20,20 +20,21 @@ public class AddAppointmentCommand extends UndoableCommand {
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds an appointment to the calendar. "
+ "Parameters: "
+ PREFIX_NAME + "NAME "
+ PREFIX_START_INTERVAL + "START DATE "
+ PREFIX_END_INTERVAL + "END DATE "
+ PREFIX_START_INTERVAL + "START DATE TIME "
+ PREFIX_END_INTERVAL + "END DATE TIME"
+ "\nExample: " + COMMAND_WORD + " "
+ PREFIX_NAME + "Meet John "
+ PREFIX_START_INTERVAL + "14/08/2018 "
+ PREFIX_END_INTERVAL + "14/08/2018";
+ PREFIX_START_INTERVAL + "14/08/2018 06:12 "
+ PREFIX_END_INTERVAL + "14/08/2018 07:12 ";

public static final String MESSAGE_SUCCESS = "New Appointment Added: %1$s";
public static final String MESSAGE_DUPLICATE_APPOINTMENT = "This appointment already exists in the calendar";
public static final String MESSAGE_DUPLICATE_APPOINTMENT =
"appointment with the same title already exists in the calendar";

private final AppointmentEntry toAdd;

/**
* Creates an AddCommand to add the specified {@code AppointmentEntry}
* Creates an AddAppointmentCommand to add the specified {@code AppointmentEntry}
*/
public AddAppointmentCommand(AppointmentEntry appointmentEntry) {
requireNonNull(appointmentEntry);
Expand Down
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 src/main/java/seedu/address/logic/commands/LookDateCommand.java
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);
}
}
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);
}
}
}
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);
}
}
Loading

0 comments on commit fa45379

Please sign in to comment.