Skip to content

Commit

Permalink
Merge origin/develop into write-mark-as-important
Browse files Browse the repository at this point in the history
  • Loading branch information
Skaty committed Oct 19, 2016
2 parents bdaef88 + 49c028e commit 8cbdb04
Show file tree
Hide file tree
Showing 32 changed files with 538 additions and 223 deletions.
20 changes: 10 additions & 10 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
The **_Architecture Diagram_** given above explains the high-level design of the App.
Given below is a quick overview of each component.

`Main` has only one class called [`MainApp`](../src/main/java/seedu/address/MainApp.java). It is responsible for,
`Main` has only one class called [`MainApp`](../src/main/java/seedu/task/MainApp.java). It is responsible for,
* At app launch: Initializes the components in the correct sequence, and connect them up with each other.
* At shut down: Shuts down the components and invoke cleanup method where necessary.

Expand Down Expand Up @@ -94,15 +94,15 @@ The sections below give more details of each component.

<img src="images/UiClassDiagram.png" width="800"><br>

**API** : [`Ui.java`](../src/main/java/seedu/address/ui/Ui.java)
**API** : [`Ui.java`](../src/main/java/seedu/task/ui/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
and they can be loaded using the `UiPartLoader`.

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.<br>
For example, the layout of the [`MainWindow`](../src/main/java/seedu/address/ui/MainWindow.java) is specified in
For example, the layout of the [`MainWindow`](../src/main/java/seedu/task/ui/MainWindow.java) is specified in
[`MainWindow.fxml`](../src/main/resources/view/MainWindow.fxml)

The `UI` component,
Expand All @@ -114,7 +114,7 @@ The `UI` component,

<img src="images/LogicClassDiagram.png" width="800"><br>

**API** : [`Logic.java`](../src/main/java/seedu/address/logic/Logic.java)
**API** : [`Logic.java`](../src/main/java/seedu/task/logic/Logic.java)

1. `Logic` uses the `Parser` class to parse the user command.
2. This results in a `Command` object which is executed by the `LogicManager`.
Expand All @@ -129,7 +129,7 @@ API call.<br>

<img src="images/ModelClassDiagram.png" width="800"><br>

**API** : [`Model.java`](../src/main/java/seedu/address/model/Model.java)
**API** : [`Model.java`](../src/main/java/seedu/task/model/Model.java)

The `Model`,
* stores a `UserPref` object that represents the user's preferences.
Expand All @@ -142,15 +142,15 @@ The `Model`,

<img src="images/StorageClassDiagram.png" width="800"><br>

**API** : [`Storage.java`](../src/main/java/seedu/address/storage/Storage.java)
**API** : [`Storage.java`](../src/main/java/seedu/task/storage/Storage.java)

The `Storage` component,
* can save `UserPref` objects in json format and read it back.
* can save the to-do list data in xml format and read it back.

### Common classes

Classes used by multiple components are in the `seedu.addressbook.commons` package.
Classes used by multiple components are in the `seedu.task.commons` package.

## Implementation

Expand Down Expand Up @@ -200,13 +200,13 @@ We have two types of tests:
These are in the `guitests` package.
2. **Non-GUI Tests** - These are tests not involving the GUI. They include,
1. _Unit tests_ targeting the lowest level methods/classes. <br>
e.g. `seedu.address.commons.UrlUtilTest`
e.g. `seedu.task.commons.UrlUtilTest`
2. _Integration tests_ that are checking the integration of multiple code units
(those code units are assumed to be working).<br>
e.g. `seedu.address.storage.StorageManagerTest`
e.g. `seedu.task.storage.StorageManagerTest`
3. Hybrids of unit and integration tests. These test are checking multiple code units as well as
how the are connected together.<br>
e.g. `seedu.address.logic.LogicManagerTest`
e.g. `seedu.task.logic.LogicManagerTest`
**Headless GUI Testing** :
Thanks to the [TestFX](https://github.com/TestFX/TestFX) library we use,
our GUI tests can be run in the _headless_ mode.
Expand Down
22 changes: 16 additions & 6 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* **`add`**`meeting`: adds a task named CS2103 Tutorial
* **`find`**`meeting `: searches the task named tutorial
* **`delete`**`1`: delete the first task in the list
* **`complete`** `1`: mark the first task as completed
* **`update`**`1 presentation c/10/10/2016:1200` : updates first task on the list to presentation having a deadline on 10/10/2016 on 12:00 while the number '1' is the index of task on the list
* **`undo`** : undo previous one action
* **`pin`**`1` : pin the first task in the list
Expand All @@ -42,10 +43,9 @@
Adds a task to the to-do list<br>
Format: `add TASK_NAME [s/START_DATE:START_TIME c/CLOSE_DATE:CLOSE_TIME t/TAG]`

> Date format of START_DATE and CLOSE_DATE is DD-MM-YYYY:HHMM e.g. 01/10/2016:2100
> This is only the standard date time format. There is flexibility on the datetime format. You can use both type of date time format.
> Date format of START_DATE and CLOSE_DATE includes words like today, tomorrow, 3 days from now, day after tomorrow, noon, 12pm, 6am
* `TASK_NAME` must be unique.
* `TASK_NAME` need not be unique.
* If there is no argument, the task will become floating.
* `START_DATE` refer to the starting date and time of an event. For a task, the timestamp will be automatically saved as start date and time when the task is created. User can input start date and time for events.
* `TAG` is for users to write tags for different tasks. Mulitple tags are available by typing `t/TAG t/TAG`.
Expand All @@ -59,8 +59,7 @@ Examples:
* `add quiz t/cs2102 t/easy` <br> Adds a flaoting task named tutorial with a tag CS2012 and easy

Examples on date time flexibility:
* `add project three days from now` <br> Adds a project task three days later from the time you input this command
* `add meet with friends in three days` <br> Adds meet with friend as a task three days later from the time you input this command
* `add project c/3 days from now` <br> Adds a project task three days later from the time you input this command

#### Deleting a task : `delete`
Deletes a specific task by task name or index from the to-do list.<br>
Expand All @@ -74,6 +73,16 @@ Examples:
* `delete 1`<br>
Deletes the first task in the to-do list.

#### Marking a task as completed: `complete`
Marks a specific task by index from the to-do list.<br>
FormatL `complete INDEX`

> * INDEX refers to the number appears on the list in front the task name.
Example:
* `complete 2`<br>
Marks the second task on the list as completed.

#### Listing all persons : `list`
Shows a list of tasks and events in the todo list.<br>
Format: `list`
Expand Down Expand Up @@ -147,7 +156,7 @@ There is no need to save manually.
## FAQ
**Q**: Can I add event which have a start date and time to my to-do list ?<br>

**A**: Yes, you can create an event by typing command with a start and end date. For example, you have a trip from 10/10/2016 8:00 to 13/10/2016 21:00. You can type command like this: `add trip s/10/10/2016:0800 c/13/10/2016:2100`.
**A**: Yes, you can create an event by typing command with a start and end date. For example, you have a trip from 10/10/2016 8:00 to 13/10/2016 21:00. You can type command like this: `add trip s/8am 10th October c/9pm 13th October`.

**Q**: If I don't know the deadline of my task yet, can I still add my task?<br>

Expand All @@ -162,6 +171,7 @@ Command | Format
-------- | :--------
Add | `add TASK_NAME [s/START_DATE:START_TIME c/CLOSE_DATE:CLOSE_TIME t/TAG]`
Delete | `delete TASK_NAME` or `delete INDEX`
Complete | `complete INDEX`
List | `list`
Find | `find KEYWORD` or `find t/TAG`
Update | `update INDEX [TASKNAME s/START_DATE:START_TIME c/CLOSE_DATE:CLOSE_TIME t/TAG rt/TO_REMOVE_TAG]`
Expand Down
4 changes: 2 additions & 2 deletions docs/UsingGradle.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Gradle commands look like this:
## Creating the JAR file

* **`shadowJar`** <br>
Creates the `addressbook.jar` file in the `build/jar` folder, _if the current file is outdated_.<br>
Creates the `taskmanager.jar` file in the `build/jar` folder, _if the current file is outdated_.<br>
e.g. `./gradlew shadowJar`

> To force Gradle to create the JAR file even if the current one is up-to-date, you can '`clean`' first. <br>
Expand All @@ -56,7 +56,7 @@ If we package only our own class files into the JAR file, it will not work prope
Runs all tests in the `guitests` package

* **`nonGuiTests`**<br>
Runs all non-GUI tests in the `seedu.address` package
Runs all non-GUI tests in the `seedu.task` package

* **`headless`**<br>
Sets the test mode as _headless_.
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/seedu/task/logic/commands/AddCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ public class AddCommand extends Command {
public static final String COMMAND_WORD = "add";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a task to the task list. "
+ "Parameters: NAME [t/TAG]...\n"
+ "Parameters: NAME s/start-datetime c/closedatetime [t/TAG]...\n"
+ "Example: " + COMMAND_WORD
+ " Finish CS2103";
//TODO: o/OPENTIME c/CLOSETIME i/IMPORTANCE
//TODO: o/OPENTIME c/CLOSETIME
public static final String MESSAGE_SUCCESS = "New task added: %1$s";
public static final String MESSAGE_DUPLICATE_TASK = "This task already exists in the task list";

Expand All @@ -30,19 +30,19 @@ public class AddCommand extends Command {
*
* @throws IllegalValueException if any of the raw values are invalid
*/
public AddCommand(String name, Set<String> tags) //String openTime, String closeTime, String importance, )
public AddCommand(String name, String openTime, String closeTime, Set<String> tags)
throws IllegalValueException {
final Set<Tag> tagSet = new HashSet<>();
for (String tagName : tags) {
tagSet.add(new Tag(tagName));
}
this.toAdd = new Task(
new Name(name),
//new DateTime(openTime),
//new DateTime(closeTime),
//new Boolean(importance),
new UniqueTagList(tagSet),
false
new DateTime(openTime),
new DateTime(closeTime),
false,
false,
new UniqueTagList(tagSet)
);
}

Expand Down
47 changes: 47 additions & 0 deletions src/main/java/seedu/task/logic/commands/CompleteCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package seedu.task.logic.commands;

import seedu.task.commons.core.Messages;
import seedu.task.commons.core.UnmodifiableObservableList;
import seedu.task.commons.exceptions.IllegalValueException;
import seedu.task.model.task.Task;
import seedu.task.model.task.ReadOnlyTask;

public class CompleteCommand extends Command {

public static final String COMMAND_WORD = "complete";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Marks the task identified by the index number used in the last task listing as completed.\n"
+ "Parameters: INDEX (must be a positive integer)\n" + "Example: " + COMMAND_WORD + " 1";

public static final String MESSAGE_COMPLETE_TASK_SUCCESS = "Completed Task: %1$s";

public final int targetIndex;

public CompleteCommand(int targetIndex) {
this.targetIndex = targetIndex;
}

@Override
public CommandResult execute() {
UnmodifiableObservableList<ReadOnlyTask> lastShownList = model.getFilteredTaskList();

if (lastShownList.size() < targetIndex) {
indicateAttemptToExecuteIncorrectCommand();
return new CommandResult(Messages.MESSAGE_INVALID_TASK_DISPLAYED_INDEX);
}

ReadOnlyTask orginialTask = lastShownList.get(targetIndex - 1);
try {
Task completedTask = new Task(orginialTask);
completedTask.setIsCompleted(true);
model.completeTask(orginialTask, completedTask);
} catch (IllegalValueException e) {
assert false : "Impossible";
}



return new CommandResult(String.format(MESSAGE_COMPLETE_TASK_SUCCESS, orginialTask));
}
}
12 changes: 8 additions & 4 deletions src/main/java/seedu/task/logic/commands/PinCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import seedu.task.commons.core.Messages;
import seedu.task.commons.core.UnmodifiableObservableList;
import seedu.task.commons.exceptions.IllegalValueException;
import seedu.task.model.task.Task;
import seedu.task.model.task.ReadOnlyTask;

Expand Down Expand Up @@ -31,10 +32,13 @@ public CommandResult execute() {
}

ReadOnlyTask orginialTask = lastShownList.get(targetIndex - 1);
Task taskToPin = new Task(orginialTask.getName(), orginialTask.getTags(), orginialTask.getImportance());

taskToPin.setIsImportant(true);
model.pinTask(orginialTask, taskToPin);
try {
Task taskToPin = new Task(orginialTask);
taskToPin.setIsImportant(true);
model.pinTask(orginialTask, taskToPin);
} catch (IllegalValueException e) {
assert false : "Not possible for task on list to have illegal value";
}

return new CommandResult(String.format(MESSAGE_PIN_TASK_SUCCESS, orginialTask));
}
Expand Down
24 changes: 18 additions & 6 deletions src/main/java/seedu/task/logic/commands/UpdateCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,21 @@ public class UpdateCommand extends Command {
public final int targetIndex;

private final Name newTaskName;
private final DateTime openTime;
private final DateTime closeTime;
private final Set<String> removedTags;
private final UniqueTagList newTaskTags;

public UpdateCommand(int targetIndex, String name, Set<String> tagsToAdd, Set<String> tagsToRemove) throws IllegalValueException {
public UpdateCommand(int targetIndex, String name, String openTime, String closeTime, Set<String> tagsToAdd, Set<String> tagsToRemove) throws IllegalValueException {
this.targetIndex = targetIndex;
this.newTaskName = (name.isEmpty()) ? null : new Name(name);

final Set<Tag> tagSet = new HashSet<>();
for (String tagName : tagsToAdd) {
tagSet.add(new Tag(tagName));
}
this.openTime = new DateTime(openTime);
this.closeTime = new DateTime(closeTime);

this.newTaskTags = new UniqueTagList(tagSet);
this.removedTags = tagsToRemove;
Expand Down Expand Up @@ -71,11 +75,19 @@ public CommandResult execute() {
}
}

Task newTask = new Task(
updatedTaskName,
newTaskTags,
taskToUpdate.getImportance()
);
Task newTask;
try {
newTask = new Task(
updatedTaskName,
openTime,
closeTime,
taskToUpdate.getImportance(),
taskToUpdate.getComplete(),
newTaskTags
);
} catch (IllegalValueException e1) {
return new CommandResult(e1.getMessage());
}

assert model != null;
try {
Expand Down

0 comments on commit 8cbdb04

Please sign in to comment.