diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 8580729eb79..215c4616bef 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -209,6 +209,21 @@ The following object diagram illustrates the above: The following sequence diagram shows the addpolicy operation: +### View Client feature + +The view client feature allows users to view the details of a client using their `INDEX` on the GUI. This includes information not included in the client list cards, such as their last met and policy list. + +#### Implementation + +The view client mechanism is facilitated by `DisplayClient` in the model. When any command referring to a client using `INDEX` is executed, this DisplayClient is set to the client that was operated on (or cleared to `null` in the case of `delete` and `clear`). +This is done with the `setDisplayClient()` function in the `Model`, that is also implemented in `Logic`. + + +The sequence diagram below shows the execution of `view 1` to view the details of client at index 1. + + +`MainWindow` handles most of the UI logic in regard to displaying the viewed client on the GUI, including refreshing the `ClientDetailsPanel` and `ClientPolicyTable`. It also sets `DisplayClient` on startup when there is at least one client in the list. + ### \[Proposed\] Undo/redo feature #### Proposed Implementation diff --git a/docs/diagrams/ViewClientSequenceDiagram.puml b/docs/diagrams/ViewClientSequenceDiagram.puml new file mode 100644 index 00000000000..4334f1ed0bb --- /dev/null +++ b/docs/diagrams/ViewClientSequenceDiagram.puml @@ -0,0 +1,67 @@ +@startuml +!include style.puml +skinparam ArrowFontStyle plain + +box Logic LOGIC_COLOR_T1 +participant ":LogicManager" as LogicManager LOGIC_COLOR +participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR +participant ":ViewCommandParser" as ViewCommandParser LOGIC_COLOR +participant "v:ViewCommand" as ViewCommand LOGIC_COLOR +participant "r:CommandResult" as CommandResult LOGIC_COLOR +end box + +box Model MODEL_COLOR_T1 +participant "m:Model" as Model MODEL_COLOR +end box + +[-> LogicManager : execute("view 1") +activate LogicManager + +LogicManager -> AddressBookParser : parseCommand("view 1") +activate AddressBookParser + +create ViewCommandParser +AddressBookParser -> ViewCommandParser +activate ViewCommandParser + +ViewCommandParser --> AddressBookParser +deactivate ViewCommandParser + +AddressBookParser -> ViewCommandParser : parse("1") +activate ViewCommandParser + +create ViewCommand +ViewCommandParser -> ViewCommand +activate ViewCommand + +ViewCommand --> ViewCommandParser : v +deactivate ViewCommand + +ViewCommandParser --> AddressBookParser : v +deactivate ViewCommandParser + +AddressBookParser --> LogicManager : v +deactivate AddressBookParser + +LogicManager -> ViewCommand : execute(m) +activate ViewCommand + +ViewCommand -> Model : setDisplayClient(personToView) +activate Model + +Model --> ViewCommand +deactivate Model + +create CommandResult +ViewCommand -> CommandResult +activate CommandResult + +CommandResult --> ViewCommand +deactivate CommandResult + +ViewCommand --> LogicManager : r +deactivate ViewCommand + +[<--LogicManager +deactivate LogicManager +@enduml