diff --git a/src/main/java/seedu/address/logic/commands/AddGCommand.java b/src/main/java/seedu/address/logic/commands/AddGCommand.java index efb59bba028..b9b920ab033 100644 --- a/src/main/java/seedu/address/logic/commands/AddGCommand.java +++ b/src/main/java/seedu/address/logic/commands/AddGCommand.java @@ -1,38 +1,67 @@ package seedu.address.logic.commands; +import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS; + +import java.util.List; + +import seedu.address.commons.core.index.Index; import seedu.address.commons.util.ToStringBuilder; +import seedu.address.logic.Messages; import seedu.address.logic.commands.exceptions.CommandException; import seedu.address.model.Model; +import seedu.address.model.person.Github; +import seedu.address.model.person.Person; /** * Adds GitHub account to candidates existing details. */ public class AddGCommand extends Command { - public static final String COMMAND_WORD = "addL"; + public static final String COMMAND_WORD = "addG"; - public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds LinkedIn to details of a candidate. " + public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds Github to details of a candidate. " + "Parameters: " + "[" + COMMAND_WORD + " ]...\n" + "Example: " + COMMAND_WORD + " 2 alexyeoh"; - public static final String MESSAGE_SUCCESS = "LinkedIn account added for: %1$s"; + public static final String MESSAGE_SUCCESS = "Github account added for: %1$s"; - private final int targetIndex; + private final Index index; - private final String username; + private final Github username; /** * Creates an AddG Command to add Github. - * @param targetIndex + * @param index * @param username */ - public AddGCommand(int targetIndex, String username) { - this.targetIndex = targetIndex; + public AddGCommand(Index index, Github username) { + this.index = index; this.username = username; } @Override public CommandResult execute(Model model) throws CommandException { - return new CommandResult(String.format(MESSAGE_SUCCESS, "PLACEHOLDER")); + List lastShownList = model.getFilteredPersonList(); + + if (index.getZeroBased() >= lastShownList.size()) { + throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); + } + + Person personToEdit = lastShownList.get(index.getZeroBased()); + personToEdit.setGithub(username); + model.setPerson(personToEdit, personToEdit); + model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS); + + return new CommandResult(generateSuccessMessage(personToEdit)); + } + + /** + * Generates a command execution success message based on whether + * the username is added to or removed from + * {@code personToEdit}. + */ + private String generateSuccessMessage(Person personToEdit) { + String message = !username.value.isEmpty() ? MESSAGE_SUCCESS : ""; + return String.format(message, personToEdit.getName()); } @Override @@ -47,12 +76,12 @@ public boolean equals(Object other) { } AddGCommand otherAddGCommand = (AddGCommand) other; - return this.targetIndex == otherAddGCommand.targetIndex && this.username.equals(otherAddGCommand.username); + return this.index.equals(otherAddGCommand.index) && this.username.equals(otherAddGCommand.username); } @Override public String toString() { - return new ToStringBuilder(this).add("targetIndex", targetIndex).add("username", username).toString(); + return new ToStringBuilder(this).add("index", index).add("username", username).toString(); } } diff --git a/src/main/java/seedu/address/logic/commands/AddLCommand.java b/src/main/java/seedu/address/logic/commands/AddLCommand.java index a2f1371a15f..67ce9d837ba 100644 --- a/src/main/java/seedu/address/logic/commands/AddLCommand.java +++ b/src/main/java/seedu/address/logic/commands/AddLCommand.java @@ -1,38 +1,66 @@ package seedu.address.logic.commands; +import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS; + +import java.util.List; + +import seedu.address.commons.core.index.Index; import seedu.address.commons.util.ToStringBuilder; +import seedu.address.logic.Messages; import seedu.address.logic.commands.exceptions.CommandException; import seedu.address.model.Model; +import seedu.address.model.person.LinkedIn; +import seedu.address.model.person.Person; /** * Adds LinkedIn account to candidate's existing details. */ public class AddLCommand extends Command { public static final String COMMAND_WORD = "addL"; - public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds LinkedIn to details of a candidate. " + "Parameters: " + "[" + COMMAND_WORD + " ]...\n" + "Example: " + COMMAND_WORD + " 2 alexyeoh"; public static final String MESSAGE_SUCCESS = "LinkedIn account added for: %1$s"; - private final int targetIndex; + private final Index index; - private final String username; + private final LinkedIn username; /** * Creates an AddL command to add LinkedIn. - * @param targetIndex + * @param index * @param username */ - public AddLCommand(int targetIndex, String username) { - this.targetIndex = targetIndex; + public AddLCommand(Index index, LinkedIn username) { + this.index = index; this.username = username; } @Override public CommandResult execute(Model model) throws CommandException { - return new CommandResult(String.format(MESSAGE_SUCCESS, "PLACEHOLDER")); + List lastShownList = model.getFilteredPersonList(); + + if (index.getZeroBased() >= lastShownList.size()) { + throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); + } + + Person personToEdit = lastShownList.get(index.getZeroBased()); + personToEdit.setLinkedIn(username); + model.setPerson(personToEdit, personToEdit); + model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS); + + return new CommandResult(generateSuccessMessage(personToEdit)); + } + + /** + * Generates a command execution success message based on whether + * the username is added to or removed from + * {@code personToEdit}. + */ + private String generateSuccessMessage(Person personToEdit) { + String message = !username.value.isEmpty() ? MESSAGE_SUCCESS : ""; + return String.format(message, personToEdit.getName()); } @Override @@ -47,12 +75,12 @@ public boolean equals(Object other) { } AddLCommand otherAddLCommand = (AddLCommand) other; - return this.targetIndex == otherAddLCommand.targetIndex && this.username.equals(otherAddLCommand.username); + return this.index.equals(otherAddLCommand.index) && this.username.equals(otherAddLCommand.username); } @Override public String toString() { - return new ToStringBuilder(this).add("targetIndex", targetIndex).add("username", username).toString(); + return new ToStringBuilder(this).add("index", index).add("username", username).toString(); } } diff --git a/src/main/java/seedu/address/logic/commands/EditCommand.java b/src/main/java/seedu/address/logic/commands/EditCommand.java index 7af50ba77ab..9c3d7a9038d 100644 --- a/src/main/java/seedu/address/logic/commands/EditCommand.java +++ b/src/main/java/seedu/address/logic/commands/EditCommand.java @@ -102,7 +102,6 @@ private static Person createEditedPerson(Person personToEdit, EditPersonDescript Address updatedAddress = editPersonDescriptor.getAddress().orElse(personToEdit.getAddress()); Remark updatedRemark = personToEdit.getRemark(); Set updatedTags = editPersonDescriptor.getTags().orElse(personToEdit.getTags()); - return new Person(updatedName, updatedPhone, updatedEmail, updatedAddress, updatedRemark, updatedTags); } diff --git a/src/main/java/seedu/address/logic/commands/GithubCommand.java b/src/main/java/seedu/address/logic/commands/GithubCommand.java new file mode 100644 index 00000000000..6e8d95f02ed --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/GithubCommand.java @@ -0,0 +1,51 @@ +package seedu.address.logic.commands; + +import java.awt.Desktop; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; + +import seedu.address.commons.core.index.Index; +import seedu.address.logic.Messages; +import seedu.address.logic.commands.exceptions.CommandException; +import seedu.address.model.Model; +import seedu.address.model.person.Person; + +/** + * Redirects user to the Github account of a specific candidates. + */ +public class GithubCommand extends Command { + + public static final String COMMAND_WORD = "github"; + public static final String MESSAGE_USAGE = COMMAND_WORD + ": Redirects to user's Github account. " + + "Parameters: " + "[" + COMMAND_WORD + " ]...\n" + + "Example: " + COMMAND_WORD + " 2"; + public static final String MESSAGE_SUCCESS = "Redirecting to Github ..."; + + private final Index index; + + public GithubCommand(Index index) { + this.index = index; + } + + @Override + public CommandResult execute(Model model) throws CommandException { + List lastShownList = model.getFilteredPersonList(); + + if (index.getZeroBased() >= lastShownList.size()) { + throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); + } + + Person personToEdit = lastShownList.get(index.getZeroBased()); + String username = personToEdit.getGithub().value; + String githubUrl = "https://github.com/" + username; + try { + Desktop.getDesktop().browse(new URI(githubUrl)); + } catch (IOException | URISyntaxException e) { + System.out.println(e.getMessage()); + } + + return new CommandResult(MESSAGE_SUCCESS); + } +} diff --git a/src/main/java/seedu/address/logic/commands/LinkedInCommand.java b/src/main/java/seedu/address/logic/commands/LinkedInCommand.java new file mode 100644 index 00000000000..eb28ec9798a --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/LinkedInCommand.java @@ -0,0 +1,51 @@ +package seedu.address.logic.commands; + +import java.awt.Desktop; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; + +import seedu.address.commons.core.index.Index; +import seedu.address.logic.Messages; +import seedu.address.logic.commands.exceptions.CommandException; +import seedu.address.model.Model; +import seedu.address.model.person.Person; + +/** + * Redirects the user to the LinkedIn account of a specific candidate. + */ +public class LinkedInCommand extends Command { + + public static final String COMMAND_WORD = "linkedin"; + public static final String MESSAGE_USAGE = COMMAND_WORD + ": Redirects to user's LinkedIn account. " + + "Parameters: " + "[" + COMMAND_WORD + " ]...\n" + + "Example: " + COMMAND_WORD + " 2"; + public static final String MESSAGE_SUCCESS = "Redirecting to LinkedIn ..."; + + private final Index index; + + public LinkedInCommand(Index index) { + this.index = index; + } + + @Override + public CommandResult execute(Model model) throws CommandException { + List lastShownList = model.getFilteredPersonList(); + + if (index.getZeroBased() >= lastShownList.size()) { + throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); + } + + Person personToEdit = lastShownList.get(index.getZeroBased()); + String username = personToEdit.getLinkedIn().value; + String linkedInUrl = "https://www.linkedin.com/in/" + username; + try { + Desktop.getDesktop().browse(new URI(linkedInUrl)); + } catch (IOException | URISyntaxException e) { + System.out.println(e.getMessage()); + } + + return new CommandResult(MESSAGE_SUCCESS); + } +} diff --git a/src/main/java/seedu/address/logic/parser/AddGCommandParser.java b/src/main/java/seedu/address/logic/parser/AddGCommandParser.java new file mode 100644 index 00000000000..cec73240ced --- /dev/null +++ b/src/main/java/seedu/address/logic/parser/AddGCommandParser.java @@ -0,0 +1,39 @@ +package seedu.address.logic.parser; + +import static java.util.Objects.requireNonNull; +import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; +import static seedu.address.logic.parser.CliSyntax.PREFIX_USERNAME; + +import seedu.address.commons.core.index.Index; +import seedu.address.logic.commands.AddGCommand; +import seedu.address.logic.parser.exceptions.ParseException; +import seedu.address.model.person.Github; + +/** + * Parses input arguments and creates a new AddLCommand object + */ +public class AddGCommandParser implements Parser { + + /** + * Parses the given {@code String} of arguments in the context of the AddLCommand + * and returns an AddLCommand object for execution. + * @throws ParseException if the user input does not conform the expected format + */ + public AddGCommand parse(String args) throws ParseException { + requireNonNull(args); + ArgumentMultimap argMultiMap = ArgumentTokenizer.tokenize(args, PREFIX_USERNAME); + + Index index; + + try { + index = ParserUtil.parseIndex(argMultiMap.getPreamble()); + } catch (ParseException pe) { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddGCommand.MESSAGE_USAGE), pe); + } + + index = ParserUtil.parseIndex(argMultiMap.getPreamble()); + String username = argMultiMap.getValue(PREFIX_USERNAME).orElse(""); + + return new AddGCommand(index, new Github(username)); + } +} diff --git a/src/main/java/seedu/address/logic/parser/AddLCommandParser.java b/src/main/java/seedu/address/logic/parser/AddLCommandParser.java new file mode 100644 index 00000000000..9f50d920717 --- /dev/null +++ b/src/main/java/seedu/address/logic/parser/AddLCommandParser.java @@ -0,0 +1,38 @@ +package seedu.address.logic.parser; + +import static java.util.Objects.requireNonNull; +import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; +import static seedu.address.logic.parser.CliSyntax.PREFIX_USERNAME; + +import seedu.address.commons.core.index.Index; +import seedu.address.logic.commands.AddLCommand; +import seedu.address.logic.parser.exceptions.ParseException; +import seedu.address.model.person.LinkedIn; + +/** + * Parses input arguments and creates a new AddLCommand object + */ +public class AddLCommandParser implements Parser { + + /** + * Parses the given {@code String} of arguments in the context of the AddLCommand + * and returns an AddLCommand object for execution. + * @throws ParseException if the user input does not conform the expected format + */ + public AddLCommand parse(String args) throws ParseException { + requireNonNull(args); + ArgumentMultimap argMultiMap = ArgumentTokenizer.tokenize(args, PREFIX_USERNAME); + Index index; + + try { + index = ParserUtil.parseIndex(argMultiMap.getPreamble()); + } catch (ParseException pe) { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddLCommand.MESSAGE_USAGE), pe); + } + + index = ParserUtil.parseIndex(argMultiMap.getPreamble()); + String username = argMultiMap.getValue(PREFIX_USERNAME).orElse(""); + + return new AddLCommand(index, new LinkedIn(username)); + } +} diff --git a/src/main/java/seedu/address/logic/parser/AddressBookParser.java b/src/main/java/seedu/address/logic/parser/AddressBookParser.java index e97c9423de4..9cee1e2ae00 100644 --- a/src/main/java/seedu/address/logic/parser/AddressBookParser.java +++ b/src/main/java/seedu/address/logic/parser/AddressBookParser.java @@ -9,13 +9,17 @@ import seedu.address.commons.core.LogsCenter; import seedu.address.logic.commands.AddCommand; +import seedu.address.logic.commands.AddGCommand; +import seedu.address.logic.commands.AddLCommand; import seedu.address.logic.commands.ClearCommand; import seedu.address.logic.commands.Command; import seedu.address.logic.commands.DeleteCommand; import seedu.address.logic.commands.EditCommand; import seedu.address.logic.commands.ExitCommand; import seedu.address.logic.commands.FindCommand; +import seedu.address.logic.commands.GithubCommand; import seedu.address.logic.commands.HelpCommand; +import seedu.address.logic.commands.LinkedInCommand; import seedu.address.logic.commands.ListCommand; import seedu.address.logic.commands.RemarkCommand; import seedu.address.logic.commands.ViewCommand; @@ -85,6 +89,18 @@ public Command parseCommand(String userInput) throws ParseException { case ViewCommand.COMMAND_WORD: return new ViewCommandParser().parse(arguments); + case AddLCommand.COMMAND_WORD: + return new AddLCommandParser().parse(arguments); + + case AddGCommand.COMMAND_WORD: + return new AddGCommandParser().parse(arguments); + + case LinkedInCommand.COMMAND_WORD: + return new LinkedInCommandParser().parse(arguments); + + case GithubCommand.COMMAND_WORD: + return new GithubCommandParser().parse(arguments); + default: logger.finer("This user input caused a ParseException: " + userInput); 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 75911ac5a4a..27282e1c52c 100644 --- a/src/main/java/seedu/address/logic/parser/CliSyntax.java +++ b/src/main/java/seedu/address/logic/parser/CliSyntax.java @@ -17,4 +17,5 @@ public class CliSyntax { public static final Prefix PREFIX_TAG = new Prefix("t/"); public static final Prefix PREFIX_SORT = new Prefix("so/"); public static final Prefix PREFIX_STATUS = new Prefix("st/"); + public static final Prefix PREFIX_USERNAME = new Prefix("u/"); } diff --git a/src/main/java/seedu/address/logic/parser/GithubCommandParser.java b/src/main/java/seedu/address/logic/parser/GithubCommandParser.java new file mode 100644 index 00000000000..cbf29935fc9 --- /dev/null +++ b/src/main/java/seedu/address/logic/parser/GithubCommandParser.java @@ -0,0 +1,27 @@ +package seedu.address.logic.parser; + +import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; + +import seedu.address.commons.core.index.Index; +import seedu.address.logic.commands.GithubCommand; +import seedu.address.logic.parser.exceptions.ParseException; + +/** + * Parses input arguments and creates a new GithubCommand object. + */ +public class GithubCommandParser implements Parser { + /** + * Parses the given {@code String} of arguments in the context of the GithubCommand + * and returns a GithubCommand object. + * @throws ParseException if the user input does not conform the expected format. + */ + public GithubCommand parse(String args) throws ParseException { + try { + Index index = ParserUtil.parseIndex(args); + return new GithubCommand(index); + } catch (ParseException pe) { + throw new ParseException( + String.format(MESSAGE_INVALID_COMMAND_FORMAT, GithubCommand.MESSAGE_USAGE), pe); + } + } +} diff --git a/src/main/java/seedu/address/logic/parser/LinkedInCommandParser.java b/src/main/java/seedu/address/logic/parser/LinkedInCommandParser.java new file mode 100644 index 00000000000..d36536bff5a --- /dev/null +++ b/src/main/java/seedu/address/logic/parser/LinkedInCommandParser.java @@ -0,0 +1,27 @@ +package seedu.address.logic.parser; + +import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; + +import seedu.address.commons.core.index.Index; +import seedu.address.logic.commands.LinkedInCommand; +import seedu.address.logic.parser.exceptions.ParseException; + +/** + * Parses input arguments and creates a new GithubCommand object. + */ +public class LinkedInCommandParser implements Parser { + /** + * Parses the given {@code String} of arguments in the context of the LinkedInCommand + * and returns a LinkedInCommand object. + * @throws ParseException if the user input does not conform the expected format. + */ + public LinkedInCommand parse(String args) throws ParseException { + try { + Index index = ParserUtil.parseIndex(args); + return new LinkedInCommand(index); + } catch (ParseException pe) { + throw new ParseException( + String.format(MESSAGE_INVALID_COMMAND_FORMAT, LinkedInCommand.MESSAGE_USAGE), pe); + } + } +} diff --git a/src/main/java/seedu/address/model/person/Github.java b/src/main/java/seedu/address/model/person/Github.java index b69bad7bbfd..2b6647c9d54 100644 --- a/src/main/java/seedu/address/model/person/Github.java +++ b/src/main/java/seedu/address/model/person/Github.java @@ -1,7 +1,5 @@ package seedu.address.model.person; -import static java.util.Objects.requireNonNull; - /** * Represents a person's Github details in JABPro. */ @@ -14,7 +12,6 @@ public class Github { * @param github A valid Github username */ public Github(String github) { - requireNonNull(github); value = github; } diff --git a/src/main/java/seedu/address/model/person/LinkedIn.java b/src/main/java/seedu/address/model/person/LinkedIn.java index b4b58f37daa..2b50bc69d44 100644 --- a/src/main/java/seedu/address/model/person/LinkedIn.java +++ b/src/main/java/seedu/address/model/person/LinkedIn.java @@ -1,7 +1,5 @@ package seedu.address.model.person; -import static java.util.Objects.requireNonNull; - /** * Represents a person's LinkedIn details in JABPro. */ @@ -14,7 +12,6 @@ public class LinkedIn { * @param linkedin */ public LinkedIn(String linkedin) { - requireNonNull(linkedin); value = linkedin; } diff --git a/src/main/java/seedu/address/model/person/Person.java b/src/main/java/seedu/address/model/person/Person.java index 2977e97f4a3..2d616960422 100644 --- a/src/main/java/seedu/address/model/person/Person.java +++ b/src/main/java/seedu/address/model/person/Person.java @@ -26,8 +26,8 @@ public class Person { private final Remark remark; private final Set tags = new HashSet<>(); - private final LinkedIn linkedIn = new LinkedIn(""); - private final Github github = new Github(""); + private LinkedIn linkedIn = new LinkedIn(""); + private Github github = new Github(""); private final Status currentStatus = new Status(); /** @@ -88,6 +88,14 @@ public Github getGithub() { return github; } + public void setLinkedIn(LinkedIn linkedIn) { + this.linkedIn = linkedIn; + } + + public void setGithub(Github github) { + this.github = github; + } + /** * Returns true if both persons have the same name. * This defines a weaker notion of equality between two persons. diff --git a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java b/src/main/java/seedu/address/storage/JsonAdaptedPerson.java index 9f581284770..4b341ba3db6 100644 --- a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java +++ b/src/main/java/seedu/address/storage/JsonAdaptedPerson.java @@ -12,6 +12,8 @@ import seedu.address.commons.exceptions.IllegalValueException; import seedu.address.model.person.Address; import seedu.address.model.person.Email; +import seedu.address.model.person.Github; +import seedu.address.model.person.LinkedIn; import seedu.address.model.person.Name; import seedu.address.model.person.Person; import seedu.address.model.person.Phone; @@ -30,6 +32,8 @@ class JsonAdaptedPerson { private final String email; private final String address; private final List tags = new ArrayList<>(); + private final String linkedIn; + private final String github; /** * Constructs a {@code JsonAdaptedPerson} with the given person details. @@ -37,7 +41,8 @@ class JsonAdaptedPerson { @JsonCreator public JsonAdaptedPerson(@JsonProperty("name") String name, @JsonProperty("phone") String phone, @JsonProperty("email") String email, @JsonProperty("address") String address, - @JsonProperty("tags") List tags) { + @JsonProperty("tags") List tags, @JsonProperty("linkedIn") String linkedIn, + @JsonProperty("github") String github) { this.name = name; this.phone = phone; this.email = email; @@ -45,6 +50,9 @@ public JsonAdaptedPerson(@JsonProperty("name") String name, @JsonProperty("phone if (tags != null) { this.tags.addAll(tags); } + this.linkedIn = linkedIn; + this.github = github; + } /** @@ -58,6 +66,8 @@ public JsonAdaptedPerson(Person source) { tags.addAll(source.getTags().stream() .map(JsonAdaptedTag::new) .collect(Collectors.toList())); + linkedIn = source.getLinkedIn().value; + github = source.getGithub().value; } /** @@ -105,7 +115,13 @@ public Person toModelType() throws IllegalValueException { final Remark modelRemark = new Remark(""); //TODO: Implement parsing and marshalling in storage commits final Set modelTags = new HashSet<>(personTags); - return new Person(modelName, modelPhone, modelEmail, modelAddress, modelRemark, modelTags); + Person p = new Person(modelName, modelPhone, modelEmail, modelAddress, modelRemark, modelTags); + if (linkedIn != null) { + p.setLinkedIn(new LinkedIn(linkedIn)); + } + if (github != null) { + p.setGithub(new Github(github)); + } + return p; } - } diff --git a/src/main/java/seedu/address/ui/PersonCard.java b/src/main/java/seedu/address/ui/PersonCard.java index b5516911400..4f24ef6418d 100644 --- a/src/main/java/seedu/address/ui/PersonCard.java +++ b/src/main/java/seedu/address/ui/PersonCard.java @@ -42,6 +42,10 @@ public class PersonCard extends UiPart { private Label email; @FXML private FlowPane tags; + @FXML + private Label linkedIn; + @FXML + private Label github; /** * Creates a {@code PersonCode} with the given {@code Person} and index to display. @@ -55,6 +59,8 @@ public PersonCard(Person person, int displayedIndex) { address.setText(person.getAddress().value); email.setText(person.getEmail().value); remark.setText(person.getRemark().value); + linkedIn.setText(person.getLinkedIn().value); + github.setText(person.getGithub().value); person.getTags().stream() .sorted(Comparator.comparing(tag -> tag.tagName)) .forEach(tag -> tags.getChildren().add(new Label(tag.tagName))); diff --git a/src/main/java/seedu/address/ui/PersonInformationPanel.java b/src/main/java/seedu/address/ui/PersonInformationPanel.java index 83df8b390ae..ef918fd87c6 100644 --- a/src/main/java/seedu/address/ui/PersonInformationPanel.java +++ b/src/main/java/seedu/address/ui/PersonInformationPanel.java @@ -29,6 +29,10 @@ public class PersonInformationPanel extends UiPart { private Label email; @FXML private Label remark; + @FXML + private Label linkedIn; + @FXML + private Label github; /** @@ -46,6 +50,8 @@ public PersonInformationPanel(Person person) { person.getTags().stream() .sorted(java.util.Comparator.comparing(tag -> tag.tagName)) .forEach(tag -> tags.getChildren().add(new Label(tag.tagName))); + linkedIn.setText(person.getLinkedIn().value); + github.setText(person.getGithub().value); } diff --git a/src/main/resources/view/PersonListCard.fxml b/src/main/resources/view/PersonListCard.fxml index 1bff2cd09eb..7a198d26241 100644 --- a/src/main/resources/view/PersonListCard.fxml +++ b/src/main/resources/view/PersonListCard.fxml @@ -32,6 +32,8 @@