From 5a2d4372c8f1a435cfce90250c064925621b5150 Mon Sep 17 00:00:00 2001 From: quahkk Date: Thu, 24 Oct 2024 19:28:29 +0800 Subject: [PATCH 01/10] Update UML diagram in ModelClassDiagram and BetterModelClassDiagram --- docs/diagrams/BetterModelClassDiagram.puml | 11 +++++++---- docs/diagrams/ModelClassDiagram.puml | 15 +++++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/docs/diagrams/BetterModelClassDiagram.puml b/docs/diagrams/BetterModelClassDiagram.puml index 598474a5c82..3fefba4533d 100644 --- a/docs/diagrams/BetterModelClassDiagram.puml +++ b/docs/diagrams/BetterModelClassDiagram.puml @@ -14,8 +14,11 @@ UniquePersonList -right-> Person Person -up-> "*" Tag -Person *--> Name -Person *--> Phone -Person *--> Email -Person *--> Address +Person *--> "1" Name +Person *--> "1" Phone +Person *--> "1" Email +Person *--> "1" Address +Person *--> "1" TelegramUsername +Person *--> "*" Lesson +Person *--> "1" RemarkList @enduml diff --git a/docs/diagrams/ModelClassDiagram.puml b/docs/diagrams/ModelClassDiagram.puml index 0de5673070d..0818eb6a2a5 100644 --- a/docs/diagrams/ModelClassDiagram.puml +++ b/docs/diagrams/ModelClassDiagram.puml @@ -19,6 +19,9 @@ Class Email Class Name Class Phone Class Tag +Class TelegramUsername +Class Lesson +Class RemarkList Class I #FFFFFF } @@ -37,11 +40,14 @@ UserPrefs .up.|> ReadOnlyUserPrefs AddressBook *--> "1" UniquePersonList UniquePersonList --> "~* all" Person -Person *--> Name -Person *--> Phone -Person *--> Email -Person *--> Address +Person *--> "1" Name +Person *--> "1" Phone +Person *--> "1" Email +Person *--> "1" Address Person *--> "*" Tag +Person *--> "1" TelegramUsername +Person *--> "*" Lesson +Person *--> "1" RemarkList Person -[hidden]up--> I UniquePersonList -[hidden]right-> I @@ -49,6 +55,7 @@ UniquePersonList -[hidden]right-> I Name -[hidden]right-> Phone Phone -[hidden]right-> Address Address -[hidden]right-> Email +TelegramUsername -[hidden]right-> Tag ModelManager --> "~* filtered" Person @enduml From cf843863f617d5918ff0dcfc44446905a8f7b984 Mon Sep 17 00:00:00 2001 From: quahkk Date: Thu, 24 Oct 2024 22:20:47 +0800 Subject: [PATCH 02/10] Change 'seedu' to 'tuteez' in DG --- docs/DeveloperGuide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 07c267bcc89..2fc5374275e 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -150,7 +150,7 @@ The `Storage` component, ### Common classes -Classes used by multiple components are in the `seedu.address.commons` package. +Classes used by multiple components are in the `tuteez.address.commons` package. -------------------------------------------------------------------------------------------------------------------- From 35076e95c1cd013e4e6699502d8fa88088ebc30b Mon Sep 17 00:00:00 2001 From: weijian Date: Thu, 24 Oct 2024 22:25:05 +0800 Subject: [PATCH 03/10] Add UML diagram for command box --- docs/DeveloperGuide.md | 16 ++++++++++ docs/diagrams/CommandBoxSequenceDiagram.puml | 31 ++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 docs/diagrams/CommandBoxSequenceDiagram.puml diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 07c267bcc89..b2b41736646 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -73,6 +73,22 @@ The **API** of this component is specified in [`Ui.java`](https://github.com/se- 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. +#### Command Box Component + +The `CommandBox` component is responsible for handling user command inputs. Below is the sequence diagram illustrating how the `CommandBox` processes user commands: + + + +The command execution flow: +1. When the user types a command and presses Enter, the `CommandBox` retrieves the command text from the `TextField`. +2. If the command is not empty, it is passed to the `CommandExecutor` for execution. +3. Upon successful execution: + - The command is added to the `CommandHistory` for tracking previous commands + - The text field is cleared +4. If a `CommandException` or `ParseException` occurs: + - The command box styling is updated to indicate the error + - The error style class is added to the text field + 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, diff --git a/docs/diagrams/CommandBoxSequenceDiagram.puml b/docs/diagrams/CommandBoxSequenceDiagram.puml new file mode 100644 index 00000000000..6c94ab2449b --- /dev/null +++ b/docs/diagrams/CommandBoxSequenceDiagram.puml @@ -0,0 +1,31 @@ +@startuml +!include style.puml +skinparam ArrowFontStyle plain + +box UI UI_COLOR_T1 +participant ":CommandBox" as CommandBox UI_COLOR +participant ":CommandExecutor" as CommandExecutor UI_COLOR +participant ":CommandHistory" as CommandHistory UI_COLOR +participant ":TextField" as TextField UI_COLOR +end box + + +[-> CommandBox: handleCommandEntered() +CommandBox -> TextField: getText() +TextField --> CommandBox: commandText + +alt commandText is empty + CommandBox --> CommandBox: return +else commandText not empty + CommandBox -> CommandExecutor: execute(commandText) + CommandExecutor --> CommandBox: return CommandResult + CommandBox -> CommandHistory: add(commandText) + CommandBox -> TextField: setText("") +end + +alt CommandException or ParseException + CommandExecutor -> CommandBox: throw exception + CommandBox -> CommandBox: setStyleToIndicateCommandFailure() + CommandBox -> TextField: getStyleClass().add(ERROR_STYLE_CLASS) +end +@enduml \ No newline at end of file From 938cdb9aae5292ae90a9386c23673b693d8d8a10 Mon Sep 17 00:00:00 2001 From: weijian Date: Thu, 24 Oct 2024 22:29:30 +0800 Subject: [PATCH 04/10] Add new line --- docs/diagrams/CommandBoxSequenceDiagram.puml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/diagrams/CommandBoxSequenceDiagram.puml b/docs/diagrams/CommandBoxSequenceDiagram.puml index 6c94ab2449b..345c75c933f 100644 --- a/docs/diagrams/CommandBoxSequenceDiagram.puml +++ b/docs/diagrams/CommandBoxSequenceDiagram.puml @@ -28,4 +28,4 @@ alt CommandException or ParseException CommandBox -> CommandBox: setStyleToIndicateCommandFailure() CommandBox -> TextField: getStyleClass().add(ERROR_STYLE_CLASS) end -@enduml \ No newline at end of file +@enduml From a7a7f49e692bd9130e933e674365eb1d19383cf3 Mon Sep 17 00:00:00 2001 From: potaotototo Date: Thu, 24 Oct 2024 23:01:08 +0800 Subject: [PATCH 05/10] Add sequence diagram for display command --- docs/diagrams/DisplaySequence.puml | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 docs/diagrams/DisplaySequence.puml diff --git a/docs/diagrams/DisplaySequence.puml b/docs/diagrams/DisplaySequence.puml new file mode 100644 index 00000000000..5dcbddd9d92 --- /dev/null +++ b/docs/diagrams/DisplaySequence.puml @@ -0,0 +1,54 @@ +@startuml DisplaySequence + +participant ":LogicManager" as Logic +participant ":DisplayCommand" as Command +participant ":Model" as Model +participant ":PersonList" as PersonList + +alt Display by Index + Logic -> Command : execute(model) + activate Command + + Command -> Model : getFilteredPersonList() + activate Model + Model --> Command : filteredList + deactivate Model + + Command -> Command : getPersonToDisplayByIndex(model, index) + activate Command + alt index >= list.size + Command --> Logic : throw CommandException\n(invalid index) + else valid index + Command -> PersonList : get(index) + activate PersonList + PersonList --> Command : person + deactivate PersonList + end + deactivate Command + +else Display by Name + Logic -> Command : execute(model) + activate Command + + Command -> Command : getPersonToDisplayByName(model, name) + activate Command + Command -> Model : findPersonByName(name) + activate Model + Model --> Command : person + deactivate Model + + alt person == null + Command --> Logic : throw CommandException\n(invalid name) + end + deactivate Command +end + +Command -> Model : displayPerson(person) +activate Model +Model --> Command +deactivate Model + +Command --> Logic : CommandResult +deactivate Command + +@enduml \ No newline at end of file From 6fa551bcbd0bdddd107271aafee6524450d6e9a4 Mon Sep 17 00:00:00 2001 From: potaotototo Date: Thu, 24 Oct 2024 23:17:52 +0800 Subject: [PATCH 06/10] Edit developer guide --- docs/DeveloperGuide.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index ae409f5a188..5699f23fc16 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -209,6 +209,23 @@ How the this feature works: Note that although this is shown as a single step in the diagram above (for simplicity), in the code it takes several interactions (between the command object and the `Model`) to achieve. 1. The result of the command execution is encapsulated as a `CommandResult` object which is returned back from `Logic`. +### Display feature +The `DisplayCommand` allows users to display a specified person in the addressbook. +It uses `DisplayCommandParser` to parse the user input and create an `DisplayCommand` object, which modifies the `lastViewedPerson` object in the `Model`. + +The following sequence diagram illustrates the interactions that take place within the `Logic` component when the user executes the `addRemarkCommand`, taking `execute("remark 1 -a Good progress")` API call as an example. + + + + + +How the this feature works: + +1. When `Logic` is called upon to execute a command, it is passed to an `AddressBookParser` object which in turn creates a parser that matches the command `display` (i.e., `DisplayCommandParser`) and uses it to parse the command. +1. This results in a `Command` object (more precisely, an object of one of its subclasses e.g., `DisplayCommand`) which is executed by the `LogicManager`. +1. The command can communicate with the `Model` when it is executed.
+ Note that although this is shown as a single step in the diagram above (for simplicity), in the code it takes several interactions (between the command object and the `Model`) to achieve. +1. The result of the command execution is encapsulated as a `CommandResult` object which is returned back from `Logic`. ### \[Proposed\] Undo/redo feature From fbcbdd47831f1a92342be49f4076e8d94bd9923a Mon Sep 17 00:00:00 2001 From: potaotototo Date: Thu, 24 Oct 2024 23:31:16 +0800 Subject: [PATCH 07/10] Update UI --- src/main/resources/view/DisplayCardPanel.fxml | 9 +++------ src/main/resources/view/MainWindow.fxml | 15 ++++++++++----- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/resources/view/DisplayCardPanel.fxml b/src/main/resources/view/DisplayCardPanel.fxml index b4a41cedad7..a9b79488048 100644 --- a/src/main/resources/view/DisplayCardPanel.fxml +++ b/src/main/resources/view/DisplayCardPanel.fxml @@ -3,9 +3,6 @@ - - - - - - + + + \ No newline at end of file diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml index d324182d5dc..13212a889de 100644 --- a/src/main/resources/view/MainWindow.fxml +++ b/src/main/resources/view/MainWindow.fxml @@ -35,12 +35,17 @@ - + - - - - + + + From 41fb8396da9d88fde7c53a4cbc460c0fdbadca49 Mon Sep 17 00:00:00 2001 From: potaotototo Date: Thu, 24 Oct 2024 23:38:46 +0800 Subject: [PATCH 08/10] Fix checkstyle --- src/main/resources/view/DisplayCardPanel.fxml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/view/DisplayCardPanel.fxml b/src/main/resources/view/DisplayCardPanel.fxml index a9b79488048..148b61ac265 100644 --- a/src/main/resources/view/DisplayCardPanel.fxml +++ b/src/main/resources/view/DisplayCardPanel.fxml @@ -5,4 +5,4 @@ - \ No newline at end of file + From f4bd24013703002aad5f82ef879a4689d29b36d1 Mon Sep 17 00:00:00 2001 From: potaotototo Date: Thu, 24 Oct 2024 23:40:03 +0800 Subject: [PATCH 09/10] Fix checkstyle --- docs/AboutUs.md | 2 +- docs/diagrams/DisplaySequence.puml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/AboutUs.md b/docs/AboutUs.md index 7acfe65caf3..ccb58dde660 100644 --- a/docs/AboutUs.md +++ b/docs/AboutUs.md @@ -39,7 +39,7 @@ You can reach us at the email `seer[at]comp.nus.edu.sg` * Role: Developer * Responsibilities: Documentation + IntelliJ expert -### Curtis Chang +### Curtis Chang diff --git a/docs/diagrams/DisplaySequence.puml b/docs/diagrams/DisplaySequence.puml index 5dcbddd9d92..2fc15adc42f 100644 --- a/docs/diagrams/DisplaySequence.puml +++ b/docs/diagrams/DisplaySequence.puml @@ -51,4 +51,5 @@ deactivate Model Command --> Logic : CommandResult deactivate Command + @enduml \ No newline at end of file From 9a32d3ac13ca10452495b7aed40f85f7d5f57758 Mon Sep 17 00:00:00 2001 From: potaotototo Date: Thu, 24 Oct 2024 23:41:06 +0800 Subject: [PATCH 10/10] Fix checkstyle --- docs/diagrams/DisplaySequence.puml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/diagrams/DisplaySequence.puml b/docs/diagrams/DisplaySequence.puml index 2fc15adc42f..416f356fb9c 100644 --- a/docs/diagrams/DisplaySequence.puml +++ b/docs/diagrams/DisplaySequence.puml @@ -51,5 +51,4 @@ deactivate Model Command --> Logic : CommandResult deactivate Command - -@enduml \ No newline at end of file +@enduml