Skip to content

Commit

Permalink
Merge pull request AY2324S2-CS2103T-W12-1#106 from getsquared/update-dg
Browse files Browse the repository at this point in the history
Add view command to DG
  • Loading branch information
ReganChoy authored Mar 29, 2024
2 parents a3f2fba + b69ddb6 commit 8b50b21
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,21 @@ The following object diagram illustrates the above:
The following sequence diagram shows the addpolicy operation:
<puml src="diagrams/AddPolicySequenceDiagram.puml" width="900" />

### 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.
<puml src="diagrams/ViewClientSequenceDiagram.puml" width="900" />

`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
Expand Down
67 changes: 67 additions & 0 deletions docs/diagrams/ViewClientSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8b50b21

Please sign in to comment.