diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md
index 6385562f33c..47df6ac65af 100644
--- a/docs/DeveloperGuide.md
+++ b/docs/DeveloperGuide.md
@@ -67,20 +67,20 @@ The sections below give more details of each component.
### UI component
-The **API** of this component is specified in [`Ui.java`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/ui/Ui.java)
+The **API** of this component is specified in [`Ui.java`](https://github.com/AY2324S1-CS2103T-W15-2/tp/blob/master/src/main/java/seedu/address/ui/Ui.java)
The UI consists of a `MainWindow` that is made up of parts e.g.`CommandBox`, `ResultDisplay`, `PersonListPanel`, `StatusBarFooter` etc. All these, including the `MainWindow`, inherit from the abstract `UiPart` class which captures the commonalities between classes that represent parts of the visible GUI.
-The `UI` component uses the 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 [`MainWindow`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/ui/MainWindow.java) is specified in [`MainWindow.fxml`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/resources/view/MainWindow.fxml)
+The `UI` component uses the 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 [`MainWindow`](https://github.com/AY2324S1-CS2103T-W15-2/tp/blob/master/src/main/java/seedu/address/ui/MainWindow.java) is specified in [`MainWindow.fxml`](https://github.com/AY2324S1-CS2103T-W15-2/tp/blob/master/src/main/resources/view/MainWindow.fxml)
The `UI` component,
* executes user commands using the `Logic` component.
* listens for changes to `Model` data so that the UI can be updated with the modified data.
* keeps a reference to the `Logic` component, because the `UI` relies on the `Logic` to execute commands.
-* depends on some classes in the `Model` component, as it displays `Person` object residing in the `Model`.
+* depends on some classes in the `Model` component, as it displays [`Displayable`](https://github.com/AY2324S1-CS2103T-W15-2/tp/blob/master/src/main/java/seedu/address/ui/Displayable.java) object residing in the `Model`.
### Logic component
@@ -138,14 +138,14 @@ The `Model` component,
### Storage component
-**API** : [`Storage.java`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/storage/Storage.java)
+**API** : [`ProfBookStorageManager.java`](https://github.com/AY2324S1-CS2103T-W15-2/tp/blob/master/src/main/java/seedu/address/storage/ProfBookStorageManager.java)
The `Storage` component,
-* can save both address book data and user preference data in JSON format, and read them back into corresponding objects.
-* inherits from both `AddressBookStorage` and `UserPrefStorage`, which means it can be treated as either one (if only the functionality of only one is needed).
-* depends on some classes in the `Model` component (because the `Storage` component's job is to save/retrieve objects that belong to the `Model`)
+* can save both ProfBook data and user preference data in JSON format, and read them back into corresponding objects.
+* inherits from both `ProfBookStorage` and `UserPrefStorage`, which means it can be treated as either one (if only the functionality of only one is needed).
+* depends on some classes in the `Model` component (because the `ProfBookStorageManager` component's job is to save/retrieve objects that belong to the `Model`)
### Task component
@@ -478,3 +478,50 @@ testers are expected to do more *exploratory* testing.
1. _{explain how to simulate a missing/corrupted file, and the expected behavior}_
1. _{ more test cases … }_
+
+
+
+--------------------------------------------------------------------------------------------------------------------
+
+
+
+## **Appendix: Effort**
+
+### **Project Overview**
+
+Our project, ProfBook, underwent a significant transformation with the primary objective of providing robust **student organization** and **task management** features. The project also aimed to create a **terminal-like application**, complete with a terminal-like user interface and the ability to navigate through a hierarchical structure.
+
+### **Difficulty Level Challenging**
+
+The project was classified as **challenging** due to:
+
+- **Terminal-Like Functionality:** Creating a terminal-like interface and functionality from scratch was a complex task, requiring a deep understanding of terminal behavior and navigation.
+
+- **Hierarchical Structure:** Our application features a hierarchical structure, with ProfBook serving as the root entity. Under ProfBook, there are groups, and each group contains students. Managing this hierarchical structure added complexity to the project.
+
+- **Diverse Classes:** Unlike AB3, our project needed to handle a more extensive range of classes, including Student, Group, and Task. This expansion added complexity as we had to provide functionality for student organization and task management within the same application.
+
+### **Effort Required**
+
+The project demanded an estimated total effort of **approximately one month**. The effort was distributed across various project phases:
+
+- **Design and Architecture:** This phase focused on designing the terminal-like user interface, defining terminal behavior, and integrating the hierarchical structure. Additionally, it involved accommodating and ensuring the smooth interaction of multiple entity types within the application.
+
+- **Implementation and Coding:** The implementation phase was dedicated to building custom components and functionalities essential for realizing terminal behavior, hierarchical structure navigation, and handling diverse classes.
+
+- **Testing and Quality Assurance:** This critical phase aimed to ensure the terminal-like interface worked seamlessly, the hierarchical structure navigation functionality was error-free, and the application effectively managed the different entity types.
+
+- **Documentation:** Preparing comprehensive documentation was essential for guiding both users and developers in understanding and utilizing the terminal-like application.
+
+### **Effort Savings through Reuse**
+
+A notable aspect of our project was the efficient use of custom components, which contributed to a significant reduction in the overall effort.
+
+- **Path Component:** We introduced the `Path` component, which includes subclasses for managing both **absolute** and **relative** paths. This component played a crucial role in managing navigation and executing dynamic commands within our application.
+
+- **ChildrenManager Component:** The component was instrumental in representing the hierarchical structure in our application. We successfully leveraged this component to perform operations related to child entities, optimizing the handling of students within groups and groups within the ProfBook.
+
+- **TaskListManager Component:** This component streamlines task management and allocation by providing a consistent and unified interface for handling tasks throughout the application.
+
+
+Reusing these components enhanced project efficiency and maintainability.
diff --git a/docs/UserGuide.md b/docs/UserGuide.md
index 2a90c90c8fc..d2af771d430 100644
--- a/docs/UserGuide.md
+++ b/docs/UserGuide.md
@@ -126,17 +126,17 @@ Acceptable values for each parameter:
- must be a non-empty string
+`TASK_INDEX`:
+- must be a valid index starts from 1
+
--------------------------------------------------------------------------------------------------------------------
# General Commands
-### Viewing help : `help` (//TODO Update)
+### Viewing help : `help`
Shows a message explaning how to access the help page.
-// TODO Update
-![help message](images/helpMessage.png)
-
Format: `help`
### Listing all users : `ls`
@@ -187,13 +187,13 @@ Specified path:
#### Output if command fails:
-- Pop up message indicating either:
+- Displays message indicating either:
- Invalid command format
- Invalid path
#### Output if command succeeds:
-- Pop up message indicating successful creation together with information of created student
+- Displays message indicating successful creation together with information of created student
#### To note:
@@ -224,13 +224,13 @@ Specified path:
#### Output if command fails:
-- Pop up message indicating either:
+- Displays message indicating either:
- Invalid command format
- No such target to delete
#### Output if command succeeds
-- Pop up message indicating target successfully removed
+- Displays message indicating target successfully removed
#### Examples:
@@ -243,60 +243,64 @@ Specified path:
### Move students into/out of the group: `mv`
-Moves student from a group to another group
+Moves student from one group to another group
-Format `mv [StudentID] -source [source group] -dest [destination group]`
-
-Acceptable values for each parameter:
-StudentID:
+Format: `mv SPECIFIED_PATH SPECIFIED_PATH`
-- must be a 4 digits number follow with any letter
+#### Acceptable values for each parameter:
-source group:
+SPECIFIED_PATH:
-- must be a valid non-empty string starting with grp-
+- must be a valid path to a student
-destination group:
+SPECIFIED_PATH:
-- must be a valid non-empty string starting with grp-
+- must be a valid path to a group
-Output if command fails
+#### Output if command fails
-- pop up message indicate error when moving student with id 0123Y from grp-1 to grp-2
+- Displays message indicating either:
+ - Invalid command format
+ - No such student to move
+ - Invalid destination path
-Output if command succeeds
+#### Output if command succeeds
-- pop up message indicates successfully moving student with id 0123Y from grp-1 to grp-2
+- Displays message to indicate the successful transfer of a student from one group to another group
-Examples:
-`mv 0123Y -source grp-1 -dest grp-2`
+#### Examples:
+- When user is at the root directory `~` and keys in the following command, student with specified path `~/grp-001/0123Y` will be moved from grp-001 to grp-002:
+ - `mv grp-001/0123Y grp-002`
-- This command will move a student with value id 0123Y within the groups or from Ungroup to Group.
+- When user is at the group directory `~/grp-001` and keys in the following command, student with specified path `~/grp-001/0123Y` will be moved from grp-001 to grp-002:
+ - `mv 0123Y ../grp-002`
### Create Group : `mkdir`
-Creates a group consists of a maximum of five students
+Creates a group consists of students
-Format: `mkdir [groupId]`
+Format: `mkdir PATH_TO_THE_GROUP`
-Acceptable values for each parameter:
-groupId:
+#### Acceptable values for each parameter:
-- groupId must be a non-empty string starting with grp-
+PATH_TO_THE_GROUP:
-Output if command fails
+- must be a valid path to a group
-- pop up message indicates error when creating new group
+#### Output if command fails
-Output if command succeeds
+- Displays message indicating either:
+ - Invalid command format
+ - Invalid path to a group
-- pop up message indicates group with specific groupId was created successfully.
+#### Output if command succeeds
-Examples:
-`mkdir grp-1`
+- Displays message indicating a group was created successfully
+
+#### Examples:
-- This command will create a group with groupId which is a string called 1 and only consists the creator at that
- instance of creating the group
+- When user is at the root directory `~` and keys in the following command, a group with groupId called grp-001 will be created
+ - `mkdir grp-001`
--------------------------------------------------------------------------------------------------------------------
@@ -314,13 +318,13 @@ Format: `todo SPECIFIED_PATH --desc DESCRIPTION --all CATERGORY`
#### Output if command fails:
-- Pop up message indicating either:
+- Displays message indicating either:
- Invalid command format
- Invalid path
#### Output if command succeeds
-- Pop up message indicating todo task created successfully.
+- Displays message indicating todo task created successfully.
#### Examples:
@@ -347,13 +351,13 @@ Format `deadline SPECIFIED_PATH --desc DESCRIPTION --datetime DATE_AND_TIME --al
#### Output if command fails:
-- Pop up message indicating either:
+- Displays message indicating either:
- Invalid command format
- Invalid path
#### Output if command succeeds
-- Pop up message indicating deadline task created successfully.
+- Displays message indicating deadline task created successfully.
#### Examples:
@@ -367,37 +371,63 @@ Format `deadline SPECIFIED_PATH --desc DESCRIPTION --datetime DATE_AND_TIME --al
for the task with description `Assignment 1`, will be allocated to all students in path `~/grp-001`.
- `deadline ~/grp-001 --desc Assignment 1 --datetime 2023-10-11 23:59 --all allStu`
-### Mark/Unmark tasks as completed: `mark`
+### Mark tasks as completed: `mark`
-Marks specific tasks as done for each student/tutorial group
+Marks the specified task as done for the student
-Format: `mark -d [task] -level [student/group] -target [StudentID/groupId] `
+Format: `mark TASK_INDEX`
-Acceptable parameter should be:
-task:
+#### Acceptable parameter should be:
-- must be a valid non empty String
+taskIndex:
-student:
+- must be a valid index starts from 1
-- String should be "student" or "group"
+#### Output if command fails
-StudentID:
+- Displays message indicating either:
+ - Invalid command format
+ - Invalid task index
+ - The display panel is not showing task list
-- must be a valid non empty String starting with
+#### Output if command succeeds
-Output if command fails
+- Displays message indicating mark is done successfully as well as specific task that is marked
-- pop up message saying mark is not done as well as specific task that is unchanged
+#### Examples:
-Output if command succeeds
+- When user is at the group directory `~/grp-001` and keys in the following command, the task list of a student with specified path `~/grp-001/0123Y` will be shown after entering the command `cat 0123Y`. Then, user can mark task by specifying the task index:
+ - `cat 0123Y`
+ - `mark 1`
-- pop up message saying mark is done successfully as well as specific task that is marked
+### Unmark completed task: `unmark`
-Examples:
-`mark -d Assignment 1 -level student -target 0123Y`
+Unmarks the specified task for the student
+
+Format: `unmark TASK_INDEX`
-- This command will mark 0123Y's Assignment 1 as done
+#### Acceptable parameter should be:
+
+task index:
+
+- must be a valid index starts from 1
+
+#### Output if command fails
+
+- Displays message indicating either:
+ - Invalid command format
+ - Invalid task index
+ - The display panel is not showing task list
+
+#### Output if command succeeds
+
+- Displays message indicating unmark is done successfully as well as specific task that is unmarked
+
+#### Examples:
+
+- When user is at the group directory `~/grp-001` and keys in the following command, the task list of a student with specified path `~/grp-001/0123Y` will be shown after entering the command `cat 0123Y`. Then, user can unmark task by specifying the task index:
+ - `cat 0123Y`
+ - `unmark 1`
### Search for Tasks: `find`
@@ -424,6 +454,37 @@ Examples:
- This command will search for the task, grade proposal, depending on the environment the user is in, it will search for
task(s) allocated to a tutorial group or student.
+### Display all tasks: `cat`
+
+Searches for tasks depending on the environment.
+
+Format `cat SPECIFIED_PATH`
+
+Acceptable values for parameter:
+
+Specified Path:
+- must be a valid path
+
+Output if command fails:
+
+If `cat` in root directory
+
+- display updates indicating that tasks cannot be shown within root directory.
+
+If `cat` with invalid parameter
+
+- display updates showing invalid path with user entered Path
+
+Output if command succeeds
+
+- display updates with tasks assigned under input Path
+
+Examples:
+`cat grp-001`, `cat 1234A`
+
+- The first command will display all tasks assigned to group 001
+- The second command will display all tasks that are assigned to student with Id 1234A
+
### Save the data (//TODO update)
ProfBook data are saved in the hard disk automatically after any command that changes the data. There is no need to save
@@ -431,7 +492,7 @@ manually.
### Edit the data file (//TODO update)
-ProfBook data are saved automatically as a JSON file `[JAR file location]/data/ProfBook.json`. Advanced users are
+ProfBook data are saved automatically as a JSON file `[JAR file location]/data/profBook.json`. Advanced users are
welcome to update data directly by editing that data file.
@@ -477,18 +538,19 @@ the data of your previous ProfBook home folder.
(//TODO Update)
## Command summary
+| Action | Format, Examples |
+|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| **Help** | `help` |
+| **List** | `ls` |
+| **Clear** | `clear` |
+| **Exit** | `exit` |
+| **Add** | `touch SPECIFIED_PATH -n NAME -e EMAIL - p PHONE_NUMBER -a ADDRESS`
e.g., `touch stu-200 --name Bob --email bobby@example.com --phone 92929292 --address blk 258 Toa Payoh ` |
+| **Create Group** | `mkdir [groupId]`
e.g., `mkdir grp-1` |
+| **Delete** | `rm SPECIFIED_PATH`
e.g., `rm 0123Y` |
+| **Create Todo** | `todo SPECIFIED_PATH --desc DESCRIPTION --all CATERGORY`
e.g., `todo stu-001 --desc Assignment 1 ` |
+| **Create Deadline** | `deadline SPECIFIED_PATH --desc DESCRIPTION --datetime DATE_AND_TIME --all CATERGORY`
e.g., `deadline stu-001 --desc Assignment 1 --datetime 2023-10-11 23:59 ` |
+| **Mark** | `mark TASK_INDEX`
e.g.,`mark 1` |
+| **Unmark** | `unmark TASK_INDEX`
e.g.,`unmark 2` |
+| **Find** | `find [task]`
e.g., `find grade proposal` |
+| **cat** | `cat SPECIFIED_PATH`
e.g., `cat 1234A, cat grp-001` |
-| Action | Format, Examples |
-|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| **Help** | `help` |
-| **List** | `ls` |
-| **Clear** | `clear` |
-| **Exit** | `exit` |
-| **Add** | `touch SPECIFIED_PATH -n NAME -e EMAIL - p PHONE_NUMBER -a ADDRESS`
e.g., `touch stu-200 --name Bob --email bobby@example.com --phone 92929292 --address blk 258 Toa Payoh ` |
-| **Create Group** | `mkdir [groupId]`
e.g., `mkdir grp-1` |
-| **Delete** | `rm SPECIFIED_PATH`
e.g., `rm 0123Y` |
-| **Create Todo** | `todo SPECIFIED_PATH --desc DESCRIPTION --all CATERGORY`
e.g., `todo stu-001 --desc Assignment 1 ` |
-| **Create Deadline** | `deadline SPECIFIED_PATH --desc DESCRIPTION --datetime DATE_AND_TIME --all CATERGORY`
e.g., `deadline stu-001 --desc Assignment 1 --datetime 2023-10-11 23:59 ` |
-| **Mark** | `mark -d [task] -level [student/group] -target [StudentID/groupId]`
e.g.,`mark -d Assignment 1 -level student -target 0123Y` |
-| **Mark** | `unmark -d [task] -level [student/group] -target [StudentID/groupId]`
e.g.,`unmark -d Assignment 1 -level student -target 0123Y` |
-| **Find** | `find [task]`
e.g., `find grade proposal` |
diff --git a/docs/diagrams/StorageClassDiagram.puml b/docs/diagrams/StorageClassDiagram.puml
index a821e06458c..2efc4a6497b 100644
--- a/docs/diagrams/StorageClassDiagram.puml
+++ b/docs/diagrams/StorageClassDiagram.puml
@@ -11,33 +11,36 @@ Class "<>\nUserPrefsStorage" as UserPrefsStorage
Class JsonUserPrefsStorage
}
-Class "<>\nStorage" as Storage
-Class StorageManager
-
-package "AddressBook Storage" #F4F6F6{
-Class "<>\nAddressBookStorage" as AddressBookStorage
-Class JsonAddressBookStorage
-Class JsonSerializableAddressBook
-Class JsonAdaptedPerson
-Class JsonAdaptedTag
+Class ProfBookStorageManager
+
+package "ProfBook Storage" #F4F6F6{
+Class "<>\nProfBookStorage" as ProfBookStorage
+Class JsonSerializableProfBook
+Class JsonAdaptedStudent
+Class JsonProfBookStorage
+Class JsonAdaptedRoot
+Class JsonAdaptedGroup
+Class "{abstract}\nJsonAdaptedTask" as JsonAdaptedTask
+Class JsonAdaptedDeadline
+Class JsonAdaptedToDo
}
}
Class HiddenOutside #FFFFFF
-HiddenOutside ..> Storage
+HiddenOutside ..> ProfBookStorageManager
-StorageManager .up.|> Storage
-StorageManager -up-> "1" UserPrefsStorage
-StorageManager -up-> "1" AddressBookStorage
-
-Storage -left-|> UserPrefsStorage
-Storage -right-|> AddressBookStorage
+ProfBookStorageManager -down-|> UserPrefsStorage
+ProfBookStorageManager -right-|> ProfBookStorage
JsonUserPrefsStorage .up.|> UserPrefsStorage
-JsonAddressBookStorage .up.|> AddressBookStorage
-JsonAddressBookStorage ..> JsonSerializableAddressBook
-JsonSerializableAddressBook --> "*" JsonAdaptedPerson
-JsonAdaptedPerson --> "*" JsonAdaptedTag
-
+JsonProfBookStorage .up.|> ProfBookStorage
+JsonProfBookStorage ..> JsonSerializableProfBook
+JsonSerializableProfBook --> "1" JsonAdaptedRoot
+JsonAdaptedRoot --> "*" JsonAdaptedGroup
+JsonAdaptedGroup -right-> "*" JsonAdaptedStudent
+JsonAdaptedGroup --> "*" JsonAdaptedTask
+JsonAdaptedStudent --> "*" JsonAdaptedTask
+JsonAdaptedDeadline -up-|> JsonAdaptedTask
+JsonAdaptedToDo -up-|> JsonAdaptedTask
@enduml
diff --git a/docs/diagrams/UiClassDiagram.puml b/docs/diagrams/UiClassDiagram.puml
index 95473d5aa19..d76ea0adc8f 100644
--- a/docs/diagrams/UiClassDiagram.puml
+++ b/docs/diagrams/UiClassDiagram.puml
@@ -7,18 +7,23 @@ skinparam classBackgroundColor UI_COLOR
package UI <>{
Class "<>\nUi" as Ui
Class "{abstract}\nUiPart" as UiPart
+Class "{abstract}\nItemCard" as ItemCard
+Class "{abstract}\nTaskCard" as TaskCard
+Class TodoCard
+Class DeadlineCard
+Class StudentCard
+Class GroupCard
Class UiManager
Class MainWindow
Class HelpWindow
Class ResultDisplay
-Class PersonListPanel
-Class PersonCard
+Class ItemListPanel
Class StatusBarFooter
Class CommandBox
}
package Model <> {
-Class HiddenModel #FFFFFF
+Class HiddenState #FFFFFF
}
package Logic <> {
@@ -32,26 +37,42 @@ UiManager .left.|> Ui
UiManager -down-> "1" MainWindow
MainWindow *-down-> "1" CommandBox
MainWindow *-down-> "1" ResultDisplay
-MainWindow *-down-> "1" PersonListPanel
+MainWindow *-down-> "1" ItemListPanel
MainWindow *-down-> "1" StatusBarFooter
MainWindow --> "0..1" HelpWindow
-PersonListPanel -down-> "*" PersonCard
+ItemListPanel -down-> "*" ItemCard
MainWindow -left-|> UiPart
ResultDisplay --|> UiPart
CommandBox --|> UiPart
-PersonListPanel --|> UiPart
-PersonCard --|> UiPart
+ItemListPanel --|> UiPart
+ItemCard --|> UiPart
StatusBarFooter --|> UiPart
HelpWindow --|> UiPart
-PersonCard ..> Model
+ItemCard ..> Model
UiManager -right-> Logic
MainWindow -left-> Logic
-PersonListPanel -[hidden]left- HelpWindow
+TaskCard -right-|> ItemCard
+DeadlineCard -up-|> TaskCard
+TodoCard -up-|> TaskCard
+
+
+StudentCard -up-|> ItemCard
+GroupCard -up-|> ItemCard
+
+StudentCard -[hidden]left- GroupCard
+GroupCard -[hidden]left- TodoCard
+TodoCard -[hidden]left- DeadlineCard
+
+ItemCard -[hidden]up- UiPart
+
+note right of ItemCard : Model will ensure **ItemListPanel** stores \na single type of card at anytime\n (either TaskCard, StudentCard or GroupCard)
+
+ItemListPanel -[hidden]left- HelpWindow
HelpWindow -[hidden]left- CommandBox
CommandBox -[hidden]left- ResultDisplay
ResultDisplay -[hidden]left- StatusBarFooter
diff --git a/src/main/java/seedu/address/model/profbook/Group.java b/src/main/java/seedu/address/model/profbook/Group.java
index dc0428e7658..dae351fb0b5 100644
--- a/src/main/java/seedu/address/model/profbook/Group.java
+++ b/src/main/java/seedu/address/model/profbook/Group.java
@@ -4,13 +4,11 @@
import java.util.Map;
-import javafx.scene.layout.Region;
import seedu.address.commons.util.ToStringBuilder;
import seedu.address.model.id.GroupId;
import seedu.address.model.id.Id;
import seedu.address.model.taskmanager.TaskList;
import seedu.address.ui.GroupCard;
-import seedu.address.ui.UiPart;
/**
* Encapsulates logic for a group within a tutorial group
@@ -71,7 +69,7 @@ public Group getClone() {
}
@Override
- public UiPart getDisplayCard(int displayedIndex) {
+ public GroupCard getDisplayCard(int displayedIndex) {
return new GroupCard(this, displayedIndex);
}
diff --git a/src/main/java/seedu/address/model/profbook/Student.java b/src/main/java/seedu/address/model/profbook/Student.java
index 4f0b40c9f9f..1872cc91b0e 100644
--- a/src/main/java/seedu/address/model/profbook/Student.java
+++ b/src/main/java/seedu/address/model/profbook/Student.java
@@ -2,12 +2,10 @@
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;
-import javafx.scene.layout.Region;
import seedu.address.commons.util.ToStringBuilder;
import seedu.address.model.id.StudentId;
import seedu.address.model.taskmanager.TaskList;
import seedu.address.ui.StudentCard;
-import seedu.address.ui.UiPart;
/**
* Encapsulates logic for a student's data
@@ -84,7 +82,7 @@ public Address getAddress() {
}
@Override
- public UiPart getDisplayCard(int displayedIndex) {
+ public StudentCard getDisplayCard(int displayedIndex) {
return new StudentCard(this, displayedIndex);
}
diff --git a/src/main/java/seedu/address/model/taskmanager/Deadline.java b/src/main/java/seedu/address/model/taskmanager/Deadline.java
index d5a4eaaa23f..92171bac5aa 100644
--- a/src/main/java/seedu/address/model/taskmanager/Deadline.java
+++ b/src/main/java/seedu/address/model/taskmanager/Deadline.java
@@ -4,9 +4,7 @@
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
-import javafx.scene.layout.Region;
import seedu.address.ui.DeadlineCard;
-import seedu.address.ui.UiPart;
/**
* The Deadline class represents a deadline task for the ProfBook.
@@ -54,7 +52,7 @@ public Deadline clone() {
}
@Override
- public UiPart getDisplayCard(int displayedIndex) {
+ public DeadlineCard getDisplayCard(int displayedIndex) {
return new DeadlineCard(this, displayedIndex);
}
diff --git a/src/main/java/seedu/address/model/taskmanager/ToDo.java b/src/main/java/seedu/address/model/taskmanager/ToDo.java
index d7072e5ff29..57bca270669 100644
--- a/src/main/java/seedu/address/model/taskmanager/ToDo.java
+++ b/src/main/java/seedu/address/model/taskmanager/ToDo.java
@@ -1,8 +1,6 @@
package seedu.address.model.taskmanager;
-import javafx.scene.layout.Region;
import seedu.address.ui.TodoCard;
-import seedu.address.ui.UiPart;
/**
* The ToDo class represents a deadline task for the ProfBook.
@@ -35,7 +33,7 @@ public ToDo clone() {
}
@Override
- public UiPart getDisplayCard(int displayedIndex) {
+ public TodoCard getDisplayCard(int displayedIndex) {
return new TodoCard(this, displayedIndex);
}
diff --git a/src/main/java/seedu/address/ui/DeadlineCard.java b/src/main/java/seedu/address/ui/DeadlineCard.java
index cec15dffe3b..9250a0c5679 100644
--- a/src/main/java/seedu/address/ui/DeadlineCard.java
+++ b/src/main/java/seedu/address/ui/DeadlineCard.java
@@ -1,30 +1,17 @@
package seedu.address.ui;
import javafx.fxml.FXML;
-import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
-import javafx.scene.layout.HBox;
-import javafx.scene.layout.Region;
import seedu.address.model.taskmanager.Deadline;
/**
* An UI component that displays information of a {@code Student}.
*/
-public class DeadlineCard extends UiPart {
+public class DeadlineCard extends TaskCard {
private static final String FXML = "DeadlineCard.fxml";
public final Deadline deadline;
- @FXML
- private HBox cardPane;
- @FXML
- private Label type;
- @FXML
- private CheckBox checkBox;
- @FXML
- private Label index;
- @FXML
- private Label desc;
@FXML
private Label by;
@@ -32,18 +19,9 @@ public class DeadlineCard extends UiPart {
* Creates a {@code PersonCode} with the given {@code Person} and index to display.
*/
public DeadlineCard(Deadline deadline, int displayedIndex) {
- super(FXML);
+ super(deadline.getDesc(), deadline.getStatus(), FXML, displayedIndex);
this.deadline = deadline;
- index.setText(displayedIndex + ". ");
type.setText("Deadline");
- desc.setText(deadline.getDesc());
by.setText(deadline.getDeadline());
- checkBox.setSelected(deadline.getStatus());
- checkBox.setDisable(true);
- if (displayedIndex % 2 == 0) {
- cardPane.setStyle("-fx-background-color: #534531;");
- } else {
- cardPane.setStyle("-fx-background-color: #866937;");
- }
}
}
diff --git a/src/main/java/seedu/address/ui/Displayable.java b/src/main/java/seedu/address/ui/Displayable.java
index b392192c845..472fa07917b 100644
--- a/src/main/java/seedu/address/ui/Displayable.java
+++ b/src/main/java/seedu/address/ui/Displayable.java
@@ -1,7 +1,5 @@
package seedu.address.ui;
-import javafx.scene.layout.Region;
-
/**
* Item that can be displayed on display panel
*/
@@ -9,5 +7,5 @@ public interface Displayable {
/**
* Get card that can display on panel
*/
- public UiPart getDisplayCard(int displayedIndex);
+ public ItemCard getDisplayCard(int displayedIndex);
}
diff --git a/src/main/java/seedu/address/ui/GroupCard.java b/src/main/java/seedu/address/ui/GroupCard.java
index 82f3bc40c93..4c21315d2d3 100644
--- a/src/main/java/seedu/address/ui/GroupCard.java
+++ b/src/main/java/seedu/address/ui/GroupCard.java
@@ -2,24 +2,18 @@
import javafx.fxml.FXML;
import javafx.scene.control.Label;
-import javafx.scene.layout.HBox;
-import javafx.scene.layout.Region;
import seedu.address.model.profbook.Group;
/**
* An UI component that displays information of a {@code Student}.
*/
-public class GroupCard extends UiPart {
+public class GroupCard extends ItemCard {
public static final String DISPLAY_NAME = "<< %1$s >>";
public static final String DISPLAY_ID = "ID: %1$s";
private static final String FXML = "GroupCard.fxml";
public final Group group;
- @FXML
- private HBox cardPane;
- @FXML
- private Label index;
@FXML
private Label name;
@FXML
@@ -29,9 +23,8 @@ public class GroupCard extends UiPart {
* Creates a {@code PersonCode} with the given {@code Person} and index to display.
*/
public GroupCard(Group group, int displayedIndex) {
- super(FXML);
+ super(FXML, displayedIndex);
this.group = group;
- index.setText(displayedIndex + ". ");
id.setText(String.format(DISPLAY_ID, group.getId().toString().toUpperCase()));
name.setText(String.format(DISPLAY_NAME, group.getName().fullName.toUpperCase()));
}
diff --git a/src/main/java/seedu/address/ui/ItemCard.java b/src/main/java/seedu/address/ui/ItemCard.java
new file mode 100644
index 00000000000..e028484ab8b
--- /dev/null
+++ b/src/main/java/seedu/address/ui/ItemCard.java
@@ -0,0 +1,24 @@
+package seedu.address.ui;
+
+import javafx.fxml.FXML;
+import javafx.scene.control.Label;
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.Region;
+
+/**
+ * ItemCard that can be displayed in ItemListPanel.
+ */
+public abstract class ItemCard extends UiPart {
+ @FXML
+ protected HBox cardPane;
+ @FXML
+ protected Label index;
+
+ /**
+ * Construct an ItemCard with fxml and displayedIndex.
+ */
+ public ItemCard(String fxml, int displayedIndex) {
+ super(fxml);
+ index.setText(displayedIndex + ". ");
+ }
+}
diff --git a/src/main/java/seedu/address/ui/StudentCard.java b/src/main/java/seedu/address/ui/StudentCard.java
index 319073a45c4..1c2145879b2 100644
--- a/src/main/java/seedu/address/ui/StudentCard.java
+++ b/src/main/java/seedu/address/ui/StudentCard.java
@@ -2,14 +2,12 @@
import javafx.fxml.FXML;
import javafx.scene.control.Label;
-import javafx.scene.layout.HBox;
-import javafx.scene.layout.Region;
import seedu.address.model.profbook.Student;
/**
* An UI component that displays information of a {@code Student}.
*/
-public class StudentCard extends UiPart {
+public class StudentCard extends ItemCard {
public static final String DISPLAY_NAME = "%1$s";
public static final String DISPLAY_ID = "ID: %1$s";
public static final String DISPLAY_PHONE = "Phone: %1$s";
@@ -19,13 +17,9 @@ public class StudentCard extends UiPart {
public final Student student;
- @FXML
- private HBox cardPane;
@FXML
private Label name;
@FXML
- private Label index;
- @FXML
private Label id;
@FXML
private Label phone;
@@ -38,9 +32,8 @@ public class StudentCard extends UiPart {
* Creates a {@code PersonCode} with the given {@code Person} and index to display.
*/
public StudentCard(Student student, int displayedIndex) {
- super(FXML);
+ super(FXML, displayedIndex);
this.student = student;
- index.setText(displayedIndex + ". ");
id.setText(String.format(DISPLAY_ID, student.getId().toString().toUpperCase()));
name.setText(String.format(DISPLAY_NAME, student.getName().fullName));
phone.setText(String.format(DISPLAY_PHONE, student.getPhone().value));
diff --git a/src/main/java/seedu/address/ui/TaskCard.java b/src/main/java/seedu/address/ui/TaskCard.java
new file mode 100644
index 00000000000..c4c0f7f8c47
--- /dev/null
+++ b/src/main/java/seedu/address/ui/TaskCard.java
@@ -0,0 +1,34 @@
+package seedu.address.ui;
+
+import javafx.fxml.FXML;
+import javafx.scene.control.CheckBox;
+import javafx.scene.control.Label;
+
+
+/**
+ * TaskCard that can be displayed on ItemListPanel.
+ */
+public class TaskCard extends ItemCard {
+
+ @FXML
+ protected Label type;
+ @FXML
+ protected CheckBox checkBox;
+ @FXML
+ protected Label desc;
+
+ /**
+ * Creates a {@code PersonCode} with the given {@code Person} and index to display.
+ */
+ public TaskCard(String descStr, boolean status, String fxml, int displayedIndex) {
+ super(fxml, displayedIndex);
+ desc.setText(descStr);
+ checkBox.setSelected(status);
+ checkBox.setDisable(true);
+ if (displayedIndex % 2 == 0) {
+ cardPane.setStyle("-fx-background-color: #534531;");
+ } else {
+ cardPane.setStyle("-fx-background-color: #866937;");
+ }
+ }
+}
diff --git a/src/main/java/seedu/address/ui/TodoCard.java b/src/main/java/seedu/address/ui/TodoCard.java
index 0ee0437b137..25e6a8a08c7 100644
--- a/src/main/java/seedu/address/ui/TodoCard.java
+++ b/src/main/java/seedu/address/ui/TodoCard.java
@@ -1,46 +1,21 @@
package seedu.address.ui;
-import javafx.fxml.FXML;
-import javafx.scene.control.CheckBox;
-import javafx.scene.control.Label;
-import javafx.scene.layout.HBox;
-import javafx.scene.layout.Region;
import seedu.address.model.taskmanager.ToDo;
/**
* An UI component that displays information of a {@code Student}.
*/
-public class TodoCard extends UiPart {
+public class TodoCard extends TaskCard {
private static final String FXML = "TodoCard.fxml";
public final ToDo todo;
- @FXML
- private HBox cardPane;
- @FXML
- private CheckBox checkBox;
- @FXML
- private Label type;
- @FXML
- private Label index;
- @FXML
- private Label desc;
-
/**
* Creates a {@code PersonCode} with the given {@code Person} and index to display.
*/
public TodoCard(ToDo todo, int displayedIndex) {
- super(FXML);
+ super(todo.getDesc(), todo.getStatus(), FXML, displayedIndex);
this.todo = todo;
- index.setText(displayedIndex + ". ");
type.setText("Todo");
- desc.setText(todo.getDesc());
- checkBox.setSelected(todo.getStatus());
- checkBox.setDisable(true);
- if (displayedIndex % 2 == 0) {
- cardPane.setStyle("-fx-background-color: #534531;");
- } else {
- cardPane.setStyle("-fx-background-color: #866937;");
- }
}
}