Skip to content

Commit

Permalink
Merge pull request #292 from belligerentbeagle/246-dg-command-history…
Browse files Browse the repository at this point in the history
…-retrieval-implementation

Add PUML Implementation Diagram for Command History
  • Loading branch information
belligerentbeagle authored Apr 13, 2024
2 parents 66b6f81 + 690aa2d commit cbe1201
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,13 @@ This section describes some noteworthy details on how certain features are imple

### Command History Retrieval

**TODO**
Let's consider the scenario where the user wants to retrieve the last command executed. The user can do this by
pressing the <span class="badge bg-light text-dark"><i class="fa-regular fa-square-caret-up"></i> UP</span> key on
the keyboard.

The <span class="badge bg-light text-dark"><i class="fa-regular fa-square-caret-up"></i> UP</span> key press event is captured by the `CommandBox` class, which then
retrieves the last command from the `CommandHistory` Singleton object.
<puml src="diagrams/CommandHistorySequenceDiagram.puml" alt="Command History Sequence Diagram" />

{{ newPage }}

Expand Down
32 changes: 32 additions & 0 deletions docs/diagrams/CommandHistorySequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

box Command History UI_COLOR_T2
participant ":CommandBox" as Model UI_COLOR_T3
participant ":CommandHistory" as ModelCH UI_COLOR_T3
end box

[-> Model : keyPress(e)
activate Model

Model -> Model : handleKeyPressEvent(e)
Model -> Model : handleArrowKeyPress(e)
activate Model
Model -> ModelCH : getInstance()
activate ModelCH
ModelCH --> Model :
deactivate ModelCH

Model -> ModelCH : getCommandHistory(direction)
activate ModelCH

ModelCH --> Model : previousCommand
deactivate ModelCH

Model -> Model : setText(previousCommand)

[<-- Model
deactivate Model

@enduml

0 comments on commit cbe1201

Please sign in to comment.