Skip to content

Commit

Permalink
Edit UG and DG
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxunn committed Oct 26, 2023
2 parents 895af12 + 3e2b2c1 commit 6bf6509
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 344 deletions.
25 changes: 25 additions & 0 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,18 @@ Classes used by multiple components are in the `seedu.addressbook.commons` packa

This section describes some noteworthy details on how certain features are implemented.

### View Specific Person feature
Step 1: The user launches the application for the first time. The `SampleAddressBook` will be initialised.

Step 2: The user executes `addclient n/John Doe p/98765432 e/[email protected] a/John street, block 123, #01-01` to add a new Client.

Step 3: The user executes a `view 1` command to view the 1st person in the address book. The user’s command is parsed by `ViewCommandParser` which extracts the target index. The `ViewCommand` class is instantiated with the extracted index. `ViewCommand` class interacts with `Model#FilteredPersonList` to verify the validity of the index and retrieve the corresponding person’s details. The command execution would be encapsulated as a `CommandResult` object that is then returned back from `Logic`.

**Note:** If the index given is more than the size of the list or when the index given is 0, `ViewCommand` will not call `Model#view(Person personToView)`. Instead, a `MESSAGE_INVALID_PERSON_DISPLAYED_INDEX` exception will be thrown. The Main Window display continue displaying the `PersonListPanel` UI instead of the `ViewWindow` UI

The following sequence diagram shows how the View Command works:
<img src="diagrams/ViewSequenceDiagram.png" alt= "ViewSequenceDiagram"/>

### \[Proposed\] Undo/redo feature

#### Proposed Implementation
Expand Down Expand Up @@ -545,6 +557,19 @@ testers are expected to do more *exploratory* testing.

1. _{ more test cases …​ }_

### Viewing a person

1. Viewing a person while all persons are being shown

1. Prerequisites: List all persons using the `list` command. Multiple persons in the list.

1. Test case: `view 0`<br>
Expected: Entire list remains displayed. Error details shown in status message. Status bar remains the same.
1. Other incorrect view commands to try: `view`, `view x` (where x is larger than the list size, or x is a negative index)<br>
Expected: Similar to previous.
1. Test case: `view 1`, `view x` (where x is an integer within the size of the list) <br>
Expected: The full details of the first person is displayed. Success message: `Viewed Person Successfully`

### Saving data

1. Dealing with missing/corrupted data files
Expand Down
Binary file modified docs/diagrams/UiClassDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions docs/diagrams/UiClassDiagram.puml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@startuml
!include style.puml
!pragma layout smetana
skinparam arrowThickness 1.1
skinparam arrowColor UI_COLOR_T4
skinparam classBackgroundColor UI_COLOR
Expand All @@ -15,6 +16,7 @@ Class PersonListPanel
Class PersonCard
Class StatusBarFooter
Class CommandBox
Class ViewWindow
}

package Model <<Rectangle>> {
Expand All @@ -35,6 +37,7 @@ MainWindow *-down-> "1" ResultDisplay
MainWindow *-down-> "1" PersonListPanel
MainWindow *-down-> "1" StatusBarFooter
MainWindow --> "0..1" HelpWindow
MainWindow --> "0..1" ViewWindow

PersonListPanel -down-> "*" PersonCard

Expand All @@ -46,6 +49,7 @@ PersonListPanel --|> UiPart
PersonCard --|> UiPart
StatusBarFooter --|> UiPart
HelpWindow --|> UiPart
ViewWindow --|> UiPart

PersonCard ..> Model
UiManager -right-> Logic
Expand Down
Binary file added docs/diagrams/ViewSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 70 additions & 0 deletions docs/diagrams/ViewSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
@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 "d:ViewCommand" as ViewCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":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 --> ViewCommand : v
deactivate ViewCommand

ViewCommandParser --> AddressBookParser : v
deactivate ViewCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
ViewCommandParser -[hidden]-> AddressBookParser
destroy ViewCommandParser

AddressBookParser --> LogicManager : v
deactivate AddressBookParser

LogicManager -> ViewCommand : execute()
activate ViewCommand

ViewCommand -> Model : view(person)
activate Model

Model --> ViewCommand
deactivate Model

create CommandResult
ViewCommand -> CommandResult
activate CommandResult

CommandResult --> ViewCommand
deactivate CommandResult

ViewCommand --> LogicManager : result
deactivate ViewCommand

[<--LogicManager
deactivate LogicManager
@enduml

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
import seedu.address.logic.commands.AddLeadCommand;
import seedu.address.logic.commands.ClearCommand;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.ConvertClientToLeadCommand;
import seedu.address.logic.commands.ConvertLeadToClientCommand;
import seedu.address.logic.commands.DeleteCommand;
import seedu.address.logic.commands.EditCommand;
import seedu.address.logic.commands.ExitCommand;
Expand Down Expand Up @@ -91,14 +89,10 @@ public Command parseCommand(String userInput) throws ParseException {

case ListLeadCommand.COMMAND_WORD:
return new ListLeadCommand();
case ConvertLeadToClientCommand.COMMAND_WORD:
return new ConvertLeadToClientCommandParser().parse(arguments);

case ConvertClientToLeadCommand.COMMAND_WORD:
return new ConvertClientToLeadCommandParser().parse(arguments);

case ViewCommand.COMMAND_WORD:
return new ViewCommandParser().parse(arguments);

default:
logger.finer("This user input caused a ParseException: " + userInput);
throw new ParseException(MESSAGE_UNKNOWN_COMMAND);
Expand Down

This file was deleted.

Loading

0 comments on commit 6bf6509

Please sign in to comment.