From 9fae1143f86e4040bc4d81f0a51f3f539bb91dcb Mon Sep 17 00:00:00 2001 From: JerryWang0000 Date: Sun, 14 Apr 2024 22:23:47 +0800 Subject: [PATCH 1/6] Update the usage of refresh command --- docs/UserGuide.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 4c482fc8e91..29eb329673c 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -402,12 +402,13 @@ This may result in possible data loss. e.g. Meetings of a person may be deleted. There will be no further prompt after entering the command to refresh meetings of all persons. This action is irreversible and the meeting information that may be deleted cannot be retrieved afterwards. -Deletes all meetings that start before the very moment the user types in the command and enters. +Deletes all meetings that start before the very moment the user types in the command and enters. Notice that only persons currently filtered in the list will be affected. Format: `refresh` * The deleted meetings will be explicitly printed again to the use, specifying content of the meeting and who "owns" the meeting. * If no meetings are deleted, there will no error thrown. Instead, a prompt will be given to user that no meeting is deleted. +* The command will not delete meetings for persons not currently shown in the list due to filter command or find command. If the user wants to execute the command for all persons, type in `list` first to show all persons. Examples: * If there is a meeting `Avengers Assemble` that happened in `31/08/1939 12:00`, when the user types in `refresh`, it will be deleted. From de856fab3ca553c4c3fa2cedb6681d9ea5f6d66e Mon Sep 17 00:00:00 2001 From: JerryWang0000 Date: Sun, 14 Apr 2024 22:28:41 +0800 Subject: [PATCH 2/6] Clean up the white space in documentations --- docs/DeveloperGuide.md | 2 +- docs/UserGuide.md | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index ea352d0597b..b58677c1fcf 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -305,7 +305,7 @@ The main operation for the sort feature is the `updateSortedPersonList(Comparato The following are some explanations for decisions made in the implementation of the sort feature. Need for multiple `Comparator` objects: -This is to keep in view for when other commands or enhancements may need the separate attribute predicates. +This is to keep in view for when other commands or enhancements may need the separate attribute predicates. Need for `MultiComparator` object: This is to map the 1 or more comparator objects and act as a layer of abstraction where `SortCommmand` does need to know how many attributes are used in sorting. diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 29eb329673c..4ee084c8291 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -52,10 +52,9 @@ Before we get started StaffConnect offers a unique suite of UI controls for user 1. Clicking any items on the left contacts panel will allow you to select the person whose attributes and meeting list are to be display.
Alternatively, clicking anywhere in the contacts panel then using your arrow keys to navigate and hitting enter to select would give the same result. -
**Intended Behaviour:** +
**Intended Behaviour:**
Hovering the selection with mouse or arrow keys would not cause the details panel to switch to the selected person. This is to allow users to browse the contacts panel without switching.
![Region to select the person](images/personPanelRegion.png) - 2. There is a divider that is draggable up and down to hide and show details on the right side and to customise the look of your application.
![Region to select the divider](images/detailsDividerRegion.png) @@ -66,19 +65,19 @@ Before we get started StaffConnect offers a unique suite of UI controls for user - __[Left click + Drag Mouse]__ would pan around in the details pane as well. - Keyboard arrow keys are able to pan around as well, but the scroll speed may differ on different systems. - There are scroll bars at the vertical and horizontal dividers of the window pane, dragging them in the respective direction will pan around as well. - + 4. The Result display:
The scroll bars can only be scrolled by two ways: 1. For mouse pad users, dragging around with two fingers the around would pan around the pane. 2. For mouse users, __[Mouse Wheel]__ will scroll up and down while __[Shift + Mouse Wheel]__ will scroll left and right. - 3. Simply dragging the scroll bar with a left mouse click. + 3. Simply dragging the scroll bar with a left mouse click.
**Scrolling by arrow keys is not fully supported in the result display** 5. The Command box:
The input can only be scrolled by __[Holding Left Click + Drag Mouse]__ to the edge in the direction to scroll. This is to allow making adjustments on very long commands. -

+

### Alternative UI arrangements
![first alternative ui](images/firstAlternative.png)
@@ -307,8 +306,8 @@ Deletes a meeting from a person based on specified meeting index. Format: `meeting-delete INDEX i/MEETING-INDEX ` -* Deletes the meeting at specified `MEETING-INDEX` from the person at specified `INDEX`. -* The index refers to the index number shown in the displayed person list. +* Deletes the meeting at specified `MEETING-INDEX` from the person at specified `INDEX`. +* The index refers to the index number shown in the displayed person list. * The index **must be a positive integer** 1, 2, 3,…​ and tally within range index of the displayed person list. * The meeting-index refers to the index number shown in the displayed meeting list. * The meeting-index **must be a positive integer** 1, 2, 3,…​ and tally within range index of the displayed meeting list. @@ -317,7 +316,7 @@ Examples: * The following commands assumes that meetings have been added prior to the command. Otherwise, an error will be thrown.
**(Refer to the section above on how to add a meeting)** * `list` followed by `meeting-delete 1 i/1` deletes the 1st meeting from the 1st person in the list. * `find Bernice Yu` followed by `meeting-delete 1 i/2` deletes the 1st meeting form the 1st person in the results of the `find` command. - +
**Results for delete meeting:**
The following command was applied: `find Bernice Yu` followed by `meeting-delete 1 i/2`.
__(Disclaimer: The content shown in the examples may not match what you have added to your own meetings within the staff book).__ @@ -420,7 +419,7 @@ Examples: ![After refreshing](images/AfterRefreshCommand.png) **Known limitations:** -Refresh is only used when the user decides to remove clutter in the staff book, and wants to remove outdated meetings. +Refresh is only used when the user decides to remove clutter in the staff book, and wants to remove outdated meetings. This process is not done automatically as sometimes the user would like to retain old meetings for bookkeeping purposes. ### Selecting the person to display: `select` @@ -466,7 +465,7 @@ StaffConnect data are saved automatically as a JSON file `[JAR file location]/da
:exclamation: **Caution:** If your changes to the data file makes its format invalid, StaffConnect will discard all data and start with an empty data file at the next run. Hence, it is recommended to take a backup of the file before editing it.
-Furthermore, certain edits can cause StaffConnect to behave in unexpected ways (e.g., if a value entered is outside of the acceptable range). +Furthermore, certain edits can cause StaffConnect to behave in unexpected ways (e.g., if a value entered is outside of the acceptable range). The application will not prompt the user if the format of the data file is incorrect, but instead provide the user with an empty staff book. Therefore, edit the data file only if you are confident that you can update it correctly. From 6891e3ac162cba3b8fc7dea08d290935c7f531d0 Mon Sep 17 00:00:00 2001 From: JerryWang0000 Date: Sun, 14 Apr 2024 22:42:50 +0800 Subject: [PATCH 3/6] Speficy the restriction on the input format of Availability --- docs/UserGuide.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 4ee084c8291..294d7fab364 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -483,11 +483,12 @@ Therefore, edit the data file only if you are confident that you can update it c ## Known issues 1. **When using multiple screens**, if you move the application to a secondary screen, and later switch to using only the primary screen, the GUI will open off-screen. The remedy is to delete the `preferences.json` file created by the application before running the application again. -2. **When adding/editing phone number with a descriptor**, If you try to add a number with a descriptor such as `98731094 (home)`, the application rejects this input and advise the user to only provide phone numbers with numerical values only. The phone number is not intended to store phone number descriptor but users can consider using tags such as t/homePhone as a workaround. -3. **When adding/editing name containing special characters**, If you try to add a name such as `Jason s/o William`, the application rejects this input and advise the user to only provide name with alphanumeric values only. The name is not intended to store special characters but users can consider using `so` or `son of` as a workaround. If a person's name includes special characters (characters not included in modern English) like arabic characters (such as أ, ب, ت, etc.), it should be latinized first. -4. **When adding/editing name that already exists in the staff book**, if you try to do so, an error message will be prompted, as two persons are considered the same person as long as they have the same name. It is inplausible to has two persons with the same name but other different attributes. -5. **When adding/editing venues containing space with an attribute prefix**, If you try to add a venue such as `Room 12 t/r`, the application will add a person with a venue `Room 12` and a tag `r` instead of the intended venue `Room 12 t/r`. The venue is not intended to store venues that contains a space followed by an attribute prefix but users can consider omitting the space or replace with a hyphen such as `Room 12t/r` or `Room 12-t/r` as a workaround. -6. **When generating the default file and exiting via the `Exit` button**, If you try to generate the default JSON file `[JAR file location]/data/staffconnect.json` by running the JAR file, without manipulating any data and exiting via the `Exit` button, the JSON file would not be generated. You may consider using the `exit` command via the command line interface to generate the default JSON file instead. +2. **When adding a new availability to a person**, the allowed formats for time is not as flexible as typing in a meeting start date. The only allowed format is `HH:mm`. `HH` is a valid 24-hour (00-23), `mm` are valid minutes (00-59). +3. **When adding/editing phone number with a descriptor**, If you try to add a number with a descriptor such as `98731094 (home)`, the application rejects this input and advise the user to only provide phone numbers with numerical values only. The phone number is not intended to store phone number descriptor but users can consider using tags such as t/homePhone as a workaround. +4. **When adding/editing name containing special characters**, If you try to add a name such as `Jason s/o William`, the application rejects this input and advise the user to only provide name with alphanumeric values only. The name is not intended to store special characters but users can consider using `so` or `son of` as a workaround. If a person's name includes special characters (characters not included in modern English) like arabic characters (such as أ, ب, ت, etc.), it should be latinized first. +5. **When adding/editing name that already exists in the staff book**, if you try to do so, an error message will be prompted, as two persons are considered the same person as long as they have the same name. It is inplausible to has two persons with the same name but other different attributes. +6. **When adding/editing venues containing space with an attribute prefix**, If you try to add a venue such as `Room 12 t/r`, the application will add a person with a venue `Room 12` and a tag `r` instead of the intended venue `Room 12 t/r`. The venue is not intended to store venues that contains a space followed by an attribute prefix but users can consider omitting the space or replace with a hyphen such as `Room 12t/r` or `Room 12-t/r` as a workaround. +7. **When generating the default file and exiting via the `Exit` button**, If you try to generate the default JSON file `[JAR file location]/data/staffconnect.json` by running the JAR file, without manipulating any data and exiting via the `Exit` button, the JSON file would not be generated. You may consider using the `exit` command via the command line interface to generate the default JSON file instead. -------------------------------------------------------------------------------------------------------------------- ## Attribute summary From 8193021ab1000ccc689afa743348ca645fb13293 Mon Sep 17 00:00:00 2001 From: JerryWang0000 Date: Sun, 14 Apr 2024 22:43:56 +0800 Subject: [PATCH 4/6] Fix a typo --- docs/UserGuide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 294d7fab364..50fa47fb56c 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -483,7 +483,7 @@ Therefore, edit the data file only if you are confident that you can update it c ## Known issues 1. **When using multiple screens**, if you move the application to a secondary screen, and later switch to using only the primary screen, the GUI will open off-screen. The remedy is to delete the `preferences.json` file created by the application before running the application again. -2. **When adding a new availability to a person**, the allowed formats for time is not as flexible as typing in a meeting start date. The only allowed format is `HH:mm`. `HH` is a valid 24-hour (00-23), `mm` are valid minutes (00-59). +2. **When adding/editing an availability to a person**, the allowed formats for time is not as flexible as typing in a meeting start date. The only allowed format is `HH:mm`. `HH` is a valid 24-hour (00-23), `mm` are valid minutes (00-59). 3. **When adding/editing phone number with a descriptor**, If you try to add a number with a descriptor such as `98731094 (home)`, the application rejects this input and advise the user to only provide phone numbers with numerical values only. The phone number is not intended to store phone number descriptor but users can consider using tags such as t/homePhone as a workaround. 4. **When adding/editing name containing special characters**, If you try to add a name such as `Jason s/o William`, the application rejects this input and advise the user to only provide name with alphanumeric values only. The name is not intended to store special characters but users can consider using `so` or `son of` as a workaround. If a person's name includes special characters (characters not included in modern English) like arabic characters (such as أ, ب, ت, etc.), it should be latinized first. 5. **When adding/editing name that already exists in the staff book**, if you try to do so, an error message will be prompted, as two persons are considered the same person as long as they have the same name. It is inplausible to has two persons with the same name but other different attributes. From d25a17acbbf8bc8f0c16a084132c34c4d672c072 Mon Sep 17 00:00:00 2001 From: JerryWang0000 Date: Sun, 14 Apr 2024 22:55:14 +0800 Subject: [PATCH 5/6] Fix a documentation bug not detected before --- docs/DeveloperGuide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index b58677c1fcf..80854e9ca7d 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -166,8 +166,8 @@ The sequence diagram below shows how the edit command `edit 1 p/ 12345678` goes
:information_source: **Note:** The lifeline for `EditCommandParser` should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline continues till the end of diagram.
-1. When the user issues the command `edit 1 p/ 12345678`, `Logic` is called upon to execute the command, it is passed to the `StaffConnectParser` object which creates a `EditCommandParser` to parse the arguments for the edit command. -2. The parsing of `EditCommandParser` results in a new `EditCommand` initialized by an index `int` and a `EditPersonDescriptor`. The datails will be explained later. +1. When the user issues the command `edit 1 p/ 12345678`, `LogicManager` is called upon to execute the command, it is passed to the `StaffConnectParser` object which creates a `EditCommandParser` to parse the arguments for the edit command. +2. The parsing of `EditCommandParser` results in a new `EditCommand` initialized by an integer `index` and a `EditPersonDescriptor`. The datails will be explained later. 3. When the `EditCommand` is executed, it creates a new `Person` object according to the `EditPersonDescriptor` passed to it, and replaces the old `Person` object with the new one. 4. The command communicates with the `Model` when it is executed. More specifically, it calls the `updateFilteredPersonList()` method using a `Predicate` object which simply evaluates to true for all `Person`. The intension is that no `Person` will be filtered out in an edit command. 5. The result of the command execution is encapsulated as a `CommandResult` object which is returned back from `Logic`, to show in the `UI` component the success message that the `Person` at the given index is updated with the new information. From ae6d3ad18f520e8982dbce2149e5c5cfe137f5be Mon Sep 17 00:00:00 2001 From: JerryWang0000 Date: Sun, 14 Apr 2024 23:18:03 +0800 Subject: [PATCH 6/6] Update other parts of the documentations to reflect changes --- docs/DeveloperGuide.md | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 80854e9ca7d..9bb9baf9e59 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -72,6 +72,8 @@ The **API** of this component is specified in [`Ui.java`](https://github.com/AY2 ![Structure of the UI Component](images/UiClassDiagram.png) +The UI interface is implemented by `UiManager`. + 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. 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/AY2324S2-CS2103-F08-3/tp/blob/master/src/main/java/staffconnect/ui/MainWindow.java) is specified in [`MainWindow.fxml`](https://github.com/AY2324S2-CS2103-F08-3/tp/blob/master/src/main/resources/view/MainWindow.fxml) @@ -79,9 +81,9 @@ The `UI` component uses the JavaFx UI framework. The layout of these UI parts ar The `UI` component, * executes user commands using the `Logic` component. -* listens for changes to `Model` data so that the UI can be updated with the modified data. -* keeps a reference to the `Logic` component, because the `UI` relies on the `Logic` to execute commands. -* depends on some classes in the `Model` component, as it displays `Person` object residing in the `Model`. +* listens for changes to data in `Model` component so that the UI can be updated with the modified data. +* keeps a reference to the `Logic` component, because the `UIManager` relies on the `Logic` component to execute commands. +* depends on some classes in the `Model` component, as it displays `Person` object residing in the `Model` component. ### Logic component @@ -100,11 +102,11 @@ The sequence diagram below illustrates the interactions within the `Logic` compo How the `Logic` component works: -1. When `Logic` is called upon to execute a command, it is passed to an `StaffConnectParser` object which in turn creates a parser that matches the command (e.g., `DeleteCommandParser`) and uses it to parse the command. +1. When `LogicManager` is called upon to execute a command, it is passed to an `StaffConnectParser` object which in turn creates a parser that matches the command (e.g., `DeleteCommandParser`) 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., `DeleteCommand`) which is executed by the `LogicManager`. -1. The command can communicate with the `Model` when it is executed (e.g. to delete a person).
+1. The command can communicate with the `Model` component when it is executed (e.g. to delete a person).
Note that although this is shown as a single step in the diagram above (for simplicity), in the code it can take 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`. +1. The result of the command execution is encapsulated as a `CommandResult` object which is returned back from `LogicManger`. Here are the other classes in `Logic` (omitted from the class diagram above) that are used for parsing a user command: @@ -125,7 +127,7 @@ The `Model` component, * stores the staff book data i.e., all `Person` objects (which are contained in a `UniquePersonList` object). * stores the currently 'selected' `Person` objects (e.g., results of a search query) as a separate _filtered_ list which is exposed to outsiders as an unmodifiable `ObservableList` that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change. * stores a `UserPref` object that represents the user’s preferences. This is exposed to the outside as a `ReadOnlyUserPref` objects. -* does not depend on any of the other three components (as the `Model` represents data entities of the domain, they should make sense on their own without depending on other components) +* does not depend on any of the other three components (as the `Model` component represents data entities of the domain, they should make sense on their own without depending on other components)
:information_source: **Note:** An alternative (arguably, a more OOP) model is given below. It has a `Tag` list in the `StaffBook`, which `Person` references. This allows `StaffBook` to only require one `Tag` object per unique tag, instead of each `Person` needing their own `Tag` objects.
@@ -169,8 +171,8 @@ The sequence diagram below shows how the edit command `edit 1 p/ 12345678` goes 1. When the user issues the command `edit 1 p/ 12345678`, `LogicManager` is called upon to execute the command, it is passed to the `StaffConnectParser` object which creates a `EditCommandParser` to parse the arguments for the edit command. 2. The parsing of `EditCommandParser` results in a new `EditCommand` initialized by an integer `index` and a `EditPersonDescriptor`. The datails will be explained later. 3. When the `EditCommand` is executed, it creates a new `Person` object according to the `EditPersonDescriptor` passed to it, and replaces the old `Person` object with the new one. -4. The command communicates with the `Model` when it is executed. More specifically, it calls the `updateFilteredPersonList()` method using a `Predicate` object which simply evaluates to true for all `Person`. The intension is that no `Person` will be filtered out in an edit command. -5. The result of the command execution is encapsulated as a `CommandResult` object which is returned back from `Logic`, to show in the `UI` component the success message that the `Person` at the given index is updated with the new information. +4. The command communicates with the `Model` component when it is executed. More specifically, it calls the `updateFilteredPersonList()` method using a `Predicate` object which simply evaluates to true for all `Person`. The intension is that no `Person` will be filtered out in an edit command. +5. The result of the command execution is encapsulated as a `CommandResult` object which is returned back from `LogicManager`, to show in the `UI` component the success message that the `Person` at the given index is updated with the new information. The below sequence diagram goes into more detail on how the command is parsed in `EditCommandParser`. @@ -186,14 +188,14 @@ The below activity diagram illustrates the process when a user executes a edit c #### Why edit is implemented this way -The command calls `SetPerson()` method in `Model` and then refresh the list of `Person` objects. +The command calls `SetPerson()` method in `Model` component and then refresh the list of `Person` objects. Below are some explanations for some implementation details. Check if `editPersonDescriptor.isAnyFieldEdited()`: -This is to make sure at least one field is modified, or the command will not have any impact on the `Model`. +This is to make sure at least one field is modified, or the command will not have any impact on the `Model` component. Call `model.updateFilteredPersonList())` with a `Predicate` that always evaluates to true: -This is to refresh the list of `Person` in `Model`. +This is to refresh the list of `Person` in `Model` component. ### Find feature @@ -208,8 +210,8 @@ The sequence diagram below explains how the find command `find Alex` goes throug 1. When user types in `find Alex`, it is passed to `StaffConnectParser`. 2. `StaffconnectParser` then creates a `FindCommandParser` that will parse `Alex` to create a `FindCommand` which utilizes a predicate judge whether `Alex` is contained in the person's name. -3. In `FindCommand`, `Model` executes `updateFilteredPersonList()` method using the predicate mentioned above. -4. The result of the command execution is encapsulated as a `CommandResult` object which is returned back from `Logic`, to show in the `UI` component the number of persons listed with `Alex` in the name. +3. In `FindCommand`, `ModelManager` executes `updateFilteredPersonList()` method using the predicate mentioned above. +4. The result of the command execution is encapsulated as a `CommandResult` object which is returned back from `LogicManager`, to show in the `UI` component the number of persons listed with `Alex` in the name. The below sequence diagram goes into more detail on how the command is parsed in `EditCommandParser`. @@ -241,10 +243,10 @@ The sequence diagram below shows how the filter command `filter f/Computing` goe
:information_source: **Note:** The lifeline for `FilterCommandParser` should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline continues till the end of diagram.
-1. When the user issues the command `filter f/Computing`, `Logic` is called upon to execute the command, it is passed to the `StaffConnectParser` object which creates a `FilterCommandParser` to parse the arguments for the filter command. +1. When the user issues the command `filter f/Computing`, `LogicManager` is called upon to execute the command, it is passed to the `StaffConnectParser` object which creates a `FilterCommandParser` to parse the arguments for the filter command. 2. This results in a `FilterCommand` object, which then creates a `Predicate` object. -3. The command communicates with the `Model` when it is executed. More specifically, it calls the `updateFilteredPersonList()` method using the `Predicate` object created earlier as the argument. Note that although it is shown as a single step in the diagram (for simplicity), in the code it takes several. -4. The result of the command execution is encapsulated as a `CommandResult` object which is returned back from `Logic`, to show in the `UI` component the number of persons listed with the `Faculty` value of "Computing". +3. The command communicates with the `Model` component when it is executed. More specifically, it calls the `updateFilteredPersonList()` method using the `Predicate` object created earlier as the argument. Note that although it is shown as a single step in the diagram (for simplicity), in the code it takes several. +4. The result of the command execution is encapsulated as a `CommandResult` object which is returned from `LogicManager`, to show in the `UI` component the number of persons listed with the `Faculty` value of "Computing". The below sequence diagram goes into more detail on how the command is parsed in `FilterCommandParser`.