Skip to content

Commit

Permalink
Merge pull request nus-cs2103-AY2223S2#71 from SHni99/v1.3
Browse files Browse the repository at this point in the history
V1.3 [Bug fixes in personal pane + modify tag in edit parser]
  • Loading branch information
hongshenggg authored Mar 26, 2023
2 parents bd75a10 + 342d5f2 commit 713115c
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 17 deletions.
12 changes: 10 additions & 2 deletions src/main/java/seedu/address/logic/parser/EditCommandParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import static java.util.Objects.requireNonNull;
import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_COMMITMENT_TAG;
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
import static seedu.address.logic.parser.CliSyntax.PREFIX_MODULE_TAG;
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_STATUS;
Expand All @@ -13,6 +15,8 @@
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import seedu.address.commons.core.index.Index;
import seedu.address.logic.commands.EditCommand;
Expand All @@ -35,7 +39,7 @@ public EditCommand parse(String args) throws ParseException {
requireNonNull(args);
ArgumentMultimap argMultimap =
ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_STATUS, PREFIX_PHONE, PREFIX_EMAIL,
PREFIX_ADDRESS, PREFIX_TAG);
PREFIX_ADDRESS, PREFIX_TAG, PREFIX_COMMITMENT_TAG, PREFIX_MODULE_TAG);

Index index;

Expand All @@ -61,7 +65,11 @@ public EditCommand parse(String args) throws ParseException {
if (argMultimap.getValue(PREFIX_ADDRESS).isPresent()) {
editPersonDescriptor.setAddress(ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get()));
}
parseTagsForEdit(argMultimap.getAllValues(PREFIX_TAG)).ifPresent(editPersonDescriptor::setTags);
Collection<String> allTags = Stream.of(argMultimap.getAllValues(PREFIX_TAG),
argMultimap.getAllValues(PREFIX_MODULE_TAG), argMultimap.getAllValues(PREFIX_COMMITMENT_TAG))
.flatMap(Collection::stream)
.collect(Collectors.toList());
parseTagsForEdit(allTags).ifPresent(editPersonDescriptor::setTags);

if (!editPersonDescriptor.isAnyFieldEdited()) {
throw new ParseException(EditCommand.MESSAGE_NOT_EDITED);
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/seedu/address/model/tag/AffiliationTag.java

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/tag/ModuleTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public ModuleTag(String tagName) {
*/
@Override
public String tagColor() {
return "#006400";
return "#193E04";
}

@Override
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/seedu/address/model/tag/Tag.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
*/
public class Tag {

public static final String MESSAGE_CONSTRAINTS = "Tags names should be alphanumeric";
public static final String MESSAGE_CONSTRAINTS = "Tags names should be alphanumeric, do not include"
+ " characters like @,#,*,- or white space between words";
public static final String VALIDATION_REGEX = "\\p{Alnum}+";

public final String tagName;
Expand All @@ -36,7 +37,7 @@ public static boolean isValidTagName(String test) {
* @return the corresponding color code for css
*/
public String tagColor() {
return "#3e7b91";
return "#000080";
}

@Override
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/seedu/address/ui/PersonalPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ public PersonalPane(Person person) {
status.setText(person.getStatus().fullStatusDetail);
phone.setText(person.getPhone().value);
address.setText(person.getAddress().value);
if (address.getText().length() > 35) {
address.setWrapText(true);
}
if (address.isWrapText()) {
address.setTranslateY(10);
}
email.setText(person.getEmail().value);
person.getTags().stream()
.sorted(Comparator.comparing(tag -> tag.tagName))
Expand Down
9 changes: 5 additions & 4 deletions src/main/resources/view/PersonalPane.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
xmlns:fx="http://javafx.com/fxml">
<GridPane HBox.hgrow="ALWAYS">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10" prefWidth="150"/>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10" prefWidth="200"/>
</columnConstraints>
<VBox GridPane.columnIndex="0" alignment="CENTER">
<padding>
<Insets top="10" right="10" bottom="10" left="10"/>
</padding>

<ImageView fx:id="imageView" fitWidth="150" preserveRatio="true">
<ImageView fx:id="imageView" fitWidth="200" fitHeight="160" preserveRatio="true">
</ImageView>
<VBox alignment="CENTER">
<Label fx:id="id" styleClass="cell_big_label">
Expand All @@ -35,9 +35,10 @@
<Label fx:id="phone" styleClass="cell_small_label" text="\$phone"/>
</HBox>
<HBox alignment="CENTER">
<Label text="Address: "/>
<Label fx:id="address" styleClass="cell_small_label" text="Address: \$address"/>
<Label text="Address: " minWidth="60" wrapText="true"/>
<Label fx:id="address" styleClass="cell_small_label" text="\$address"/>
</HBox>

<HBox alignment="CENTER">
<Label text="Email: "/>
<Label fx:id="email" styleClass="cell_small_label" text="\$email"/>
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/view/Style.css
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
-fx-font-size: 15px;
-fx-text-fill: #010504;
-fx-padding: 5px;
-fx-text-alignment: center;
}

.stack-pane {
Expand Down

0 comments on commit 713115c

Please sign in to comment.