diff --git a/README.adoc b/README.adoc index fa50028b99d0..8a4033482849 100644 --- a/README.adoc +++ b/README.adoc @@ -1,10 +1,8 @@ -= Address Book (Level 4) += Marketing Morph ifdef::env-github,env-browser[:relfileprefix: docs/] https://travis-ci.org/se-edu/addressbook-level4[image:https://travis-ci.org/se-edu/addressbook-level4.svg?branch=master[Build Status]] -https://ci.appveyor.com/project/damithc/addressbook-level4[image:https://ci.appveyor.com/api/projects/status/3boko2x2vr5cc3w2?svg=true[Build status]] -https://coveralls.io/github/se-edu/addressbook-level4?branch=master[image:https://coveralls.io/repos/github/se-edu/addressbook-level4/badge.svg?branch=master[Coverage Status]] -https://www.codacy.com/app/damith/addressbook-level4?utm_source=github.com&utm_medium=referral&utm_content=se-edu/addressbook-level4&utm_campaign=Badge_Grade[image:https://api.codacy.com/project/badge/Grade/fc0b7775cf7f4fdeaf08776f3d8e364a[Codacy Badge]] + ifdef::env-github[] image::docs/images/Ui.png[width="600"] @@ -14,19 +12,14 @@ ifndef::env-github[] image::images/Ui.png[width="600"] endif::[] -* This is a desktop Address Book application. It has a GUI but most of the user interactions happen using a CLI (Command Line Interface). -* It is a Java sample application intended for students learning Software Engineering while using Java as the main programming language. -* It is *written in OOP fashion*. It provides a *reasonably well-written* code example that is *significantly bigger* (around 6 KLoC)than what students usually write in beginner-level SE modules. -* What's different from https://github.com/se-edu/addressbook-level3[level 3]: -** A more sophisticated GUI that includes a list panel and an in-built Browser. -** More test cases, including automated GUI testing. -** Support for _Build Automation_ using Gradle and for _Continuous Integration_ using Travis CI. +* This is a desktop marketing application. It has a GUI but most of the user interactions happen using a CLI (Command Line Interface). +* It is meant to be utilized by a marketing company in order to effectively organize *potential targets* and *potential clients*. +* It is *written in OOP fashion*. == Site Map * <> * <> -* <> * <> * <> @@ -35,5 +28,6 @@ endif::[] * Some parts of this sample application were inspired by the excellent http://code.makery.ch/library/javafx-8-tutorial/[Java FX tutorial] by _Marco Jakob_. * Libraries used: https://github.com/TestFX/TestFX[TextFX], https://github.com/FasterXML/jackson[Jackson], https://github.com/google/guava[Guava], https://github.com/junit-team/junit5[JUnit5] +* AddressBook-Level4 project created by SE-EDU initiative at https://github.com/se-edu/ == Licence : link:LICENSE[MIT] diff --git a/docs/AboutUs.adoc b/docs/AboutUs.adoc index e647ed1e715a..20ffdd81ad02 100644 --- a/docs/AboutUs.adoc +++ b/docs/AboutUs.adoc @@ -4,53 +4,43 @@ :imagesDir: images :stylesDir: stylesheets -AddressBook - Level 4 was developed by the https://se-edu.github.io/docs/Team.html[se-edu] team. + -_{The dummy content given below serves as a placeholder to be used by future forks of the project.}_ + -{empty} + +Marketing Morph was developed by the https://github.com/orgs/cs2103-ay1819s2-w16-3/teams/developers[w16-3] team. + We are a team based in the http://www.comp.nus.edu.sg[School of Computing, National University of Singapore]. == Project Team -=== John Doe -image::damithc.jpg[width="150", align="left"] -{empty}[http://www.comp.nus.edu.sg/~damithch[homepage]] [https://github.com/damithc[github]] [<>] +=== Dongzhe Fan +image::FanDongzhe.jpg[width="150", align="left"] +{empty}[http://github.com/yijinl[github]] -Role: Project Advisor - -''' - -=== John Roe -image::lejolly.jpg[width="150", align="left"] -{empty}[http://github.com/lejolly[github]] [<>] - -Role: Team Lead + -Responsibilities: UI +Role: Developer + +Responsibilities: TBD ''' -=== Johnny Doe -image::yijinl.jpg[width="150", align="left"] -{empty}[http://github.com/yijinl[github]] [<>] +=== Jiayu Zhang +image::zhangjiayu0303.png[width="150", align="left"] +{empty}[http://github.com/ZhangJiayu0303[github]] Role: Developer + -Responsibilities: Data +Responsibilities: TBD ''' -=== Johnny Roe -image::m133225.jpg[width="150", align="left"] -{empty}[http://github.com/m133225[github]] [<>] +=== Jitesh Khiani +image::jkhiani.png[width="150", align="left"] +{empty}[https://github.com/jkhiani[github]] Role: Developer + -Responsibilities: Dev Ops + Threading +Responsibilities: TBD ''' -=== Benson Meier -image::yl_coder.jpg[width="150", align="left"] -{empty}[http://github.com/yl-coder[github]] [<>] +=== Roan Urquhart +image::roanurquhart.png[width="150", align="left"] +{empty}[https://github.com/roanurquhart[github]] Role: Developer + -Responsibilities: UI +Responsibilities: TBD ''' diff --git a/docs/UserGuide.adoc b/docs/UserGuide.adoc index 7e0070e12f49..d6b4ab8411f1 100644 --- a/docs/UserGuide.adoc +++ b/docs/UserGuide.adoc @@ -1,4 +1,4 @@ -= AddressBook Level 4 - User Guide += Marketing Morph - User Guide :site-section: UserGuide :toc: :toc-title: @@ -14,11 +14,11 @@ ifdef::env-github[] endif::[] :repoURL: https://github.com/se-edu/addressbook-level4 -By: `Team SE-EDU` Since: `Jun 2016` Licence: `MIT` +By: `Sky Walker` Since: `Feb 2019` Licence: `NUS` == Introduction -AddressBook Level 4 (AB4) is for those who *prefer to use a desktop app for managing contacts*. More importantly, AB4 is *optimized for those who prefer to work with a Command Line Interface* (CLI) while still having the benefits of a Graphical User Interface (GUI). If you can type fast, AB4 can get your contact management tasks done faster than traditional GUI apps. Interested? Jump to the <> to get started. Enjoy! +Marketing Morph is for marketers who want to organize consumer data. More importantly, Marketing Morph will allow marketers to use a GUI to keep track of different consumers, maintain client lists, and perform market analysis and research in one simple interface. == Quick Start @@ -58,7 +58,7 @@ Format: `help` === Adding a person: `add` -Adds a person to the address book + +Adds a person to the consumer list. + Format: `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG]...` [TIP] @@ -71,12 +71,12 @@ Examples: === Listing all persons : `list` -Shows a list of all persons in the address book. + +Shows a list of all persons in the consumer list. + Format: `list` === Editing a person : `edit` -Edits an existing person in the address book. + +Edits an existing person in the consumer list. + Format: `edit INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [t/TAG]...` **** @@ -149,7 +149,7 @@ Examples: * `list` + `select 2` + -Selects the 2nd person in the address book. +Selects the 2nd person in the consumer list. * `find Betsy` + `select 1` + Selects the 1st person in the results of the `find` command. @@ -224,6 +224,90 @@ Format: `clear` Exits the program. + Format: `exit` +=== Listing persons by name/salary/occupation/residential area/group : `list` + +Lists all people that meet the specified filter requirement. + +Format: list [ALL] [s/ >N] [s/ <= N] [n/ NAME] [o/ OCCUPATION] [a/ STREET NAME] [GROUPS] + +Examples: + +`list` s/ > 50000 (list all persons with income greater than $50000) + +`list` ALL (list all persons in the consumer list) + +`list` o/ Plumber (list all persons who’s occupation is plumber) + +=== Adding a company : `add` + +Adds a company to the client list + +Format: `add` n/NAME p/NUMBER e/AVG$$ a/ADRESS s/SECTOR n/#EMPS r/REVENUES [t/TAG]… + +Examples: + +`add` n/Walmart p/98765432 e/low a/John street, block 123, #01-01 s/Retail n/500 + +`add` n/Betsy Cakes e/medium a/Bob street, block 232 n p/1234567 s/Bakery n/20 t/popular t/local + +=== Find clients: `find` + +Lists all persons deemed capable of affording a specific product based on salary + +Format: `find` PRICE + +Examples: + +find 100 + +find 20 + +=== Find shops: `find` + +Lists all stores a person is deemed capable of visiting based on salary and store pricing + +Format: `find` [n/NAME] [s/SALARY] + +Examples: + +`find` n/steve smith + +`find` s/25000 + +=== Add to favorite list: `favorite` + +Adds a person to the “favorite” list (favorites etc.) + +Format: `favorite` [NAME] + +=== Create group: `group` + +Creates a group of persons + +Format: `group` GROUPNAME [[n/NAME] [a/ADDRESS]]... + +Examples: + +`group` g1 n/bob a/123 streets n/steve a/456 main n/smith a/111 abc st + +`group` winners n/jacob a/1 queen st n/adam a/10 north st + +=== Export data as CSV: `export` + +Exports the data to a CSV file + +Format: `export` [CLIENTS] [CONSUMERS] [ALL] + +Examples: + +`export` clients + +`export` all + + + + + === Saving the data Address book data are saved in the hard disk automatically after any command that changes the data. + @@ -258,3 +342,5 @@ e.g.`select 2` * *History* : `history` * *Undo* : `undo` * *Redo* : `redo` +* *group* : `group` GROUPNAME [[n/NAME] [a/ADDRESS]]... +* *export* : `export` [CLIENTS] [CONSUMERS] [ALL] diff --git a/docs/images/FanDongzhe.png b/docs/images/FanDongzhe.png new file mode 100644 index 000000000000..76bc3d8084d7 Binary files /dev/null and b/docs/images/FanDongzhe.png differ diff --git a/docs/images/Ui.png b/docs/images/Ui.png index 5ec9c527b49c..5bdf9941a980 100644 Binary files a/docs/images/Ui.png and b/docs/images/Ui.png differ diff --git a/docs/images/jkhiani.png b/docs/images/jkhiani.png new file mode 100644 index 000000000000..105bcf67ab79 Binary files /dev/null and b/docs/images/jkhiani.png differ diff --git a/docs/images/roanurquhart.png b/docs/images/roanurquhart.png new file mode 100644 index 000000000000..b01d1ea75066 Binary files /dev/null and b/docs/images/roanurquhart.png differ diff --git a/docs/images/zhangjiayu0303.png b/docs/images/zhangjiayu0303.png new file mode 100644 index 000000000000..22f5cb6c15c4 Binary files /dev/null and b/docs/images/zhangjiayu0303.png differ diff --git a/src/main/java/seedu/address/logic/commands/AddCommand.java b/src/main/java/seedu/address/logic/commands/AddCommand.java index d88e831ff1ce..6bae84e474fe 100644 --- a/src/main/java/seedu/address/logic/commands/AddCommand.java +++ b/src/main/java/seedu/address/logic/commands/AddCommand.java @@ -5,6 +5,9 @@ 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_SALARY; +import static seedu.address.logic.parser.CliSyntax.PREFIX_OCCUPATION; +import static seedu.address.logic.parser.CliSyntax.PREFIX_RELATIONSHIP; import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; import seedu.address.logic.CommandHistory; @@ -25,12 +28,18 @@ public class AddCommand extends Command { + PREFIX_PHONE + "PHONE " + PREFIX_EMAIL + "EMAIL " + PREFIX_ADDRESS + "ADDRESS " + + PREFIX_SALARY + "SALARY" + + PREFIX_OCCUPATION + "OCCUPATION" + + PREFIX_RELATIONSHIP + "RELATIONSHIP" + "[" + PREFIX_TAG + "TAG]...\n" + "Example: " + COMMAND_WORD + " " + PREFIX_NAME + "John Doe " + PREFIX_PHONE + "98765432 " + PREFIX_EMAIL + "johnd@example.com " + PREFIX_ADDRESS + "311, Clementi Ave 2, #02-25 " + + PREFIX_SALARY + "100000" + + PREFIX_OCCUPATION + "banker" + + PREFIX_RELATIONSHIP + "single" + PREFIX_TAG + "friends " + PREFIX_TAG + "owesMoney"; diff --git a/src/main/java/seedu/address/logic/commands/EditCommand.java b/src/main/java/seedu/address/logic/commands/EditCommand.java index 952a9e7e7f2b..85bf18e365e8 100644 --- a/src/main/java/seedu/address/logic/commands/EditCommand.java +++ b/src/main/java/seedu/address/logic/commands/EditCommand.java @@ -1,11 +1,7 @@ package seedu.address.logic.commands; import static java.util.Objects.requireNonNull; -import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; -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.*; import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS; import java.util.Collections; @@ -25,6 +21,9 @@ import seedu.address.model.person.Name; import seedu.address.model.person.Person; import seedu.address.model.person.Phone; +import seedu.address.model.person.Salary; +import seedu.address.model.person.Occupation; +import seedu.address.model.person.Relationship; import seedu.address.model.tag.Tag; /** @@ -42,6 +41,9 @@ public class EditCommand extends Command { + "[" + PREFIX_PHONE + "PHONE] " + "[" + PREFIX_EMAIL + "EMAIL] " + "[" + PREFIX_ADDRESS + "ADDRESS] " + + "[" + PREFIX_SALARY + "SALARY] " + + "[" + PREFIX_OCCUPATION + "OCCUPATION] " + + "[" + PREFIX_RELATIONSHIP + "RELATIONSHIP] " + "[" + PREFIX_TAG + "TAG]...\n" + "Example: " + COMMAND_WORD + " 1 " + PREFIX_PHONE + "91234567 " @@ -99,9 +101,13 @@ private static Person createEditedPerson(Person personToEdit, EditPersonDescript Phone updatedPhone = editPersonDescriptor.getPhone().orElse(personToEdit.getPhone()); Email updatedEmail = editPersonDescriptor.getEmail().orElse(personToEdit.getEmail()); Address updatedAddress = editPersonDescriptor.getAddress().orElse(personToEdit.getAddress()); + Salary updatedSalary = editPersonDescriptor.getSalary().orElse(personToEdit.getSalary()); + Occupation updatedOccupation = editPersonDescriptor.getOccupation().orElse(personToEdit.getOccupation()); + Relationship updatedRelationship = editPersonDescriptor.getRelationship().orElse(personToEdit.getRelationship()); Set updatedTags = editPersonDescriptor.getTags().orElse(personToEdit.getTags()); - return new Person(updatedName, updatedPhone, updatedEmail, updatedAddress, updatedTags); + return new Person(updatedName, updatedPhone, updatedEmail, updatedAddress, updatedSalary, + updatedOccupation, updatedRelationship, updatedTags); } @Override @@ -131,6 +137,9 @@ public static class EditPersonDescriptor { private Phone phone; private Email email; private Address address; + private Salary salary; + private Occupation occupation; + private Relationship relationship; private Set tags; public EditPersonDescriptor() {} @@ -144,6 +153,9 @@ public EditPersonDescriptor(EditPersonDescriptor toCopy) { setPhone(toCopy.phone); setEmail(toCopy.email); setAddress(toCopy.address); + setSalary(toCopy.salary); + setOccupation(toCopy.occupation); + setRelationship(toCopy.relationship); setTags(toCopy.tags); } @@ -186,6 +198,28 @@ public Optional
getAddress() { return Optional.ofNullable(address); } + public void setSalary(Salary Ssalary) { + this.salary = salary; + } + + public Optional getSalary() { + return Optional.ofNullable(salary); + } + + public void setOccupation(Occupation occupation) { + this.occupation = occupation; + } + + public Optional getOccupation() { + return Optional.ofNullable(occupation); + } + + public void setRelationship(Relationship relationship) { this.relationship = relationship; } + + public Optional getRelationship() { + return Optional.ofNullable(relationship); + } + /** * Sets {@code tags} to this object's {@code tags}. * A defensive copy of {@code tags} is used internally. @@ -222,6 +256,9 @@ public boolean equals(Object other) { && getPhone().equals(e.getPhone()) && getEmail().equals(e.getEmail()) && getAddress().equals(e.getAddress()) + && getSalary().equals(e.getSalary()) + && getOccupation().equals(e.getOccupation()) + && getRelationship().equals(e.getRelationship()) && getTags().equals(e.getTags()); } } diff --git a/src/main/java/seedu/address/logic/commands/FavoriteCommand.java b/src/main/java/seedu/address/logic/commands/FavoriteCommand.java new file mode 100644 index 000000000000..0d0b86553638 --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/FavoriteCommand.java @@ -0,0 +1,57 @@ +package seedu.address.logic.commands; + +import static java.util.Objects.requireNonNull; + +import seedu.address.logic.CommandHistory; +import seedu.address.model.Model; +import seedu.address.model.person.NameContainsKeywordsPredicate; + + +/** + * Finds and adds all persons in address book whose name contains any of the argument keywords to a favorites list. + * Keyword matching is case sensitive. + */ +public class FavoriteCommand extends Command { + + public static final String COMMAND_WORD = "favorite"; + + public static final String MESSAGE_USAGE = COMMAND_WORD + ": Finds all persons whose names contain\n" + + "any of the specified \"\n" + + "keywords (case-sensitive) and adds them to a list of favorite contacts.\n" + + "Parameters: KEYWORD [MORE_KEYWORDS]...\n" + + "Example: " + COMMAND_WORD + + " John"; + + public static final String MESSAGE_SUCCESS = "New person added: %1$s"; + public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in the favorite list"; + public static final String MESSAGE_COMPLETE = "Adding to favorite list completed."; + + + private final NameContainsKeywordsPredicate predicate; + + public FavoriteCommand(NameContainsKeywordsPredicate predicate) { + this.predicate = predicate; + } + + + + @Override + public CommandResult execute(Model model, CommandHistory history) { + requireNonNull(model); + model.updateFilteredPersonList(predicate); + model.addFavorites(model.getFilteredPersonList().get(0)); + model.commitAddressBook(); + return new CommandResult( + String.format(MESSAGE_SUCCESS, model.getFilteredPersonList().get(0).getName())); + } + + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof FavoriteCommand // instanceof handles nulls + && predicate.equals(((FavoriteCommand) other).predicate)); // state check + } + +} + diff --git a/src/main/java/seedu/address/logic/commands/HelpCommand.java b/src/main/java/seedu/address/logic/commands/HelpCommand.java index f0ef78dddded..fac24c6a28bd 100644 --- a/src/main/java/seedu/address/logic/commands/HelpCommand.java +++ b/src/main/java/seedu/address/logic/commands/HelpCommand.java @@ -9,6 +9,7 @@ public class HelpCommand extends Command { public static final String COMMAND_WORD = "help"; + public static final String COMMAND_ALIAS = "h"; public static final String MESSAGE_USAGE = COMMAND_WORD + ": Shows program usage instructions.\n" + "Example: " + COMMAND_WORD; diff --git a/src/main/java/seedu/address/logic/parser/AddCommandParser.java b/src/main/java/seedu/address/logic/parser/AddCommandParser.java index 3b8bfa035e83..29c1bd8c3a23 100644 --- a/src/main/java/seedu/address/logic/parser/AddCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/AddCommandParser.java @@ -5,6 +5,9 @@ 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_SALARY; +import static seedu.address.logic.parser.CliSyntax.PREFIX_OCCUPATION; +import static seedu.address.logic.parser.CliSyntax.PREFIX_RELATIONSHIP; import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; import java.util.Set; @@ -17,6 +20,9 @@ import seedu.address.model.person.Name; import seedu.address.model.person.Person; import seedu.address.model.person.Phone; +import seedu.address.model.person.Salary; +import seedu.address.model.person.Occupation; +import seedu.address.model.person.Relationship; import seedu.address.model.tag.Tag; /** @@ -31,9 +37,11 @@ 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_TAG); + ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, + PREFIX_SALARY, PREFIX_OCCUPATION, PREFIX_RELATIONSHIP, PREFIX_TAG); - if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_EMAIL) + if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, + PREFIX_EMAIL, PREFIX_SALARY, PREFIX_OCCUPATION, PREFIX_RELATIONSHIP) || !argMultimap.getPreamble().isEmpty()) { throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddCommand.MESSAGE_USAGE)); } @@ -42,9 +50,12 @@ public AddCommand parse(String args) throws ParseException { Phone phone = ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get()); Email email = ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL).get()); Address address = ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get()); + Salary salary = ParserUtil.parseSalary(argMultimap.getValue(PREFIX_SALARY).get()); + Occupation occupation = ParserUtil.parseOccupation(argMultimap.getValue(PREFIX_OCCUPATION).get()); + Relationship relationship = ParserUtil.parseRelationship(argMultimap.getValue(PREFIX_RELATIONSHIP).get()); Set tagList = ParserUtil.parseTags(argMultimap.getAllValues(PREFIX_TAG)); - Person person = new Person(name, phone, email, address, tagList); + Person person = new Person(name, phone, email, address, salary, occupation, relationship, tagList); return new AddCommand(person); } diff --git a/src/main/java/seedu/address/logic/parser/AddressBookParser.java b/src/main/java/seedu/address/logic/parser/AddressBookParser.java index b7d57f5db86a..48cf0754d670 100644 --- a/src/main/java/seedu/address/logic/parser/AddressBookParser.java +++ b/src/main/java/seedu/address/logic/parser/AddressBookParser.java @@ -12,6 +12,7 @@ import seedu.address.logic.commands.DeleteCommand; import seedu.address.logic.commands.EditCommand; import seedu.address.logic.commands.ExitCommand; +import seedu.address.logic.commands.FavoriteCommand; import seedu.address.logic.commands.FindCommand; import seedu.address.logic.commands.HelpCommand; import seedu.address.logic.commands.HistoryCommand; @@ -84,6 +85,12 @@ public Command parseCommand(String userInput) throws ParseException { case RedoCommand.COMMAND_WORD: return new RedoCommand(); + case FavoriteCommand.COMMAND_WORD: + return new FavoriteCommandParser().parse(arguments); + + case HelpCommand.COMMAND_ALIAS: + return new HelpCommand(); + default: throw new ParseException(MESSAGE_UNKNOWN_COMMAND); } diff --git a/src/main/java/seedu/address/logic/parser/CliSyntax.java b/src/main/java/seedu/address/logic/parser/CliSyntax.java index 75b1a9bf1190..aae6fb758c5e 100644 --- a/src/main/java/seedu/address/logic/parser/CliSyntax.java +++ b/src/main/java/seedu/address/logic/parser/CliSyntax.java @@ -10,6 +10,9 @@ public class CliSyntax { public static final Prefix PREFIX_PHONE = new Prefix("p/"); public static final Prefix PREFIX_EMAIL = new Prefix("e/"); public static final Prefix PREFIX_ADDRESS = new Prefix("a/"); + public static final Prefix PREFIX_SALARY = new Prefix("s/"); + public static final Prefix PREFIX_OCCUPATION = new Prefix("o/"); + public static final Prefix PREFIX_RELATIONSHIP = new Prefix("r/"); public static final Prefix PREFIX_TAG = new Prefix("t/"); } diff --git a/src/main/java/seedu/address/logic/parser/FavoriteCommandParser.java b/src/main/java/seedu/address/logic/parser/FavoriteCommandParser.java new file mode 100644 index 000000000000..9c38fc2f7e6f --- /dev/null +++ b/src/main/java/seedu/address/logic/parser/FavoriteCommandParser.java @@ -0,0 +1,34 @@ +package seedu.address.logic.parser; + +import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; + +import java.util.Arrays; + +import seedu.address.logic.commands.FavoriteCommand; +import seedu.address.logic.parser.exceptions.ParseException; +import seedu.address.model.person.NameContainsKeywordsPredicate; + +/** + * Parses Favorite Command + */ +public class FavoriteCommandParser { + + /** + * Parses the given {@code String} of arguments in the context of the FindCommand + * and returns an FindCommand object for execution. + * @throws ParseException if the user input does not conform the expected format + */ + public FavoriteCommand parse(String args) throws ParseException { + String trimmedArgs = args.trim(); + if (trimmedArgs.isEmpty()) { + throw new ParseException( + String.format(MESSAGE_INVALID_COMMAND_FORMAT, FavoriteCommand.MESSAGE_USAGE)); + } + + String[] nameKeywords = trimmedArgs.split("\\s+"); + + return new FavoriteCommand(new NameContainsKeywordsPredicate(Arrays.asList(nameKeywords))); + } + + +} diff --git a/src/main/java/seedu/address/logic/parser/ParserUtil.java b/src/main/java/seedu/address/logic/parser/ParserUtil.java index b117acb9c55b..32307bf1ecbe 100644 --- a/src/main/java/seedu/address/logic/parser/ParserUtil.java +++ b/src/main/java/seedu/address/logic/parser/ParserUtil.java @@ -13,6 +13,9 @@ import seedu.address.model.person.Email; import seedu.address.model.person.Name; import seedu.address.model.person.Phone; +import seedu.address.model.person.Salary; +import seedu.address.model.person.Occupation; +import seedu.address.model.person.Relationship; import seedu.address.model.tag.Tag; /** @@ -95,6 +98,51 @@ public static Email parseEmail(String email) throws ParseException { return new Email(trimmedEmail); } + /** + * Parses a {@code String salary} into an {@code salary}. + * Leading and trailing whitespaces will be trimmed. + * + * @throws ParseException if the given {@code salary} is invalid. + */ + public static Salary parseSalary(String salary) throws ParseException { + requireNonNull(salary); + String trimmedSalary = salary.trim(); + if (!Salary.isValidSalary(trimmedSalary)) { + throw new ParseException(Salary.MESSAGE_CONSTRAINTS); + } + return new Salary(trimmedSalary); + } + + /** + * Parses a {@code String occupation} into an {@code Occupation}. + * Leading and trailing whitespaces will be trimmed. + * + * @throws ParseException if the given {@code occupation} is invalid. + */ + public static Occupation parseOccupation(String occupation) throws ParseException { + requireNonNull(occupation); + String trimmedOccupation = occupation.trim(); + if (!Occupation.isValidOccupation(trimmedOccupation)) { + throw new ParseException(Occupation.MESSAGE_CONSTRAINTS); + } + return new Occupation(trimmedOccupation); + } + + /** + * Parses a {@code String relationship} into an {@code Relationship}. + * Leading and trailing whitespaces will be trimmed. + * + * @throws ParseException if the given {@code relationship} is invalid. + */ + public static Relationship parseRelationship(String relationship) throws ParseException { + requireNonNull(relationship); + String trimmedRelationship = relationship.trim(); + if (!Relationship.isValidRelationship(trimmedRelationship)) { + throw new ParseException(Relationship.MESSAGE_CONSTRAINTS); + } + return new Relationship(trimmedRelationship); + } + /** * Parses a {@code String tag} into a {@code Tag}. * Leading and trailing whitespaces will be trimmed. diff --git a/src/main/java/seedu/address/model/AddressBook.java b/src/main/java/seedu/address/model/AddressBook.java index 30557cf81ee7..cbc3f6320320 100644 --- a/src/main/java/seedu/address/model/AddressBook.java +++ b/src/main/java/seedu/address/model/AddressBook.java @@ -17,6 +17,7 @@ public class AddressBook implements ReadOnlyAddressBook { private final UniquePersonList persons; + private final UniquePersonList favorites; private final InvalidationListenerManager invalidationListenerManager = new InvalidationListenerManager(); /* @@ -28,6 +29,7 @@ public class AddressBook implements ReadOnlyAddressBook { */ { persons = new UniquePersonList(); + favorites = new UniquePersonList(); } public AddressBook() {} @@ -79,6 +81,16 @@ public void addPerson(Person p) { indicateModified(); } + /** + * Adds a person to the favorites list. + * The person must not already exist in the favorites list. + * @param p person + */ + public void addFavorites(Person p) { + favorites.add(p); + indicateModified(); + } + /** * Replaces the given person {@code target} in the list with {@code editedPerson}. * {@code target} must exist in the address book. diff --git a/src/main/java/seedu/address/model/Model.java b/src/main/java/seedu/address/model/Model.java index e857533821b6..32cb59f23c25 100644 --- a/src/main/java/seedu/address/model/Model.java +++ b/src/main/java/seedu/address/model/Model.java @@ -70,6 +70,12 @@ public interface Model { */ void addPerson(Person person); + /** + * Adds the given person to the favorites list. + * @param person + */ + void addFavorites(Person person); + /** * Replaces the given person {@code target} with {@code editedPerson}. * {@code target} must exist in the address book. diff --git a/src/main/java/seedu/address/model/ModelManager.java b/src/main/java/seedu/address/model/ModelManager.java index b56806232814..fbc72bc8160d 100644 --- a/src/main/java/seedu/address/model/ModelManager.java +++ b/src/main/java/seedu/address/model/ModelManager.java @@ -112,6 +112,12 @@ public void addPerson(Person person) { updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS); } + @Override + public void addFavorites(Person person) { + versionedAddressBook.addFavorites(person); + updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS); + } + @Override public void setPerson(Person target, Person editedPerson) { requireAllNonNull(target, editedPerson); diff --git a/src/main/java/seedu/address/model/person/Occupation.java b/src/main/java/seedu/address/model/person/Occupation.java new file mode 100644 index 000000000000..8a9fe0f21900 --- /dev/null +++ b/src/main/java/seedu/address/model/person/Occupation.java @@ -0,0 +1,59 @@ +package seedu.address.model.person; + +import static java.util.Objects.requireNonNull; +import static seedu.address.commons.util.AppUtil.checkArgument; + +/** + * Represents a Person's occupation in the address book. + * Guarantees: immutable; is valid as declared in {@link #isValidOccupation(String)} + */ +public class Occupation { + + public static final String MESSAGE_CONSTRAINTS = + "Occupations should only contain alphanumeric characters, and it should not be blank"; + + /* + * The first character of the occupation must not be a whitespace, + * otherwise " " (a blank string) becomes a valid input. + */ + public static final String VALIDATION_REGEX = "[^\\s].*"; + + public final String value; + + /** + * Constructs a {@code Occupation}. + * + * @param occupation A valid occupation. + */ + public Occupation(String occupation) { + requireNonNull(occupation); + checkArgument(isValidOccupation(occupation), MESSAGE_CONSTRAINTS); + value = occupation; + } + + /** + * Returns true if a given string is a valid occupation. + */ + public static boolean isValidOccupation(String test) { + return test.matches(VALIDATION_REGEX); + } + + + @Override + public String toString() { + return value; + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof Occupation // instanceof handles nulls + && value.equals(((Occupation) other).value)); // state check + } + + @Override + public int hashCode() { + return value.hashCode(); + } + +} diff --git a/src/main/java/seedu/address/model/person/Person.java b/src/main/java/seedu/address/model/person/Person.java index 557a7a60cd51..6d5de87ee1e9 100644 --- a/src/main/java/seedu/address/model/person/Person.java +++ b/src/main/java/seedu/address/model/person/Person.java @@ -19,6 +19,9 @@ public class Person { private final Name name; private final Phone phone; private final Email email; + private final Salary salary; + private final Occupation occupation; + private final Relationship relationship; // Data fields private final Address address; @@ -27,11 +30,15 @@ public class Person { /** * Every field must be present and not null. */ - public Person(Name name, Phone phone, Email email, Address address, Set tags) { - requireAllNonNull(name, phone, email, address, tags); + public Person(Name name, Phone phone, Email email, Address address, + Salary salary, Occupation occupation, Relationship relationship, Set tags) { + requireAllNonNull(name, phone, email, address, salary, occupation, relationship, tags); this.name = name; this.phone = phone; this.email = email; + this.salary = salary; + this.occupation = occupation; + this.relationship = relationship; this.address = address; this.tags.addAll(tags); } @@ -52,6 +59,16 @@ public Address getAddress() { return address; } + public Salary getSalary() { + return salary; + } + + public Occupation getOccupation() { + return occupation; + } + + public Relationship getRelationship() { return relationship; } + /** * Returns an immutable tag set, which throws {@code UnsupportedOperationException} * if modification is attempted. @@ -71,7 +88,9 @@ public boolean isSamePerson(Person otherPerson) { return otherPerson != null && otherPerson.getName().equals(getName()) - && (otherPerson.getPhone().equals(getPhone()) || otherPerson.getEmail().equals(getEmail())); + && (otherPerson.getPhone().equals(getPhone()) || otherPerson.getEmail().equals(getEmail()) || + otherPerson.getSalary().equals(getSalary()) || otherPerson.getOccupation().equals(getOccupation()) || + otherPerson.getRelationship().equals(getRelationship())); } /** @@ -93,13 +112,17 @@ public boolean equals(Object other) { && otherPerson.getPhone().equals(getPhone()) && otherPerson.getEmail().equals(getEmail()) && otherPerson.getAddress().equals(getAddress()) + && otherPerson.getSalary().equals(getSalary()) + && otherPerson.getOccupation().equals(getOccupation()) + && otherPerson.getRelationship().equals(getRelationship()) && otherPerson.getTags().equals(getTags()); + } @Override public int hashCode() { // use this method for custom fields hashing instead of implementing your own - return Objects.hash(name, phone, email, address, tags); + return Objects.hash(name, phone, email, address, salary, occupation, relationship, tags); } @Override @@ -112,6 +135,12 @@ public String toString() { .append(getEmail()) .append(" Address: ") .append(getAddress()) + .append(" Salary: ") + .append(getSalary()) + .append(" Occupation: ") + .append(getOccupation()) + .append(" Relationship: ") + .append(getRelationship()) .append(" Tags: "); getTags().forEach(builder::append); return builder.toString(); diff --git a/src/main/java/seedu/address/model/person/Relationship.java b/src/main/java/seedu/address/model/person/Relationship.java new file mode 100644 index 000000000000..cc940dc7dac1 --- /dev/null +++ b/src/main/java/seedu/address/model/person/Relationship.java @@ -0,0 +1,59 @@ +package seedu.address.model.person; + +import static java.util.Objects.requireNonNull; +import static seedu.address.commons.util.AppUtil.checkArgument; + +/** + * Represents a Person's relationship status in the address book. + * Guarantees: immutable; is valid as declared in {@link #isValidRelationship(String)} + */ +public class Relationship { + + public static final String MESSAGE_CONSTRAINTS = + "Relationships should only contain alphanumeric characters, and it should not be blank"; + + /* + * The first character of the relationship must not be a whitespace, + * otherwise " " (a blank string) becomes a valid input. + */ + public static final String VALIDATION_REGEX = "\\p{Alnum}+"; + + public final String value; + + /** + * Constructs a {@code Relationship}. + * + * @param relationship A valid relationship. + */ + public Relationship(String relationship) { + requireNonNull(relationship); + checkArgument(isValidRelationship(relationship), MESSAGE_CONSTRAINTS); + value = relationship; + } + + /** + * Returns true if a given string is a valid relationship. + */ + public static boolean isValidRelationship(String test) { + return test.matches(VALIDATION_REGEX); + } + + + @Override + public String toString() { + return value; + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof Relationship // instanceof handles nulls + && value.equals(((Relationship) other).value)); // state check + } + + @Override + public int hashCode() { + return value.hashCode(); + } + +} diff --git a/src/main/java/seedu/address/model/person/Salary.java b/src/main/java/seedu/address/model/person/Salary.java new file mode 100644 index 000000000000..f5b1b134ef7b --- /dev/null +++ b/src/main/java/seedu/address/model/person/Salary.java @@ -0,0 +1,53 @@ +package seedu.address.model.person; + +import static java.util.Objects.requireNonNull; +import static seedu.address.commons.util.AppUtil.checkArgument; + +/** + * Represents a Person's salary in the address book. + * Guarantees: immutable; is valid as declared in {@link #isValidSalary(String)} + */ +public class Salary { + + + public static final String MESSAGE_CONSTRAINTS = + "Salary should only contain numbers, and it should be at least 1 digits long"; + public static final String VALIDATION_REGEX = "\\d{1,}"; + public final String value; + + /** + * Constructs a {@code Salary}. + * + * @param salary A valid salary number. + */ + public Salary(String salary) { + requireNonNull(salary); + checkArgument(isValidSalary(salary), MESSAGE_CONSTRAINTS); + value = salary; + } + + /** + * Returns true if a given string is a valid salary number. + */ + public static boolean isValidSalary(String test) { + return test.matches(VALIDATION_REGEX); + } + + @Override + public String toString() { + return value; + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof Salary // instanceof handles nulls + && value.equals(((Salary) other).value)); // state check + } + + @Override + public int hashCode() { + return value.hashCode(); + } + +} diff --git a/src/main/java/seedu/address/model/util/SampleDataUtil.java b/src/main/java/seedu/address/model/util/SampleDataUtil.java index 1806da4facfa..af5af78ad766 100644 --- a/src/main/java/seedu/address/model/util/SampleDataUtil.java +++ b/src/main/java/seedu/address/model/util/SampleDataUtil.java @@ -11,6 +11,9 @@ import seedu.address.model.person.Name; import seedu.address.model.person.Person; import seedu.address.model.person.Phone; +import seedu.address.model.person.Salary; +import seedu.address.model.person.Occupation; +import seedu.address.model.person.Relationship; import seedu.address.model.tag.Tag; /** @@ -20,23 +23,23 @@ public class SampleDataUtil { public static Person[] getSamplePersons() { return new Person[] { new Person(new Name("Alex Yeoh"), new Phone("87438807"), new Email("alexyeoh@example.com"), - new Address("Blk 30 Geylang Street 29, #06-40"), - getTagSet("friends")), + new Address("Blk 30 Geylang Street 29, #06-40"), new Salary("15000"), new Occupation("Professor"), + new Relationship("single"), getTagSet("friends")), new Person(new Name("Bernice Yu"), new Phone("99272758"), new Email("berniceyu@example.com"), - new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"), - getTagSet("colleagues", "friends")), + new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"), new Salary("9000"), new Occupation("Programmer"), + new Relationship("single"), getTagSet("colleagues", "friends")), new Person(new Name("Charlotte Oliveiro"), new Phone("93210283"), new Email("charlotte@example.com"), - new Address("Blk 11 Ang Mo Kio Street 74, #11-04"), - getTagSet("neighbours")), + new Address("Blk 11 Ang Mo Kio Street 74, #11-04"), new Salary("3000"), new Occupation("HR"), + new Relationship("married"), getTagSet("neighbours")), new Person(new Name("David Li"), new Phone("91031282"), new Email("lidavid@example.com"), - new Address("Blk 436 Serangoon Gardens Street 26, #16-43"), - getTagSet("family")), + new Address("Blk 436 Serangoon Gardens Street 26, #16-43"), new Salary("50000"), new Occupation("Excutive Director"), + new Relationship("single"), getTagSet("family")), new Person(new Name("Irfan Ibrahim"), new Phone("92492021"), new Email("irfan@example.com"), - new Address("Blk 47 Tampines Street 20, #17-35"), - getTagSet("classmates")), + new Address("Blk 47 Tampines Street 20, #17-35"), new Salary("20000"), new Occupation("Vice President"), + new Relationship("married"), getTagSet("classmates")), new Person(new Name("Roy Balakrishnan"), new Phone("92624417"), new Email("royb@example.com"), - new Address("Blk 45 Aljunied Street 85, #11-31"), - getTagSet("colleagues")) + new Address("Blk 45 Aljunied Street 85, #11-31"), new Salary("5000"), new Occupation("Project manager"), + new Relationship("divorced"), getTagSet("colleagues")) }; } diff --git a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java b/src/main/java/seedu/address/storage/JsonAdaptedPerson.java index a6321cec2eac..61f308a2b050 100644 --- a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java +++ b/src/main/java/seedu/address/storage/JsonAdaptedPerson.java @@ -15,6 +15,9 @@ import seedu.address.model.person.Name; import seedu.address.model.person.Person; import seedu.address.model.person.Phone; +import seedu.address.model.person.Salary; +import seedu.address.model.person.Occupation; +import seedu.address.model.person.Relationship; import seedu.address.model.tag.Tag; /** @@ -28,6 +31,10 @@ class JsonAdaptedPerson { private final String phone; private final String email; private final String address; + private final String salary; + private final String occupation; + private final String relationship; + private final List tagged = new ArrayList<>(); /** @@ -35,12 +42,16 @@ class JsonAdaptedPerson { */ @JsonCreator public JsonAdaptedPerson(@JsonProperty("name") String name, @JsonProperty("phone") String phone, - @JsonProperty("email") String email, @JsonProperty("address") String address, + @JsonProperty("email") String email, @JsonProperty("address") String address, @JsonProperty("salary") String salary, + @JsonProperty("occupation") String occupation, @JsonProperty("relationship") String relationship, @JsonProperty("tagged") List tagged) { this.name = name; this.phone = phone; this.email = email; this.address = address; + this.salary = salary; + this.occupation = occupation; + this.relationship = relationship; if (tagged != null) { this.tagged.addAll(tagged); } @@ -54,6 +65,9 @@ public JsonAdaptedPerson(Person source) { phone = source.getPhone().value; email = source.getEmail().value; address = source.getAddress().value; + salary = source.getSalary().value; + occupation = source.getOccupation().value; + relationship = source.getRelationship().value; tagged.addAll(source.getTags().stream() .map(JsonAdaptedTag::new) .collect(Collectors.toList())); @@ -102,8 +116,32 @@ public Person toModelType() throws IllegalValueException { } final Address modelAddress = new Address(address); + if (salary == null) { + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Salary.class.getSimpleName())); + } + if (!Salary.isValidSalary(salary)) { + throw new IllegalValueException(Salary.MESSAGE_CONSTRAINTS); + } + final Salary modelSalary = new Salary(salary); + + if (occupation == null) { + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Occupation.class.getSimpleName())); + } + if (!Occupation.isValidOccupation(occupation)) { + throw new IllegalValueException(Occupation.MESSAGE_CONSTRAINTS); + } + final Occupation modelOccupation = new Occupation(occupation); + + if (relationship == null) { + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Relationship.class.getSimpleName())); + } + if (!Relationship.isValidRelationship(relationship)) { + throw new IllegalValueException(Relationship.MESSAGE_CONSTRAINTS); + } + final Relationship modelRelationship = new Relationship(relationship); + final Set modelTags = new HashSet<>(personTags); - return new Person(modelName, modelPhone, modelEmail, modelAddress, modelTags); + return new Person(modelName, modelPhone, modelEmail, modelAddress, modelSalary, modelOccupation, modelRelationship, modelTags); } } diff --git a/src/main/java/seedu/address/ui/BrowserPanel.java b/src/main/java/seedu/address/ui/BrowserPanel.java index 53876e01c8d1..3a194f533a64 100644 --- a/src/main/java/seedu/address/ui/BrowserPanel.java +++ b/src/main/java/seedu/address/ui/BrowserPanel.java @@ -22,6 +22,9 @@ public class BrowserPanel extends UiPart { public static final URL DEFAULT_PAGE = requireNonNull(MainApp.class.getResource(FXML_FILE_FOLDER + "default.html")); + + //"https://se-edu.github.io/dummy-search-page/?name="; + //public static final String SEARCH_PAGE_URL = "https://www.google.com.sg/maps/search/"; public static final String SEARCH_PAGE_URL = "https://se-education.org/dummy-search-page/?name="; private static final String FXML = "BrowserPanel.fxml"; @@ -50,7 +53,7 @@ public BrowserPanel(ObservableValue selectedPerson) { } private void loadPersonPage(Person person) { - loadPage(SEARCH_PAGE_URL + person.getName().fullName); + loadPage(SEARCH_PAGE_URL + person.getAddress()); } public void loadPage(String url) { diff --git a/src/main/java/seedu/address/ui/PersonCard.java b/src/main/java/seedu/address/ui/PersonCard.java index f6727ea83abd..b27e039b65e1 100644 --- a/src/main/java/seedu/address/ui/PersonCard.java +++ b/src/main/java/seedu/address/ui/PersonCard.java @@ -13,6 +13,7 @@ public class PersonCard extends UiPart { private static final String FXML = "PersonListCard.fxml"; + private static final String[] TAG_COLORS = {"red", "yellow", "blue", "orange", "brown", "green"}; /** * Note: Certain keywords such as "location" and "resources" are reserved keywords in JavaFX. @@ -37,6 +38,12 @@ public class PersonCard extends UiPart { @FXML private Label email; @FXML + private Label salary; + @FXML + private Label occupation; + @FXML + private Label relationship; + @FXML private FlowPane tags; public PersonCard(Person person, int displayedIndex) { @@ -47,7 +54,15 @@ public PersonCard(Person person, int displayedIndex) { phone.setText(person.getPhone().value); address.setText(person.getAddress().value); email.setText(person.getEmail().value); - person.getTags().forEach(tag -> tags.getChildren().add(new Label(tag.tagName))); + salary.setText(person.getSalary().value); + occupation.setText(person.getOccupation().value); + relationship.setText(person.getRelationship().value); + + person.getTags().forEach(tag -> { + Label tagLabel = new Label(tag.tagName); + tagLabel.getStyleClass().add(TAG_COLORS[Math.abs(tag.tagName.hashCode()) % TAG_COLORS.length]); + tags.getChildren().add(tagLabel); + }); } @Override diff --git a/src/main/resources/view/DarkTheme.css b/src/main/resources/view/DarkTheme.css index 36e6b001cd8d..496d580ab467 100644 --- a/src/main/resources/view/DarkTheme.css +++ b/src/main/resources/view/DarkTheme.css @@ -350,3 +350,33 @@ -fx-background-radius: 2; -fx-font-size: 11; } + +#tags .red { + -fx-text-fill: black; + -fx-background-color: red; +} + +#tags .yellow { + -fx-background-color: yellow; + -fx-text-fill: black; +} + +#tags .blue { + -fx-text-fill: white; + -fx-background-color: blue; +} + +#tags .orange { + -fx-text-fill: black; + -fx-background-color: orange; +} + +#tags .brown { + -fx-text-fill: white; + -fx-background-color: brown; +} + +#tags .green { + -fx-text-fill: black; + -fx-background-color: green; +} diff --git a/src/test/data/JsonAddressBookStorageTest/invalidAndValidPersonAddressBook.json b/src/test/data/JsonAddressBookStorageTest/invalidAndValidPersonAddressBook.json index 6a4d2b7181c3..01a0fa8f73ef 100644 --- a/src/test/data/JsonAddressBookStorageTest/invalidAndValidPersonAddressBook.json +++ b/src/test/data/JsonAddressBookStorageTest/invalidAndValidPersonAddressBook.json @@ -3,11 +3,17 @@ "name": "Valid Person", "phone": "9482424", "email": "hans@example.com", - "address": "4th street" + "address": "4th street", + "salary": "8000", + "occupation": "teacher", + "relationship": "single" }, { "name": "Person With Invalid Phone Field", "phone": "948asdf2424", "email": "hans@example.com", - "address": "4th street" + "address": "4th street", + "salary": "5000", + "occupation": "mason", + "relationship": "married" } ] } diff --git a/src/test/data/JsonAddressBookStorageTest/invalidPersonAddressBook.json b/src/test/data/JsonAddressBookStorageTest/invalidPersonAddressBook.json index ccd21f7d1a93..2975758faac7 100644 --- a/src/test/data/JsonAddressBookStorageTest/invalidPersonAddressBook.json +++ b/src/test/data/JsonAddressBookStorageTest/invalidPersonAddressBook.json @@ -3,6 +3,9 @@ "name": "Person with invalid name field: Ha!ns Mu@ster", "phone": "9482424", "email": "hans@example.com", - "address": "4th street" + "address": "4th street", + "salary": "9000", + "occupation": "lawyer", + "relationship": "married" } ] } diff --git a/src/test/data/JsonSerializableAddressBookTest/duplicatePersonAddressBook.json b/src/test/data/JsonSerializableAddressBookTest/duplicatePersonAddressBook.json index 48831cc76744..d6760b2ed4dc 100644 --- a/src/test/data/JsonSerializableAddressBookTest/duplicatePersonAddressBook.json +++ b/src/test/data/JsonSerializableAddressBookTest/duplicatePersonAddressBook.json @@ -4,11 +4,17 @@ "phone": "94351253", "email": "alice@example.com", "address": "123, Jurong West Ave 6, #08-111", + "salary": "10000", + "occupation": "business analyst", + "relationship": "married", "tagged": [ "friends" ] }, { "name": "Alice Pauline", "phone": "94351253", "email": "pauline@example.com", - "address": "4th street" + "address": "4th street", + "salary": "7000", + "occupation": "research fellow", + "relationship": "married" } ] } diff --git a/src/test/data/JsonSerializableAddressBookTest/invalidPersonAddressBook.json b/src/test/data/JsonSerializableAddressBookTest/invalidPersonAddressBook.json index ad3f135ae428..81c4befbb2ca 100644 --- a/src/test/data/JsonSerializableAddressBookTest/invalidPersonAddressBook.json +++ b/src/test/data/JsonSerializableAddressBookTest/invalidPersonAddressBook.json @@ -3,6 +3,9 @@ "name": "Hans Muster", "phone": "9482424", "email": "invalid@email!3e", - "address": "4th street" + "address": "4th street", + "salary": "2000", + "occupation": "tutor", + "relationship": "single" } ] } diff --git a/src/test/data/JsonSerializableAddressBookTest/typicalPersonsAddressBook.json b/src/test/data/JsonSerializableAddressBookTest/typicalPersonsAddressBook.json index f10eddee12ed..4c4dd3e921e5 100644 --- a/src/test/data/JsonSerializableAddressBookTest/typicalPersonsAddressBook.json +++ b/src/test/data/JsonSerializableAddressBookTest/typicalPersonsAddressBook.json @@ -5,42 +5,63 @@ "phone" : "94351253", "email" : "alice@example.com", "address" : "123, Jurong West Ave 6, #08-111", + "salary": "10000", + "occupation": "business analyst", + "relationship": "married", "tagged" : [ "friends" ] }, { "name" : "Benson Meier", "phone" : "98765432", "email" : "johnd@example.com", "address" : "311, Clementi Ave 2, #02-25", + "salary": "15000", + "occupation": "doctor", + "relationship": "married", "tagged" : [ "owesMoney", "friends" ] }, { "name" : "Carl Kurz", "phone" : "95352563", "email" : "heinz@example.com", "address" : "wall street", + "salary": "30000", + "occupation": "investment banker", + "relationship": "single", "tagged" : [ ] }, { "name" : "Daniel Meier", "phone" : "87652533", "email" : "cornelia@example.com", "address" : "10th street", + "salary": "8000", + "occupation": "software engineer", + "relationship": "single", "tagged" : [ "friends" ] }, { "name" : "Elle Meyer", "phone" : "9482224", "email" : "werner@example.com", "address" : "michegan ave", + "salary": "4000", + "occupation": "admin staff", + "relationship": "married", "tagged" : [ ] }, { "name" : "Fiona Kunz", "phone" : "9482427", "email" : "lydia@example.com", "address" : "little tokyo", + "salary": "6000", + "occupation": "electrical engineer", + "relationship": "single", "tagged" : [ ] }, { "name" : "George Best", "phone" : "9482442", "email" : "anna@example.com", "address" : "4th street", + "salary": "8500", + "occupation": "audit", + "relationship": "single", "tagged" : [ ] } ] } diff --git a/src/test/java/guitests/guihandles/PersonCardHandle.java b/src/test/java/guitests/guihandles/PersonCardHandle.java index 1789735e49a8..7e607081803e 100644 --- a/src/test/java/guitests/guihandles/PersonCardHandle.java +++ b/src/test/java/guitests/guihandles/PersonCardHandle.java @@ -19,6 +19,9 @@ public class PersonCardHandle extends NodeHandle { private static final String ADDRESS_FIELD_ID = "#address"; private static final String PHONE_FIELD_ID = "#phone"; private static final String EMAIL_FIELD_ID = "#email"; + private static final String SALARY_FIELD_ID = "#salary"; + private static final String OCCUPATION_FIELD_ID = "#occupation"; + private static final String RELATIONSHIP_FIELD_ID = "#relationship"; private static final String TAGS_FIELD_ID = "#tags"; private final Label idLabel; @@ -26,6 +29,9 @@ public class PersonCardHandle extends NodeHandle { private final Label addressLabel; private final Label phoneLabel; private final Label emailLabel; + private final Label salaryLabel; + private final Label occupationLabel; + private final Label relationshipLabel; private final List