diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 9d2aa842dee..70c1a9e11f9 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -77,32 +77,53 @@ and consistent user experience. The UI consists of a `MainWindow` that is made up of the following parts: * `CommandBox` - * Where the user types in his desired command + * Where the user types in his desired command + * Integrates with [`CommandHistory`](#commandhistory-integration) to provide an efficient command-tracking mechanism, allowing users to navigate + through previously entered commands using the `UP` and `DOWN` arrow keys. * `ResultDisplay` - * Where the resulting confirmation of the latest command sent or any corresponding error messages is shown to the user + * Where the resulting confirmation of the latest command sent or any corresponding error messages is shown to the user * `PersonListPanel` - * The panel which holds the list of persons in EduContacts, each person represented by a `PersonCard` + * The panel which holds the list of persons in EduContacts, each person represented by a `PersonCard` * `StatusBarFooter` +<<<<<<< HEAD * Designed to show the save location of EduContacts' data * `PersonDetails` * A section of the UI that renders when a `FindCommand` is run, showing the resulting person's full details +======= + * Designed to show the save location of EduContacts' data +* `PersonDetails` + * A section of the UI that renders when a `FindCommand` is run, showing the resulting person's full details +>>>>>>> 550f0146c8868387d6e04d7b2929482db9d748df * `PersonCard` - * Shows simple and brief details about a person + * Shows simple and brief details about a person * `HelpWindow` - * Displayed by clicking the "Help" button at the top right hand of the screen + * Displayed by clicking the "Help" button at the top right hand of the screen 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 +<<<<<<< HEAD are in the `src/main/resources/view` folder. For example, the layout of the [`MainWindow`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/ui/MainWindow.java) is specified in [`MainWindow.fxml`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/resources/view/MainWindow.fxml) +======= +are in the `src/main/resources/view` folder. For example, the layout of the +[`MainWindow`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/ui/MainWindow.java) +is specified in [`MainWindow.fxml`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/resources/view/MainWindow.fxml) +>>>>>>> 550f0146c8868387d6e04d7b2929482db9d748df -The `UI` component, +**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`. + +#### `CommandHistory` Integration + +The `CommandHistory` class, located in `seedu.address.ui.util`, is responsible for tracking user-entered commands. +It enhances the `CommandBox` functionality by allowing users to navigate through their command history with the +`UP` and `DOWN` arrow keys. This design keeps the command history encapsulated and separate from other UI components, +promoting modularity and adhering to good OOP practices. The stylesheet used for the UI can be found in `src/main/java/resources/view/LightTheme.css`. ### Logic component @@ -147,7 +168,7 @@ How the parsing works: The `Model` component, * stores the contact data i.e., all `Person` objects (which are contained in a `UniquePersonList` object). - * a `Person` object stores `StudentId`, `Name`, `Address`, `Phone`, `Email`, `Tag`, `Course` objects. + * a `Person` object stores `StudentId`, `Name`, `Address`, `Phone`, `Email`, `Role`, `Course` objects. * contains an ArrayList of `Module` objects which is optional. * 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. @@ -155,7 +176,7 @@ The `Model` component, -**Note:** An alternative (arguably, a more OOP) model is given below. It has a `Role` list in the `AddressBook`, which `Person` references. This allows `AddressBook` to only require one `Role` object per unique tag, instead of each `Person` needing their own `Role` objects.
+**Note:** An alternative (arguably, a more OOP) model is given below. It has a `Role` list in the `AddressBook`, which `Person` references. This allows `AddressBook` to only require one `Role` object per unique role, instead of each `Person` needing their own `Role` objects.
@@ -168,10 +189,14 @@ The `Model` component, -The `Storage` component, -* can save both address book data and user preference data in JSON format, and read them back into corresponding objects. -* inherits from both `AddressBookStorage` and `UserPrefStorage`, which means it can be treated as either one (if only the functionality of only one is needed). -* depends on some classes in the `Model` component (because the `Storage` component's job is to save/retrieve objects that belong to the `Model`) +The `Storage` component has a key role in persisting data across user sessions. Specifically, it, +* can save both EduContacts data and user preference data in JSON format. Upon application startup, it reads the saved JSON data back into the app, reconstructing it into the corresponding objects in the `Model` component. + +* inherits from both `EduContactsStorage` and `UserPrefStorage`, which means it can be treated as either one (if only the functionality of only one is needed). + +* depends on some classes in the `Model` component to serialize and deserialize data, because the `Storage` component's job is to save/retrieve objects that belong to the `Model`. This dependency allows it to handle domain-specific structures, like `Person` and `UserPrefs`, ensuring the saved data aligns with the current application state and structure. + +* uses exception handling to manage file I/O issues (e.g., missing or corrupted files) and provides feedback to the user if data loading or saving encounters an issue, ensuring that the application can gracefully handle storage-related errors. ### Common classes diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 1f9b1abb9c8..17da0091a53 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -14,16 +14,16 @@ EduContacts is a **desktop app for Educators in Tertiary Institution to manage c
- -## Table of Contents 1. [Quick start](#quick-start) 2. [Features](#features) - [Viewing help : `help`](#viewing-help-help) - [Adding a person: `add`](#adding-a-person-add) - [Listing all persons : `list`](#listing-all-persons-list) - [Editing a person : `edit`](#editing-a-person-edit) + - [Grading a person : `grade`](#grading-a-person-grade) - [Listing students by certain attributes : `filter`](#listing-students-by-certain-attributes-filter) + - [Adding a module to a student: `module`](#adding-a-module-to-a-student-module) - [Deleting a person : `delete`](#deleting-a-person-delete) - [Clearing all entries : `clear`](#clearing-all-entries-clear) - [Exiting the program : `exit`](#exiting-the-program-exit) @@ -31,9 +31,9 @@ EduContacts is a **desktop app for Educators in Tertiary Institution to manage c 4. [Known issues](#known-issues) 5. [Command summary](#command-summary) ---- -------------------------------------------------------------------------------------------------------------------- +
## Quick start @@ -99,6 +99,7 @@ EduContacts is a **desktop app for Educators in Tertiary Institution to manage c 1. Refer to the [Features](#features) below for details of each command. -------------------------------------------------------------------------------------------------------------------- +
## Features @@ -131,6 +132,10 @@ help ``` ![help message](images/helpMessage.png) +Alternatively, you can click the button on the top right hand corner as indicated here: +![alternative_help](images/alternativeHelp.png) + +
### Adding a person: `add` @@ -138,14 +143,17 @@ Adds a person contact to the EduContacts. Format: ```bash -add ID n/NAME p/PHONE e/EMAIL a/ADDRESS c/COURSE t/TAG +add ID n/NAME p/PHONE e/EMAIL a/ADDRESS c/COURSE r/ROLE ``` Examples: -* `add 87654321 n/Betsy Crowe t/ Student e/betsycrowe@example.com a/Blk 30 Geylang Street 29, #06-40 p/1234567 c/Business Analytics` +* `add 87654321 n/Betsy Crowe t/Student e/betsycrowe@example.com a/Blk 30 Geylang Street 29, #06-40 p/1234567 c/Business Analytics` * `add 12345678 n/John Doe p/98981212 e/johndoe@example.com a/123 Jane Doe Road c/Computer Science t/Student` +* `add 71271222 n/Benson Boon p/89229191 e/benson@example.com a/Blk 12 Benson Street c/Economics t/Student` ![result for 'add command result'](images/addCommandResult.png) +
+ ### Listing all persons : `list` Shows a list of all persons in EduContacts. @@ -154,6 +162,9 @@ Format: ```bash list ``` +![result for 'list command result'](images/listCommandResult.png) + +
### Editing a person : `edit` @@ -164,13 +175,35 @@ Format: edit ID [FIELD_TO_EDIT_PREFIX] [NEW_VALUE] ``` + * Edits a student's details according to the fields specified. * At least one of the optional fields must be provided. * Existing values will be updated to the input values. - Examples: * To edit the module CS2103T to CS2101 of a student with ID 12345678, type `edit 12345678 m/CS2103T CS2101` utilizing the `m/` prefix for modules +* To edit the course of a student with ID 12121212 to Computer Science type `edit 12121212 c/Computer Science` + ![result for 'edit command result'](images/editCommandResult.png) + +
+ +### Adding a grade : `grade` + +Adds a grade to a person's module + +```bash +grade ID m/MODULE g/GRADE +``` + +* Adds a grade to a person according to the specified ID and Module +* Module specified must exist prior to execution grade command +* Acceptable grades: `A+, A, A-, B+, B, B-, C+, C, D+, D, F` +* Existing grade will be updated to the input grade + +Examples: +* `grade 23876767 m/CS2103T g/A` will assign an A grade to the CS2103T module of a Person whose ID is 23876767 + +
### Listing students by certain attributes : `filter` @@ -216,6 +249,23 @@ Examples: ![result for 'find alex david'](images/filterAlexDavidResult.png) +
+ +### Adding a module to a student: `module` + +Adds a module to a specific student using their ID. + +Format: +```bash +module ID m/MODULE +``` + +Examples: +* `module 12345678 m/CS2103T` + ![result for 'add module result'](images/addModule.png) + +
+ ### Deleting a person : `delete` Deletes the specified person from EduContacts. @@ -228,7 +278,23 @@ delete ID * Deletes student with the specified `ID`. Examples: -* `delete 12345678` will delete student contact with `ID: 12345678`. +* `delete 71271222` will delete student contact with `ID: 71271222`. + ![result for 'delete_71271222'](images/filterAlexDavidResult.png) + +
+ +### Finding a person : `find` + +Finds the specified person from EduContacts and displays their details. + +Format: `find ID` + +* Finds student with the specified `ID`. + +Examples: +* `find 12345678` will find student contact with `ID: 12345678` and display their details. + +
### Clearing all entries : `clear` @@ -246,6 +312,8 @@ The `clear` command will erase all contacts from the system. Please ensure that
+
+ ### Exiting the program : `exit` Exits the program. @@ -261,10 +329,14 @@ exit Use the UP and DOWN arrow keys to scroll through previous commands in the Command Box. This feature helps you reuse recent commands without retyping, making it faster to correct or repeat commands. +
+ ### Saving the data EduContacts data are saved in the hard disk automatically after any command that changes the data. There is no need to save manually. +
+ ### Editing the data file EduContacts data are saved automatically as a JSON file `[JAR file location]/data/educontacts.json`. Advanced users are welcome to update data directly by editing that data file. @@ -276,11 +348,14 @@ If your changes to the data file makes its format invalid, EduContacts will disc Furthermore, certain edits can cause the EduContacts to behave in unexpected ways (e.g., if a value entered is outside the acceptable range). Therefore, edit the data file only if you are confident that you can update it correctly. +
+ ### Archiving data files `[coming in v2.0]` _Details coming soon ..._ -------------------------------------------------------------------------------------------------------------------- +
## FAQ @@ -304,15 +379,19 @@ _Details coming soon ..._ 2. **If you minimize the Help Window** and then run the `help` command (or use the `Help` menu, or the keyboard shortcut `F1`) again, the original Help Window will remain minimized, and no new Help Window will appear. The remedy is to manually restore the minimized Help Window. -------------------------------------------------------------------------------------------------------------------- +
## Command summary Action | Format, Examples -----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------- -**Add** | `add ID n/NAME p/PHONE e/EMAIL a/ADDRESS c/COURSE t/TAG`
e.g., `add 12345678 n/John Doe p/99999999 e/johndoe@example.com a/123 Jane Doe Road c/Computer Science t/Student` +**Add** | `add ID n/NAME p/PHONE e/EMAIL a/ADDRESS c/COURSE r/ROLE`
e.g., `add 12345678 n/John Doe p/99999999 e/johndoe@example.com a/123 Jane Doe Road c/Computer Science t/Student` **Clear** | `clear` **Delete** | `delete ID`
e.g., `delete 12345678` -**Edit** | `edit ID [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [c/COURSE] [t/TAG]…​`
e.g.,`edit 12345678 p/91234567 e/johndoe@example.com` -**Filter** | `find [n/NAME] [c/COURSE] [m/MODULE]`
e.g., `find n/James Jake` +**Edit** | `edit ID [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [c/COURSE] [r/ROLE]…​`
e.g.,`edit 12345678 p/91234567 e/johndoe@example.com` +**Grade** | `grade ID m/MODULE g/GRADE`
e.g. `grade 12345678 m/CS2103T g/A` +**Add Module** | `module ID [m/MODULE]`
e.g., `add 12345678 m/CS2103T` +**Filter** | `filter [n/NAME] [c/COURSE] [m/MODULE]`
e.g., `filter n/James Jake` +**Find** | `find ID`
e.g., `find 12345678` **List** | `list` **Help** | `help` diff --git a/docs/diagrams/BetterModelClassDiagram.puml b/docs/diagrams/BetterModelClassDiagram.puml index 5614dff5a9b..885b545e4ea 100644 --- a/docs/diagrams/BetterModelClassDiagram.puml +++ b/docs/diagrams/BetterModelClassDiagram.puml @@ -14,7 +14,7 @@ Person *--> Email Person *--> StudentId Person *--> Address Person *--> Course -Person *--> Tag +Person *--> Role Person *--> "*"Module Module *--> "0..1" Grade diff --git a/docs/diagrams/ModelClassDiagram.puml b/docs/diagrams/ModelClassDiagram.puml index 326a2289288..273907d80d0 100644 --- a/docs/diagrams/ModelClassDiagram.puml +++ b/docs/diagrams/ModelClassDiagram.puml @@ -20,7 +20,7 @@ Class Course Class Email Class Name Class Phone -Class Tag +Class Role Class Module Class Grade @@ -46,7 +46,7 @@ Person *--> Name Person *--> Phone Person *--> Email Person *--> Address -Person *--> "*" Tag +Person *--> "*" Role Person *--> Course Person *--> Module diff --git a/docs/images/Ui.png b/docs/images/Ui.png index f02ea0a9272..b13bd6e8d67 100644 Binary files a/docs/images/Ui.png and b/docs/images/Ui.png differ diff --git a/docs/images/addCommandResult.png b/docs/images/addCommandResult.png new file mode 100644 index 00000000000..09220a068aa Binary files /dev/null and b/docs/images/addCommandResult.png differ diff --git a/docs/images/addModule.png b/docs/images/addModule.png new file mode 100644 index 00000000000..f5cb6f779a3 Binary files /dev/null and b/docs/images/addModule.png differ diff --git a/docs/images/alternativeHelp.png b/docs/images/alternativeHelp.png new file mode 100644 index 00000000000..384044ccfaf Binary files /dev/null and b/docs/images/alternativeHelp.png differ diff --git a/docs/images/deleteCommandResult.png b/docs/images/deleteCommandResult.png new file mode 100644 index 00000000000..9b8502af9e2 Binary files /dev/null and b/docs/images/deleteCommandResult.png differ diff --git a/docs/images/editCommandResult.png b/docs/images/editCommandResult.png new file mode 100644 index 00000000000..cd7f9defa84 Binary files /dev/null and b/docs/images/editCommandResult.png differ diff --git a/docs/images/helpMessage.png b/docs/images/helpMessage.png index 1af17458ccf..5d8e018cafb 100644 Binary files a/docs/images/helpMessage.png and b/docs/images/helpMessage.png differ diff --git a/docs/images/listCommandResult.png b/docs/images/listCommandResult.png new file mode 100644 index 00000000000..dc6c6e1fa75 Binary files /dev/null and b/docs/images/listCommandResult.png differ diff --git a/docs/site.json b/docs/site.json index 9f49b53ca0f..8255dd6dec2 100644 --- a/docs/site.json +++ b/docs/site.json @@ -1,7 +1,6 @@ { "baseUrl": "", "titlePrefix": "EduContacts", - "titleSuffix": "AddressBook Level-3", "faviconPath": "images/SeEduLogo.png", "style": { "codeTheme": "light" diff --git a/src/main/java/seedu/address/logic/Messages.java b/src/main/java/seedu/address/logic/Messages.java index eb0220ac86d..0b9862c4e83 100644 --- a/src/main/java/seedu/address/logic/Messages.java +++ b/src/main/java/seedu/address/logic/Messages.java @@ -57,8 +57,8 @@ public static String format(Person person) { .append(person.getAddress()) .append("; Course: ") .append(person.getCourse()) - .append("; Tag: ") - .append(person.getTag()); + .append("; Role: ") + .append(person.getRole()); return builder.toString(); } diff --git a/src/main/java/seedu/address/logic/commands/AddCommand.java b/src/main/java/seedu/address/logic/commands/AddCommand.java index ceca0a808b9..226e7d6be6f 100644 --- a/src/main/java/seedu/address/logic/commands/AddCommand.java +++ b/src/main/java/seedu/address/logic/commands/AddCommand.java @@ -6,7 +6,7 @@ import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; -import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; +import static seedu.address.logic.parser.CliSyntax.PREFIX_ROLE; import seedu.address.commons.util.ToStringBuilder; import seedu.address.logic.Messages; @@ -29,7 +29,7 @@ public class AddCommand extends Command { + PREFIX_EMAIL + "EMAIL " + PREFIX_ADDRESS + "ADDRESS " + PREFIX_COURSE + "COURSE " - + PREFIX_TAG + "TAG\n" + + PREFIX_ROLE + "ROLE\n" + "Example: " + COMMAND_WORD + " " + "12345678 " + PREFIX_NAME + "John Doe " @@ -37,11 +37,11 @@ public class AddCommand extends Command { + PREFIX_EMAIL + "johnd@example.com " + PREFIX_ADDRESS + "311, Clementi Ave 2, #02-25 " + PREFIX_COURSE + "Computer Science " - + PREFIX_TAG + "Student "; + + PREFIX_ROLE + "Student "; public static final String MESSAGE_SUCCESS = "New person added: %1$s"; - public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in EduContacts"; + public static final String MESSAGE_DUPLICATE_PERSON = "A person with this studentID already exists in EduContacts"; private final Person toAdd; diff --git a/src/main/java/seedu/address/logic/commands/DeleteCommand.java b/src/main/java/seedu/address/logic/commands/DeleteCommand.java index 2304298a825..5257e24ee63 100644 --- a/src/main/java/seedu/address/logic/commands/DeleteCommand.java +++ b/src/main/java/seedu/address/logic/commands/DeleteCommand.java @@ -70,6 +70,7 @@ public CommandResult execute(Model model) throws CommandException { requireNonNull(model); List lastShownList = model.getFilteredPersonList(); Person toDelete = null; + boolean PersonDetailsDeleted = false; for (Person person : lastShownList) { if (person.getStudentId().equals(studentId)) { @@ -83,14 +84,41 @@ public CommandResult execute(Model model) throws CommandException { } if (module != null) { - if (!toDelete.hasModule(module)) { + Module moduleToDelete = null; + for (Module currModule : toDelete.getModules()) { + if (currModule.equals(module)) { + moduleToDelete = currModule; + break; + } + } + + if (moduleToDelete == null) { throw new CommandException(String.format(MESSAGE_MODULE_NOT_FOUND, toDelete.getStudentId())); } - model.deleteModule(toDelete, module); - return new CommandResult(String.format(MESSAGE_DELETE_MODULE_SUCCESS, module.toString())); + + model.deleteModule(toDelete, moduleToDelete); + if (toDelete.isSamePerson(model.getPersonToDisplay())) { + for (Person person : lastShownList) { + if (person.getStudentId().equals(studentId)) { + toDelete = person; + break; + } + } + model.setPersonToDisplay(toDelete); + return new CommandResult(String.format(MESSAGE_DELETE_MODULE_SUCCESS, moduleToDelete), true); + } + return new CommandResult(String.format(MESSAGE_DELETE_MODULE_SUCCESS, moduleToDelete)); + } + + if (toDelete.isSamePerson(model.getPersonToDisplay())) { + model.setPersonToDisplay(null); + PersonDetailsDeleted = true; } model.deletePerson(toDelete); + if (PersonDetailsDeleted) { + return new CommandResult(String.format(MESSAGE_DELETE_PERSON_SUCCESS, Messages.format(toDelete)), true); + } return new CommandResult(String.format(MESSAGE_DELETE_PERSON_SUCCESS, Messages.format(toDelete))); } diff --git a/src/main/java/seedu/address/logic/commands/EditCommand.java b/src/main/java/seedu/address/logic/commands/EditCommand.java index 9da3fc29d6d..4da2b8c1d74 100644 --- a/src/main/java/seedu/address/logic/commands/EditCommand.java +++ b/src/main/java/seedu/address/logic/commands/EditCommand.java @@ -7,7 +7,7 @@ import static seedu.address.logic.parser.CliSyntax.PREFIX_MODULE; import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; -import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; +import static seedu.address.logic.parser.CliSyntax.PREFIX_ROLE; import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS; import java.util.ArrayList; @@ -27,8 +27,8 @@ import seedu.address.model.person.Name; import seedu.address.model.person.Person; import seedu.address.model.person.Phone; +import seedu.address.model.person.Role; import seedu.address.model.person.StudentId; -import seedu.address.model.person.Tag; /** * Edits the details of an existing person in EduContacts. @@ -48,7 +48,7 @@ public class EditCommand extends Command { + "[" + PREFIX_EMAIL + "EMAIL] " + "[" + PREFIX_ADDRESS + "ADDRESS] " + "[" + PREFIX_COURSE + " COURSE] " - + "[" + PREFIX_TAG + "TAG] ...\n" + + "[" + PREFIX_ROLE + "ROLE] ...\n" + "Example: " + COMMAND_WORD + " 12345678 " + PREFIX_PHONE + "91234567 " + PREFIX_EMAIL + "johndoe@example.com" @@ -93,8 +93,14 @@ public CommandResult execute(Model model) throws CommandException { throw new CommandException(MESSAGE_DUPLICATE_PERSON); } + model.setPerson(personToEdit, editedPerson); model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS); + + if (personToEdit.isSamePerson(model.getPersonToDisplay())) { + model.setPersonToDisplay(editedPerson); + return new CommandResult(String.format(MESSAGE_EDIT_PERSON_SUCCESS, Messages.format(editedPerson)), true); + } return new CommandResult(String.format(MESSAGE_EDIT_PERSON_SUCCESS, Messages.format(editedPerson))); } @@ -110,7 +116,7 @@ private static Person createEditedPerson(Person personToEdit, EditPersonDescript Email updatedEmail = editPersonDescriptor.getEmail().orElse(personToEdit.getEmail()); Address updatedAddress = editPersonDescriptor.getAddress().orElse(personToEdit.getAddress()); Course updatedCourse = editPersonDescriptor.getCourse().orElse(personToEdit.getCourse()); - Tag updatedTag = editPersonDescriptor.getTag().orElse(personToEdit.getTag()); + Role updatedRole = editPersonDescriptor.getRole().orElse(personToEdit.getRole()); ArrayList updatedModules = editPersonDescriptor.getModules().orElse(personToEdit.getModules()); if (editPersonDescriptor.hasModuleChanges()) { @@ -118,12 +124,12 @@ private static Person createEditedPerson(Person personToEdit, EditPersonDescript Module newModule = editPersonDescriptor.newModule; boolean isModuleRenamed = false; - if (updatedModules.stream().anyMatch(m -> m.value.equals(newModule.value))) { + if (updatedModules.stream().anyMatch(m -> m.value.toUpperCase().equals(newModule.value.toUpperCase()))) { throw new CommandException(EditCommand.MESSAGE_DUPLICATE_MODULE); } for (int i = 0; i < updatedModules.size(); i++) { - if (updatedModules.get(i).value.equals(oldModule.value)) { + if (updatedModules.get(i).value.toUpperCase().equals(oldModule.value.toUpperCase())) { Module updatedModule = new Module(newModule.value); if (updatedModules.get(i).hasGrade()) { updatedModule.setGrade(updatedModules.get(i).getGrade()); @@ -140,7 +146,7 @@ private static Person createEditedPerson(Person personToEdit, EditPersonDescript } Person editedPerson = new Person(personToEdit.getStudentId(), updatedName, updatedPhone, updatedEmail, - updatedAddress, updatedCourse, updatedTag, updatedModules); + updatedAddress, updatedCourse, updatedRole, updatedModules); return editedPerson; } @@ -180,7 +186,7 @@ public static class EditPersonDescriptor { private Email email; private Address address; private Course course; - private Tag tag; + private Role role; private ArrayList modules; private Module oldModule; private Module newModule; @@ -189,7 +195,7 @@ public EditPersonDescriptor() {} /** * Copy constructor. - * A defensive copy of {@code tags} is used internally. + * A defensive copy of {@code roles} is used internally. */ public EditPersonDescriptor(EditPersonDescriptor toCopy) { setStudentId(null); @@ -198,7 +204,7 @@ public EditPersonDescriptor(EditPersonDescriptor toCopy) { setEmail(toCopy.email); setAddress(toCopy.address); setCourse(toCopy.course); - setTag(toCopy.tag); + setRole(toCopy.role); setModules(toCopy.modules); setOldModule(toCopy.oldModule); setNewModule(toCopy.newModule); @@ -208,7 +214,7 @@ public EditPersonDescriptor(EditPersonDescriptor toCopy) { * Returns true if at least one field is edited. */ public boolean isAnyFieldEdited() { - return CollectionUtil.isAnyNonNull(studentId, name, phone, email, address, course, tag, modules) + return CollectionUtil.isAnyNonNull(studentId, name, phone, email, address, course, role, modules) || hasModuleChanges(); } @@ -277,20 +283,20 @@ public Optional getOldModule() { } /** - * Sets {@code tags} to this object's {@code tags}. - * A defensive copy of {@code tags} is used internally. + * Sets {@code roles} to this object's {@code roles}. + * A defensive copy of {@code roles} is used internally. */ - public void setTag(Tag tag) { - this.tag = tag; + public void setRole(Role role) { + this.role = role; } /** - * Returns an unmodifiable tag set, which throws {@code UnsupportedOperationException} + * Returns an unmodifiable role set, which throws {@code UnsupportedOperationException} * if modification is attempted. - * Returns {@code Optional#empty()} if {@code tags} is null. + * Returns {@code Optional#empty()} if {@code roles} is null. */ - public Optional getTag() { - return Optional.ofNullable(tag); + public Optional getRole() { + return Optional.ofNullable(role); } public void setModules(ArrayList modules) { @@ -321,7 +327,7 @@ public boolean equals(Object other) { && Objects.equals(email, otherEditPersonDescriptor.email) && Objects.equals(address, otherEditPersonDescriptor.address) && Objects.equals(course, otherEditPersonDescriptor.course) - && Objects.equals(tag, otherEditPersonDescriptor.tag) + && Objects.equals(role, otherEditPersonDescriptor.role) && Objects.equals(modules, otherEditPersonDescriptor.modules) && Objects.equals(oldModule, otherEditPersonDescriptor.oldModule) && Objects.equals(newModule, otherEditPersonDescriptor.newModule); @@ -345,7 +351,7 @@ public String toString() { .add("email", email) .add("address", address) .add("course", course) - .add("tags", tag) + .add("roles", role) .add("modules", modules) .add("oldModule", oldModule) .add("newModule", newModule) diff --git a/src/main/java/seedu/address/logic/commands/FilterCommand.java b/src/main/java/seedu/address/logic/commands/FilterCommand.java index ff6a10de046..0e5261f098a 100644 --- a/src/main/java/seedu/address/logic/commands/FilterCommand.java +++ b/src/main/java/seedu/address/logic/commands/FilterCommand.java @@ -11,14 +11,15 @@ /** * Finds and lists all persons in EduContacts whose name matches the specified keywords - * or whose course matches the specified course. - * Keyword matching is case insensitive. + * or whose course matches the specified course + * or whose module matches the specified module. + * Keyword matching is case-insensitive. */ public class FilterCommand extends Command { public static final String COMMAND_WORD = "filter"; - public static final String MESSAGE_USAGE = COMMAND_WORD + ": Finds all persons whose names match " + public static final String MESSAGE_USAGE = COMMAND_WORD + ": Filters all persons whose fields match " + "the specified keywords (case-insensitive) and displays them as a list with index numbers.\n" + "Parameters: NAME_KEYWORD [MORE_NAME_KEYWORDS]...\n" + "or: MODULE_KEYWORD\n" @@ -80,6 +81,7 @@ public CommandResult execute(Model model) { return new CommandResult( String.format(Messages.MESSAGE_PERSONS_LISTED_OVERVIEW, model.getFilteredPersonList().size())); } + @Override public boolean equals(Object other) { if (other == this) { diff --git a/src/main/java/seedu/address/logic/commands/GradeCommand.java b/src/main/java/seedu/address/logic/commands/GradeCommand.java index f6e33391fd7..227406ee750 100644 --- a/src/main/java/seedu/address/logic/commands/GradeCommand.java +++ b/src/main/java/seedu/address/logic/commands/GradeCommand.java @@ -81,6 +81,10 @@ public CommandResult execute(Model model) throws CommandException { Person updatedPerson = person.setModuleGrade(module, grade); model.setPerson(person, updatedPerson); model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS); + if (updatedPerson.isSamePerson(model.getPersonToDisplay())) { + model.setPersonToDisplay(updatedPerson); + return new CommandResult(String.format(MESSAGE_SUCCESS, module), true); + } return new CommandResult(String.format(MESSAGE_SUCCESS, module)); } diff --git a/src/main/java/seedu/address/logic/commands/ModuleCommand.java b/src/main/java/seedu/address/logic/commands/ModuleCommand.java index fe6a5e2e258..4cb2b01ae33 100644 --- a/src/main/java/seedu/address/logic/commands/ModuleCommand.java +++ b/src/main/java/seedu/address/logic/commands/ModuleCommand.java @@ -67,6 +67,7 @@ public CommandResult execute(Model model) throws CommandException { } ArrayList modules = person.getModules(); + if (modules.contains(module)) { throw new CommandException(String.format(MESSAGE_DUPLICATE_MODULE, module.value)); } @@ -74,6 +75,10 @@ public CommandResult execute(Model model) throws CommandException { Person updatedPerson = person.addModule(module); model.setPerson(person, updatedPerson); model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS); + if (updatedPerson.isSamePerson(model.getPersonToDisplay())) { + model.setPersonToDisplay(updatedPerson); + return new CommandResult(String.format(MESSAGE_SUCCESS, studentId), true); + } return new CommandResult(String.format(MESSAGE_SUCCESS, studentId)); } diff --git a/src/main/java/seedu/address/logic/parser/AddCommandParser.java b/src/main/java/seedu/address/logic/parser/AddCommandParser.java index 515fec8deeb..30a3e96f633 100644 --- a/src/main/java/seedu/address/logic/parser/AddCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/AddCommandParser.java @@ -6,7 +6,7 @@ import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; -import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; +import static seedu.address.logic.parser.CliSyntax.PREFIX_ROLE; import java.util.stream.Stream; @@ -18,8 +18,8 @@ import seedu.address.model.person.Name; import seedu.address.model.person.Person; import seedu.address.model.person.Phone; +import seedu.address.model.person.Role; import seedu.address.model.person.StudentId; -import seedu.address.model.person.Tag; /** * Parses input arguments and creates a new AddCommand object @@ -34,7 +34,7 @@ public class AddCommandParser implements Parser { public AddCommand parse(String args) throws ParseException { ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, - PREFIX_ADDRESS, PREFIX_COURSE, PREFIX_TAG); + PREFIX_ADDRESS, PREFIX_COURSE, PREFIX_ROLE); String preamble = argMultimap.getPreamble(); if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_EMAIL, @@ -47,19 +47,19 @@ public AddCommand parse(String args) throws ParseException { PREFIX_ADDRESS, PREFIX_COURSE); argMultimap.verifyNoDuplicateStudentId(args); StudentId studentId = ParserUtil.parseStudentId(preamble); - Name name = ParserUtil.parseName(argMultimap.getValue(PREFIX_NAME).get().toUpperCase()); + Name name = ParserUtil.parseName(argMultimap.getValue(PREFIX_NAME).get()); Phone phone = ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get()); - Email email = ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL).get().toUpperCase()); - Address address = ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get().toUpperCase()); - Course course = ParserUtil.parseCourse(argMultimap.getValue(PREFIX_COURSE).get().toUpperCase()); - Tag tag; - if (argMultimap.getValue(PREFIX_TAG).isPresent()) { - tag = ParserUtil.parseTag(argMultimap.getValue(PREFIX_TAG).get()); + Email email = ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL).get()); + Address address = ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get()); + Course course = ParserUtil.parseCourse(argMultimap.getValue(PREFIX_COURSE).get()); + Role role; + if (argMultimap.getValue(PREFIX_ROLE).isPresent()) { + role = ParserUtil.parseRole(argMultimap.getValue(PREFIX_ROLE).get()); } else { - tag = new Tag("Student"); + role = new Role("Student"); } - Person person = new Person(studentId, name, phone, email, address, course, tag); + Person person = new Person(studentId, name, phone, email, address, course, role); return new AddCommand(person); } diff --git a/src/main/java/seedu/address/logic/parser/ArgumentMultimap.java b/src/main/java/seedu/address/logic/parser/ArgumentMultimap.java index 86535ebb6d7..0b8d3f4e34a 100644 --- a/src/main/java/seedu/address/logic/parser/ArgumentMultimap.java +++ b/src/main/java/seedu/address/logic/parser/ArgumentMultimap.java @@ -90,7 +90,7 @@ public void verifyNoDuplicateStudentId(String input) throws ParseException { if (!token.startsWith("m/") && !token.startsWith("g/") && !token.startsWith("n/") && !token.startsWith("p/") && !token.startsWith("e/") && !token.startsWith("a/") - && !token.startsWith("c/") && !token.startsWith("t/")) { + && !token.startsWith("c/") && !token.startsWith("r/")) { boolean isStudentId = token.matches("^[!?&@]*\\d{7,8}$") || token.matches("^[A-Za-z]\\d{7}[A-Za-z]?$"); diff --git a/src/main/java/seedu/address/logic/parser/CliSyntax.java b/src/main/java/seedu/address/logic/parser/CliSyntax.java index d46550b5969..deef09f2a22 100644 --- a/src/main/java/seedu/address/logic/parser/CliSyntax.java +++ b/src/main/java/seedu/address/logic/parser/CliSyntax.java @@ -11,7 +11,7 @@ public class CliSyntax { public static final Prefix PREFIX_EMAIL = new Prefix("e/"); public static final Prefix PREFIX_ADDRESS = new Prefix("a/"); public static final Prefix PREFIX_COURSE = new Prefix("c/"); - public static final Prefix PREFIX_TAG = new Prefix("t/"); + public static final Prefix PREFIX_ROLE = new Prefix("r/"); public static final Prefix PREFIX_MODULE = new Prefix("m/"); public static final Prefix PREFIX_GRADE = new Prefix("g/"); } diff --git a/src/main/java/seedu/address/logic/parser/EditCommandParser.java b/src/main/java/seedu/address/logic/parser/EditCommandParser.java index 906476893e7..d46afad8492 100644 --- a/src/main/java/seedu/address/logic/parser/EditCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/EditCommandParser.java @@ -8,7 +8,7 @@ import static seedu.address.logic.parser.CliSyntax.PREFIX_MODULE; import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; -import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; +import static seedu.address.logic.parser.CliSyntax.PREFIX_ROLE; import seedu.address.logic.commands.EditCommand; import seedu.address.logic.commands.EditCommand.EditPersonDescriptor; @@ -30,7 +30,7 @@ public EditCommand parse(String args) throws ParseException { requireNonNull(args); ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, - PREFIX_COURSE, PREFIX_TAG, PREFIX_MODULE); + PREFIX_COURSE, PREFIX_ROLE, PREFIX_MODULE); StudentId studentId; try { studentId = ParserUtil.parseStudentId(argMultimap.getPreamble()); @@ -47,29 +47,30 @@ public EditCommand parse(String args) throws ParseException { if (modules.length != 2) { throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditCommand.MESSAGE_USAGE)); } - editPersonDescriptor.setModuleChanges(new Module(modules[0].toUpperCase()), new Module(modules[1])); + editPersonDescriptor.setModuleChanges(new Module(modules[0].toUpperCase()), + new Module(modules[1].toUpperCase())); } else { if (argMultimap.getValue(PREFIX_NAME).isPresent()) { editPersonDescriptor.setName(ParserUtil.parseName(argMultimap.getValue(PREFIX_NAME).get() - .toUpperCase())); + )); } if (argMultimap.getValue(PREFIX_PHONE).isPresent()) { editPersonDescriptor.setPhone(ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get())); } if (argMultimap.getValue(PREFIX_EMAIL).isPresent()) { editPersonDescriptor.setEmail(ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL).get() - .toUpperCase())); + )); } if (argMultimap.getValue(PREFIX_ADDRESS).isPresent()) { editPersonDescriptor.setAddress(ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get() - .toUpperCase())); + )); } if (argMultimap.getValue(PREFIX_COURSE).isPresent()) { editPersonDescriptor.setCourse(ParserUtil.parseCourse(argMultimap.getValue(PREFIX_COURSE).get() - .toUpperCase())); + )); } - if (argMultimap.getValue(PREFIX_TAG).isPresent()) { - editPersonDescriptor.setTag(ParserUtil.parseTag(argMultimap.getValue(PREFIX_TAG).get())); + if (argMultimap.getValue(PREFIX_ROLE).isPresent()) { + editPersonDescriptor.setRole(ParserUtil.parseRole(argMultimap.getValue(PREFIX_ROLE).get())); } } diff --git a/src/main/java/seedu/address/logic/parser/FindCommandParser.java b/src/main/java/seedu/address/logic/parser/FindCommandParser.java index 634d211c2cf..06f2f7ce569 100644 --- a/src/main/java/seedu/address/logic/parser/FindCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/FindCommandParser.java @@ -18,7 +18,7 @@ public class FindCommandParser implements Parser { */ public FindCommand parse(String args) throws ParseException { String trimmedArg = args.trim(); - if (trimmedArg.contains(" ")) { + if (trimmedArg.isEmpty() || trimmedArg.contains(" ")) { throw new ParseException( String.format(MESSAGE_INVALID_COMMAND_FORMAT, FindCommand.MESSAGE_USAGE)); } diff --git a/src/main/java/seedu/address/logic/parser/ModuleCommandParser.java b/src/main/java/seedu/address/logic/parser/ModuleCommandParser.java index 3cfcb7f90fe..b339dfaa79f 100644 --- a/src/main/java/seedu/address/logic/parser/ModuleCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/ModuleCommandParser.java @@ -32,7 +32,7 @@ public ModuleCommand parse(String args) throws ParseException { argMultimap.verifyNoDuplicatePrefixesFor(PREFIX_MODULE); argMultimap.verifyNoDuplicateStudentId(args); StudentId studentId = ParserUtil.parseStudentId(preamble); - Module module = ParserUtil.parseModule(argMultimap.getValue(PREFIX_MODULE).get().toUpperCase()); + Module module = ParserUtil.parseModule(argMultimap.getValue(PREFIX_MODULE).get()); return new ModuleCommand(studentId, module); } diff --git a/src/main/java/seedu/address/logic/parser/ParserUtil.java b/src/main/java/seedu/address/logic/parser/ParserUtil.java index 20d1f0e9e67..3ce0eb82ab1 100644 --- a/src/main/java/seedu/address/logic/parser/ParserUtil.java +++ b/src/main/java/seedu/address/logic/parser/ParserUtil.java @@ -16,8 +16,8 @@ import seedu.address.model.person.Module; import seedu.address.model.person.Name; import seedu.address.model.person.Phone; +import seedu.address.model.person.Role; import seedu.address.model.person.StudentId; -import seedu.address.model.person.Tag; /** * Contains utility methods used for parsing strings in the various *Parser classes. @@ -66,6 +66,7 @@ public static Name parseName(String name) throws ParseException { if (!Name.isValidName(trimmedName)) { throw new ParseException(Name.MESSAGE_CONSTRAINTS); } + trimmedName = makeCapitalise(trimmedName); return new Name(trimmedName); } @@ -96,6 +97,7 @@ public static Address parseAddress(String address) throws ParseException { if (!Address.isValidAddress(trimmedAddress)) { throw new ParseException(Address.MESSAGE_CONSTRAINTS); } + trimmedAddress = makeUppercase(trimmedAddress); return new Address(trimmedAddress); } @@ -111,34 +113,36 @@ public static Email parseEmail(String email) throws ParseException { if (!Email.isValidEmail(trimmedEmail)) { throw new ParseException(Email.MESSAGE_CONSTRAINTS); } + trimmedEmail = makeLowercase(trimmedEmail); return new Email(trimmedEmail); } /** - * Parses a {@code String tag} into a {@code Tag}. + * Parses a {@code String role} into a {@code Role}. * Leading and trailing whitespaces will be trimmed. * - * @throws ParseException if the given {@code tag} is invalid. + * @throws ParseException if the given {@code role} is invalid. */ - public static Tag parseTag(String tag) throws ParseException { - requireNonNull(tag); - String trimmedTag = tag.trim(); - if (!Tag.isValidTag(trimmedTag)) { - throw new ParseException(Tag.MESSAGE_CONSTRAINTS); + public static Role parseRole(String role) throws ParseException { + requireNonNull(role); + String trimmedRole = role.trim(); + if (!Role.isValidRole(trimmedRole)) { + throw new ParseException(Role.MESSAGE_CONSTRAINTS); } - return new Tag(trimmedTag); + trimmedRole = makeCapitalise(trimmedRole); + return new Role(trimmedRole); } /** - * Parses {@code Collection tags} into a {@code Set}. + * Parses {@code Collection roles} into a {@code Set}. */ - public static Set parseTags(Collection tags) throws ParseException { - requireNonNull(tags); - final Set tagSet = new HashSet<>(); - for (String tagName : tags) { - tagSet.add(parseTag(tagName)); + public static Set parseRoles(Collection roles) throws ParseException { + requireNonNull(roles); + final Set roleSet = new HashSet<>(); + for (String roleName : roles) { + roleSet.add(parseRole(roleName)); } - return tagSet; + return roleSet; } /** @@ -153,6 +157,7 @@ public static Course parseCourse(String course) throws ParseException { if (!Course.isValidCourse(trimmedCourse)) { throw new ParseException(Course.MESSAGE_CONSTRAINTS); } + trimmedCourse = makeCapitalise(trimmedCourse); return new Course(trimmedCourse); } @@ -168,6 +173,7 @@ public static Module parseModule(String module) throws ParseException { if (!Module.isValidModule(trimmedModule)) { throw new ParseException(Module.MESSAGE_CONSTRAINTS); } + trimmedModule = makeUppercase(trimmedModule); return new Module(trimmedModule); } @@ -183,6 +189,43 @@ public static Grade parseGrade(String grade) throws ParseException { if (!Grade.isValidGrade(trimmedGrade)) { throw new ParseException(Grade.MESSAGE_CONSTRAINTS); } + trimmedGrade = makeUppercase(trimmedGrade); return new Grade(trimmedGrade); } + + /** + * Capitalizes the first letter of each word in the given input string + * and converts all other letters to lowercase. + * + * This method splits the input string by spaces, then processes each word + * to ensure that the first character is uppercase while the remaining characters + * are lowercase. The modified words are then joined back into a single string. + * + * @param input The input string to be capitalized. Each word's first letter will be capitalized, + * and the remaining letters will be in lowercase. + * @return A string with the first letter of each word capitalized and the rest in lowercase. + * Leading and trailing whitespace is removed. + */ + public static String makeCapitalise(String input) { + String[] words = input.split(" "); + StringBuilder capitalised = new StringBuilder(); + + for (String word : words) { + if (!word.isEmpty()) { + capitalised.append(Character.toUpperCase(word.charAt(0))) + .append(word.substring(1).toLowerCase()) + .append(" "); + } + } + + return capitalised.toString().trim(); + } + + public static String makeUppercase(String input) { + return input.toUpperCase(); + } + + public static String makeLowercase(String input) { + return input.toLowerCase(); + } } diff --git a/src/main/java/seedu/address/logic/parser/Prefix.java b/src/main/java/seedu/address/logic/parser/Prefix.java index 348b7686c8a..78b7768e7bb 100644 --- a/src/main/java/seedu/address/logic/parser/Prefix.java +++ b/src/main/java/seedu/address/logic/parser/Prefix.java @@ -2,7 +2,7 @@ /** * A prefix that marks the beginning of an argument in an arguments string. - * E.g. 't/' in 'add James t/ friend'. + * E.g. 'r/' in 'add James r/Student'. */ public class Prefix { private final String prefix; diff --git a/src/main/java/seedu/address/model/ModelManager.java b/src/main/java/seedu/address/model/ModelManager.java index a8c36a9bc04..d86ddfccaef 100644 --- a/src/main/java/seedu/address/model/ModelManager.java +++ b/src/main/java/seedu/address/model/ModelManager.java @@ -144,7 +144,6 @@ public void setPerson(Person target, Person editedPerson) { requireAllNonNull(target, editedPerson); eduContacts.setPerson(target, editedPerson); - setPersonToDisplay(editedPerson); } //=========== Filtered Person List Accessors ============================================================= diff --git a/src/main/java/seedu/address/model/person/Person.java b/src/main/java/seedu/address/model/person/Person.java index 261f0b84e64..27bde296f69 100644 --- a/src/main/java/seedu/address/model/person/Person.java +++ b/src/main/java/seedu/address/model/person/Person.java @@ -25,37 +25,37 @@ public class Person { // Data fields private final Address address; private final Course course; - private final Tag tag; + private final Role role; private ArrayList modules = new ArrayList<>(); /** * Every field must be present and not null. */ public Person(StudentId studentId, Name name, Phone phone, Email email, Address address, Course course, - Tag tag) { - requireAllNonNull(studentId, name, phone, email, address, course, tag); + Role role) { + requireAllNonNull(studentId, name, phone, email, address, course, role); this.studentId = studentId; this.name = name; this.phone = phone; this.email = email; this.address = address; this.course = course; - this.tag = tag; + this.role = role; } /** * Facilitates creating new Person object with module list. */ public Person(StudentId studentId, Name name, Phone phone, Email email, Address address, Course course, - Tag tag, ArrayList modules) { - requireAllNonNull(studentId, name, phone, email, address, course, tag); + Role role, ArrayList modules) { + requireAllNonNull(studentId, name, phone, email, address, course, role); this.studentId = studentId; this.name = name; this.phone = phone; this.email = email; this.address = address; this.course = course; - this.tag = tag; + this.role = role; this.modules = modules; } @@ -103,7 +103,7 @@ public Person addModule(Module module) { ArrayList updatedModules = new ArrayList<>(modules); updatedModules.add(module); - return new Person(studentId, name, phone, email, address, course, tag, updatedModules); + return new Person(studentId, name, phone, email, address, course, role, updatedModules); } /** @@ -120,7 +120,7 @@ public Person setModuleGrade(Module module, Grade grade) { module.setGrade(grade); int index = modules.indexOf(module); updatedModules.set(index, module); - return new Person(studentId, name, phone, email, address, course, tag, updatedModules); + return new Person(studentId, name, phone, email, address, course, role, updatedModules); } /** @@ -140,7 +140,7 @@ public Person deleteModule(Module module) { ArrayList updatedModules = new ArrayList<>(modules); updatedModules.remove(module); - return new Person(studentId, name, phone, email, address, course, tag, updatedModules); + return new Person(studentId, name, phone, email, address, course, role, updatedModules); } /** @@ -155,11 +155,11 @@ public boolean hasModule(Module module) { } /** - * Returns an immutable tag set, which throws {@code UnsupportedOperationException} + * Returns an immutable role set, which throws {@code UnsupportedOperationException} * if modification is attempted. */ - public Tag getTag() { - return tag; + public Role getRole() { + return role; } /** @@ -172,7 +172,7 @@ public boolean isSamePerson(Person otherPerson) { } return otherPerson != null - && otherPerson.getName().equals(getName()); + && otherPerson.getStudentId().equals(getStudentId()); } /** @@ -197,14 +197,14 @@ public boolean equals(Object other) { && email.equals(otherPerson.email) && address.equals(otherPerson.address) && course.equals(otherPerson.course) - && tag.equals(otherPerson.tag) + && role.equals(otherPerson.role) && modules.equals(otherPerson.modules); } @Override public int hashCode() { // use this method for custom fields hashing instead of implementing your own - return Objects.hash(studentId, name, phone, email, address, course, tag, modules); + return Objects.hash(studentId, name, phone, email, address, course, role, modules); } @Override @@ -216,7 +216,7 @@ public String toString() { .add("email", email) .add("address", address) .add("course", course) - .add("tag", tag) + .add("role", role) .add("modules", modules) .toString(); } diff --git a/src/main/java/seedu/address/model/person/Phone.java b/src/main/java/seedu/address/model/person/Phone.java index 122faa9ddb0..e91ff206254 100644 --- a/src/main/java/seedu/address/model/person/Phone.java +++ b/src/main/java/seedu/address/model/person/Phone.java @@ -11,8 +11,8 @@ public class Phone { public static final String MESSAGE_CONSTRAINTS = - "Phone numbers should only contain numbers, and it should be at least 3 digits long"; - public static final String VALIDATION_REGEX = "\\d{3,}"; + "Phone numbers should only contain numbers, and it should be at least 8 digits long"; + public static final String VALIDATION_REGEX = "\\d{8,}"; public final String value; /** diff --git a/src/main/java/seedu/address/model/person/Role.java b/src/main/java/seedu/address/model/person/Role.java new file mode 100644 index 00000000000..e1cfc812020 --- /dev/null +++ b/src/main/java/seedu/address/model/person/Role.java @@ -0,0 +1,98 @@ +package seedu.address.model.person; + +import static java.util.Objects.requireNonNull; +import static seedu.address.commons.util.AppUtil.checkArgument; + + +/** + * Represents a Person's Role in EduContacts. + * Guarantees: immutable; is valid as declared in {@link #isValidRole(String)} + */ +public class Role { + + /** + * Enum representing the valid role types for a person. + * The available role types are "Student" and "Tutor". + * + *

Each enum constant has a corresponding string representation that can be used + * to compare roles, retrieve the role, and validate role values.

+ */ + public enum RoleType { + STUDENT("Student"), + TUTOR("Tutor"); + private final String role; + /** + * Constructs a {@code RoleType} enum constant with the specified role. + * + * @param role The string representation of the role type (e.g., "Student" or "Tutor"). + */ + RoleType(String role) { + this.role = role; + } + + public String getRole() { + return role; + } + + /** + * Checks if the given string is a valid role by comparing it to the available role types. + * + * @param test The string to be checked against the valid role types. + * @return {@code true} if the string matches any valid role type, {@code false} otherwise. + */ + public static boolean isValidRole(String test) { + for (RoleType role : RoleType.values()) { + if (role.role.equalsIgnoreCase(test)) { + return true; + } + } + return false; + } + } + + public static final String MESSAGE_CONSTRAINTS = + "Your role should either be a student or tutor."; + public static final String VALIDATION_REGEX = "^[a-zA-Z]+$"; + public final RoleType role; + + + + /** + * Constructs a {@code Role}. + * + * @param role A valid role. + */ + public Role(String role) { + requireNonNull(role); + checkArgument(isValidRole(role), MESSAGE_CONSTRAINTS); + this.role = RoleType.valueOf(role.toUpperCase()); + } + + /** + * Returns true if a given string is a valid role. + */ + public static boolean isValidRole(String test) { + return test.matches(VALIDATION_REGEX) && RoleType.isValidRole(test); + } + @Override + public String toString() { + return role.getRole(); + } + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + + // instanceof handles nulls + if (!(other instanceof Role)) { + return false; + } + Role otherRole = (Role) other; + return role.equals(otherRole.role); + } + @Override + public int hashCode() { + return role.hashCode(); + } +} diff --git a/src/main/java/seedu/address/model/person/Tag.java b/src/main/java/seedu/address/model/person/Tag.java deleted file mode 100644 index c76e133269e..00000000000 --- a/src/main/java/seedu/address/model/person/Tag.java +++ /dev/null @@ -1,98 +0,0 @@ -package seedu.address.model.person; - -import static java.util.Objects.requireNonNull; -import static seedu.address.commons.util.AppUtil.checkArgument; - - -/** - * Represents a Person's Tag in EduContacts. - * Guarantees: immutable; is valid as declared in {@link #isValidTag(String)} - */ -public class Tag { - - /** - * Enum representing the valid tag types for a person. - * The available tag types are "Student" and "Tutor". - * - *

Each enum constant has a corresponding string representation that can be used - * to compare tags, retrieve the role, and validate tag values.

- */ - public enum TagType { - STUDENT("Student"), - TUTOR("Tutor"); - private final String role; - /** - * Constructs a {@code TagType} enum constant with the specified role. - * - * @param role The string representation of the tag type (e.g., "Student" or "Tutor"). - */ - TagType(String role) { - this.role = role; - } - - public String getRole() { - return role; - } - - /** - * Checks if the given string is a valid tag by comparing it to the available tag types. - * - * @param test The string to be checked against the valid tag types. - * @return {@code true} if the string matches any valid tag type, {@code false} otherwise. - */ - public static boolean isValidTag(String test) { - for (TagType tag : TagType.values()) { - if (tag.role.equalsIgnoreCase(test)) { - return true; - } - } - return false; - } - } - - public static final String MESSAGE_CONSTRAINTS = - "Your tag should either be a student or tutor."; - public static final String VALIDATION_REGEX = "^[a-zA-Z]+$"; - public final TagType role; - - - - /** - * Constructs a {@code Tag}. - * - * @param tag A valid tag. - */ - public Tag(String tag) { - requireNonNull(tag); - checkArgument(isValidTag(tag), MESSAGE_CONSTRAINTS); - this.role = TagType.valueOf(tag.toUpperCase()); - } - - /** - * Returns true if a given string is a valid tag. - */ - public static boolean isValidTag(String test) { - return test.matches(VALIDATION_REGEX) && TagType.isValidTag(test); - } - @Override - public String toString() { - return role.getRole(); - } - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - // instanceof handles nulls - if (!(other instanceof Tag)) { - return false; - } - Tag otherTag = (Tag) other; - return role.equals(otherTag.role); - } - @Override - public int hashCode() { - return role.hashCode(); - } -} diff --git a/src/main/java/seedu/address/model/person/exceptions/InvalidRoleException.java b/src/main/java/seedu/address/model/person/exceptions/InvalidRoleException.java new file mode 100644 index 00000000000..b58d265aab0 --- /dev/null +++ b/src/main/java/seedu/address/model/person/exceptions/InvalidRoleException.java @@ -0,0 +1,10 @@ +package seedu.address.model.person.exceptions; + +/** + * Signals that the role entered is of an invalid format. + */ +public class InvalidRoleException extends RuntimeException { + public InvalidRoleException(String message) { + super(message); + } +} diff --git a/src/main/java/seedu/address/model/person/exceptions/InvalidTagException.java b/src/main/java/seedu/address/model/person/exceptions/InvalidTagException.java deleted file mode 100644 index 9fada7aeb41..00000000000 --- a/src/main/java/seedu/address/model/person/exceptions/InvalidTagException.java +++ /dev/null @@ -1,10 +0,0 @@ -package seedu.address.model.person.exceptions; - -/** - * Signals that the tag entered is of an invalid format. - */ -public class InvalidTagException extends RuntimeException { - public InvalidTagException(String message) { - super(message); - } -} diff --git a/src/main/java/seedu/address/model/util/SampleDataUtil.java b/src/main/java/seedu/address/model/util/SampleDataUtil.java index 0089e7390ba..0e7c377d449 100644 --- a/src/main/java/seedu/address/model/util/SampleDataUtil.java +++ b/src/main/java/seedu/address/model/util/SampleDataUtil.java @@ -9,8 +9,8 @@ import seedu.address.model.person.Name; import seedu.address.model.person.Person; import seedu.address.model.person.Phone; +import seedu.address.model.person.Role; import seedu.address.model.person.StudentId; -import seedu.address.model.person.Tag; /** * Contains utility methods for populating {@code EduContacts} with sample data. @@ -23,42 +23,42 @@ public static Person[] getSamplePersons() { new Email("alexyeoh@example.com"), new Address("Blk 30 Geylang Street 29, #06-40"), new Course("Geography"), - new Tag("Student")), + new Role("Student")), new Person(new StudentId("13131313"), new Name("Bernice Yu"), new Phone("99272758"), new Email("berniceyu@example.com"), new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"), new Course("Computer Science"), - new Tag("Student")), + new Role("Student")), new Person(new StudentId("23461293"), new Name("Charlotte Oliveiro"), new Phone("93210283"), new Email("charlotte@example.com"), new Address("Blk 11 Ang Mo Kio Street 74, #11-04"), new Course("Data Science"), - new Tag("Student")), + new Role("Student")), new Person(new StudentId("98881999"), new Name("David Li"), new Phone("91031282"), new Email("lidavid@example.com"), new Address("Blk 436 Serangoon Gardens Street 26, #16-43"), new Course("Law"), - new Tag("Student")), + new Role("Student")), new Person(new StudentId("87778888"), new Name("Irfan Ibrahim"), new Phone("92492021"), new Email("irfan@example.com"), new Address("Blk 47 Tampines Street 20, #17-35"), new Course("Medicine"), - new Tag("Student")), + new Role("Student")), new Person(new StudentId("98189818"), new Name("Roy Balakrishnan"), new Phone("92624417"), new Email("royb@example.com"), new Address("Blk 45 Aljunied Street 85, #11-31"), new Course("Nursing"), - new Tag("Student")) + new Role("Student")) }; } diff --git a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java b/src/main/java/seedu/address/storage/JsonAdaptedPerson.java index aba1b3dc3e3..6668453dc38 100644 --- a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java +++ b/src/main/java/seedu/address/storage/JsonAdaptedPerson.java @@ -14,8 +14,8 @@ import seedu.address.model.person.Name; import seedu.address.model.person.Person; import seedu.address.model.person.Phone; +import seedu.address.model.person.Role; import seedu.address.model.person.StudentId; -import seedu.address.model.person.Tag; /** * Jackson-friendly version of {@link Person}. @@ -30,7 +30,7 @@ class JsonAdaptedPerson { private final String email; private final String address; private final String course; - private final String tag; + private final String role; private final List modules = new ArrayList<>(); /** @@ -43,7 +43,7 @@ public JsonAdaptedPerson(@JsonProperty("studentId") String studentId, @JsonProperty("email") String email, @JsonProperty("address") String address, @JsonProperty("course") String course, - @JsonProperty("tag") String tag, + @JsonProperty("role") String role, @JsonProperty("modules") List modules) { this.studentId = studentId; this.name = name; @@ -51,7 +51,7 @@ public JsonAdaptedPerson(@JsonProperty("studentId") String studentId, this.email = email; this.address = address; this.course = course; - this.tag = tag; + this.role = role; if (modules != null) { this.modules.addAll(modules); } @@ -67,7 +67,7 @@ public JsonAdaptedPerson(Person source) { email = source.getEmail().value; address = source.getAddress().value; course = source.getCourse().course; - tag = source.getTag().toString(); + role = source.getRole().toString(); modules.addAll(source.getModules().stream() .map(JsonAdaptedModule::new).toList()); } @@ -132,16 +132,16 @@ public Person toModelType() throws IllegalValueException { throw new IllegalValueException(Course.MESSAGE_CONSTRAINTS); } final Course modelCourse = new Course(course); - if (tag == null) { - throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Tag.class.getSimpleName())); + if (role == null) { + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Role.class.getSimpleName())); } - if (!Tag.isValidTag(tag)) { - throw new IllegalValueException(Tag.MESSAGE_CONSTRAINTS); + if (!Role.isValidRole(role)) { + throw new IllegalValueException(Role.MESSAGE_CONSTRAINTS); } - final Tag modelTag = new Tag(tag); + final Role modelRole = new Role(role); Person person = new Person(modelStudentId, modelName, modelPhone, modelEmail, - modelAddress, modelCourse, modelTag); + modelAddress, modelCourse, modelRole); person.setModules(modelModules); return person; diff --git a/src/main/java/seedu/address/storage/JsonAdaptedRole.java b/src/main/java/seedu/address/storage/JsonAdaptedRole.java new file mode 100644 index 00000000000..56733aef9d1 --- /dev/null +++ b/src/main/java/seedu/address/storage/JsonAdaptedRole.java @@ -0,0 +1,48 @@ +package seedu.address.storage; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +import seedu.address.commons.exceptions.IllegalValueException; +import seedu.address.model.person.Role; + +/** + * Jackson-friendly version of {@link Role}. + */ +class JsonAdaptedRole { + + private final String roleName; + + /** + * Constructs a {@code JsonAdaptedRole} with the given {@code roleName}. + */ + @JsonCreator + public JsonAdaptedRole(String roleName) { + this.roleName = roleName; + } + + /** + * Converts a given {@code Role} into this class for Jackson use. + */ + public JsonAdaptedRole(Role source) { + roleName = source.toString(); + } + + @JsonValue + public String getRoleName() { + return roleName; + } + + /** + * Converts this Jackson-friendly adapted role object into the model's {@code Role} object. + * + * @throws IllegalValueException if there were any data constraints violated in the adapted role. + */ + public Role toModelType() throws IllegalValueException { + if (!Role.isValidRole(roleName)) { + throw new IllegalValueException(Role.MESSAGE_CONSTRAINTS); + } + return new Role(roleName); + } + +} diff --git a/src/main/java/seedu/address/storage/JsonAdaptedTag.java b/src/main/java/seedu/address/storage/JsonAdaptedTag.java deleted file mode 100644 index 031b3555efa..00000000000 --- a/src/main/java/seedu/address/storage/JsonAdaptedTag.java +++ /dev/null @@ -1,48 +0,0 @@ -package seedu.address.storage; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -import seedu.address.commons.exceptions.IllegalValueException; -import seedu.address.model.person.Tag; - -/** - * Jackson-friendly version of {@link Tag}. - */ -class JsonAdaptedTag { - - private final String tagName; - - /** - * Constructs a {@code JsonAdaptedTag} with the given {@code tagName}. - */ - @JsonCreator - public JsonAdaptedTag(String tagName) { - this.tagName = tagName; - } - - /** - * Converts a given {@code Tag} into this class for Jackson use. - */ - public JsonAdaptedTag(Tag source) { - tagName = source.toString(); - } - - @JsonValue - public String getTagName() { - return tagName; - } - - /** - * Converts this Jackson-friendly adapted tag object into the model's {@code Tag} object. - * - * @throws IllegalValueException if there were any data constraints violated in the adapted tag. - */ - public Tag toModelType() throws IllegalValueException { - if (!Tag.isValidTag(tagName)) { - throw new IllegalValueException(Tag.MESSAGE_CONSTRAINTS); - } - return new Tag(tagName); - } - -} diff --git a/src/main/java/seedu/address/ui/HelpWindow.java b/src/main/java/seedu/address/ui/HelpWindow.java index dca87a441ff..ce6f3194d95 100644 --- a/src/main/java/seedu/address/ui/HelpWindow.java +++ b/src/main/java/seedu/address/ui/HelpWindow.java @@ -21,7 +21,7 @@ public class HelpWindow extends UiPart { + " H E L P M E N U\n" + "============================================================================================\n" + "\n1. Add Student\n" - + " - add ID n/NAME p/PHONE_NUMBER a/ADDRESS c/COURSE t/TAGS\n" + + " - add ID n/NAME p/PHONE_NUMBER a/ADDRESS c/COURSE t/ROLE\n" + "\n2. Add a Student Grade\n" + " - grade ID m/MODULE g/GRADE\n" + "\n3. Add Module\n" @@ -31,13 +31,21 @@ public class HelpWindow extends UiPart { + " - edit ID m/OLD_MODULE NEW_MODULE\n" + "\n5. Find Student\n" + " - find ID\n" - + "\n6. Delete Student\n" + + "\n6. Filter Student\n" + + " - filter n/NAME_KEYWORD [MORE_NAME_KEYWORDS]\n" + + " - filter m/MODULE\n" + + " - filter c/COURSE\n" + + "\n7. Delete Student\n" + " - delete ID\n" - + "\n7. List Students\n" + + "\n8. Delete Module\n" + + " - delete ID m/MODULE" + + "\n9. List Students\n" + " - list\n" - + "\n8. Clear Data\n" + + "\n10. Clear Data\n" + " - clear\n" - + "\n9. Exit Application\n" + + "\n11. Help\n" + + " - help\n" + + "\n12. Exit Application\n" + " - exit\n" + "\n============================================================================================\n" + "For more details, refer to the user guide: \n" + USERGUIDE_URL; diff --git a/src/main/java/seedu/address/ui/PersonCard.java b/src/main/java/seedu/address/ui/PersonCard.java index 071b0348fdd..abdb6e8581b 100644 --- a/src/main/java/seedu/address/ui/PersonCard.java +++ b/src/main/java/seedu/address/ui/PersonCard.java @@ -39,7 +39,7 @@ public class PersonCard extends UiPart { @FXML private Label email; @FXML - private Label tag; + private Label role; @FXML private Label course; @@ -47,7 +47,7 @@ public class PersonCard extends UiPart { private Label module; @FXML - private StackPane tagPane; + private StackPane rolePane; /** * Creates a {@code PersonCode} with the given {@code Person} and index to display. @@ -59,14 +59,14 @@ public PersonCard(Person person, int displayedIndex) { name.setText(person.getName().fullName); studentId.setText("StudentID: " + person.getStudentId().value); phone.setText(person.getPhone().value); - tag.setText(person.getTag().role.getRole()); + role.setText(person.getRole().role.getRole()); course.setText(person.getCourse().course); course.getStyleClass().add("bold-text"); - if (person.getTag().role.getRole().equalsIgnoreCase("Student")) { - tagPane.getStyleClass().add("student-pane"); - } else if (person.getTag().role.getRole().equalsIgnoreCase("Tutor")) { - tagPane.getStyleClass().add("tutor-pane"); + if (person.getRole().role.getRole().equalsIgnoreCase("Student")) { + rolePane.getStyleClass().add("student-pane"); + } else if (person.getRole().role.getRole().equalsIgnoreCase("Tutor")) { + rolePane.getStyleClass().add("tutor-pane"); } String modulesAsString = person.getModules().stream() @@ -74,8 +74,8 @@ public PersonCard(Person person, int displayedIndex) { .reduce("", (x, y) -> x + y); module.setText(modulesAsString.isEmpty() ? "No enrolled modules" : modulesAsString); - /*person.getTags().stream() - .sorted(Comparator.comparing(tag -> tag.tagName)) - .forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));*/ + /*person.getRoles().stream() + .sorted(Comparator.comparing(role -> role.roleName)) + .forEach(role -> roles.getChildren().add(new Label(role.roleName)));*/ } } diff --git a/src/main/java/seedu/address/ui/PersonDetails.java b/src/main/java/seedu/address/ui/PersonDetails.java index c532e3b62f1..157d5302be2 100644 --- a/src/main/java/seedu/address/ui/PersonDetails.java +++ b/src/main/java/seedu/address/ui/PersonDetails.java @@ -31,7 +31,7 @@ public class PersonDetails extends UiPart { @FXML private Label email; @FXML - private Label tag; + private Label role; @FXML private Label course; @FXML @@ -69,7 +69,7 @@ public void updateDetails(Person person) { name.setText(person.getName().fullName); studentId.setText(person.getStudentId().value); phone.setText(person.getPhone().value); - tag.setText(person.getTag().role.getRole()); + role.setText(person.getRole().role.getRole()); address.setText(person.getAddress().value); email.setText(person.getEmail().value); course.setText(person.getCourse().course); @@ -90,9 +90,15 @@ public void updateDetails(Person person) { phone.setText(""); address.setText(""); email.setText(""); - tag.setText(""); + role.setText(""); course.setText(""); module.setText(""); + profileImage.setVisible(false); + studentIdHeader.setVisible(false); + contactHeader.setVisible(false); + addressHeader.setVisible(false); + emailHeader.setVisible(false); + moduleHeader.setVisible(false); } } } diff --git a/src/main/java/seedu/address/ui/PersonListPanel.java b/src/main/java/seedu/address/ui/PersonListPanel.java index f4c501a897b..8d7e00329af 100644 --- a/src/main/java/seedu/address/ui/PersonListPanel.java +++ b/src/main/java/seedu/address/ui/PersonListPanel.java @@ -40,6 +40,7 @@ protected void updateItem(Person person, boolean empty) { if (empty || person == null) { setGraphic(null); setText(null); + setStyle("-fx-background-color: white;"); } else { setGraphic(new PersonCard(person, getIndex() + 1).getRoot()); } diff --git a/src/main/resources/view/DarkTheme.css b/src/main/resources/view/DarkTheme.css index 36e6b001cd8..711c6f4d60f 100644 --- a/src/main/resources/view/DarkTheme.css +++ b/src/main/resources/view/DarkTheme.css @@ -337,12 +337,12 @@ -fx-background-radius: 0; } -#tags { +#roles { -fx-hgap: 7; -fx-vgap: 3; } -#tags .label { +#roles .label { -fx-text-fill: white; -fx-background-color: #3e7b91; -fx-padding: 1 3 1 3; diff --git a/src/main/resources/view/Extensions.css b/src/main/resources/view/Extensions.css index bfe82a85964..206cacf14e9 100644 --- a/src/main/resources/view/Extensions.css +++ b/src/main/resources/view/Extensions.css @@ -8,7 +8,7 @@ -fx-background: #383838; } -.tag-selector { +.role-selector { -fx-border-width: 1; -fx-border-color: white; -fx-border-radius: 3; diff --git a/src/main/resources/view/LightTheme.css b/src/main/resources/view/LightTheme.css index 3f8c78bfd70..7804d1959dc 100644 --- a/src/main/resources/view/LightTheme.css +++ b/src/main/resources/view/LightTheme.css @@ -160,7 +160,7 @@ -fx-text-fill: #333333; } -.tag_small_label { +.role_small_label { -fx-font-family: "Segoe UI"; -fx-font-size: 13px; -fx-text-fill: #333333; @@ -464,14 +464,14 @@ } -#tags { +#roles { -fx-hgap: 7; -fx-vgap: 3; } -#tags .label { +#roles .label { -fx-text-fill: white; - -fx-background-color: #007BFF; /* Blue background for tags */ + -fx-background-color: #007BFF; /* Blue background for roles */ -fx-padding: 1 3 1 3; -fx-border-radius: 2; -fx-background-radius: 2; diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml index a1138476ea1..6474c5d1ba9 100644 --- a/src/main/resources/view/MainWindow.fxml +++ b/src/main/resources/view/MainWindow.fxml @@ -3,9 +3,6 @@ - - - @@ -16,7 +13,7 @@ + title="EduContacts" minWidth="450" minHeight="600" onCloseRequest="#handleExit"> diff --git a/src/main/resources/view/PersonDetails.fxml b/src/main/resources/view/PersonDetails.fxml index bb9f9a439bf..8c6ecc50112 100644 --- a/src/main/resources/view/PersonDetails.fxml +++ b/src/main/resources/view/PersonDetails.fxml @@ -1,16 +1,15 @@ - - - - - - - - + - + + + + + + + @@ -26,7 +25,7 @@ - -