Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/overview-panel-empty-space
Browse files Browse the repository at this point in the history
  • Loading branch information
Darren-Tung authored Nov 6, 2024
2 parents 27b7aa6 + 8cc7432 commit 588f063
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 25 deletions.
1 change: 0 additions & 1 deletion src/main/java/seedu/address/logic/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class Messages {
public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d persons listed!";
public static final String MESSAGE_DUPLICATE_FIELDS =
"Multiple values specified for the following single-valued field(s): ";

/**
* Returns an error message indicating the duplicate prefixes.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);
List<Person> lastShownList = model.getFilteredPersonList();

// Check if the index is out of bounds
if (index.getZeroBased() >= lastShownList.size()) {
throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
}
Expand Down
28 changes: 14 additions & 14 deletions src/main/java/seedu/address/logic/parser/EditCommandParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,10 @@ public EditCommand parse(String args) throws ParseException {
try {
index = ParserUtil.parseIndex(argMultimap.getPreamble());
} catch (ParseException pe) {
throw new ParseException(
String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditCommand.MESSAGE_USAGE), pe);
// Throw exception with usage message
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditCommand.MESSAGE_USAGE), pe);
}

argMultimap.verifyNoDuplicatePrefixesFor(
PREFIX_NAME,
PREFIX_PHONE,
PREFIX_EMAIL,
PREFIX_ADDRESS,
PREFIX_DESIREDROLE,
PREFIX_SKILLS,
PREFIX_EXPERIENCE,
PREFIX_STATUS,
PREFIX_NOTE);

EditPersonDescriptor editPersonDescriptor = new EditPersonDescriptor();

Expand Down Expand Up @@ -118,6 +108,18 @@ public EditCommand parse(String args) throws ParseException {
throw new ParseException(EditCommand.MESSAGE_NOT_EDITED);
}

// Now verify for duplicate prefixes after ensuring at least one field is edited
argMultimap.verifyNoDuplicatePrefixesFor(
PREFIX_NAME,
PREFIX_PHONE,
PREFIX_EMAIL,
PREFIX_ADDRESS,
PREFIX_DESIREDROLE,
PREFIX_SKILLS,
PREFIX_EXPERIENCE,
PREFIX_STATUS,
PREFIX_NOTE);

return new EditCommand(index, editPersonDescriptor);
}

Expand All @@ -139,6 +141,4 @@ private Optional<Set<Tag>> parseTagsForEdit(Collection<String> tags) throws Pars
: tags;
return Optional.of(ParserUtil.parseTags(tagSet));
}


}
2 changes: 2 additions & 0 deletions src/main/java/seedu/address/logic/parser/ParserUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public static Experience parseExperience(String experience) throws ParseExceptio
return new Experience(trimmedExperience);
}


/**
* Parses a {@code String status} into a {@code Status}.
* Leading and trailing whitespaces will be trimmed.
Expand Down Expand Up @@ -191,6 +192,7 @@ public static Tag parseTag(String tag) throws ParseException {
return new Tag(trimmedTag);
}


/**
* Parses {@code Collection<String> tags} into a {@code Set<Tag>}.
*/
Expand Down
11 changes: 6 additions & 5 deletions src/main/resources/view/NewTheme.css
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,10 @@ table-view .column-header .label {
.summary-list-cell {
-fx-font-size: 14px;
-fx-font-weight: bold;
-fx-text-fill: #ffffff; /* Set your preferred text color */
-fx-background-color: #333333; /* Set background color for cell */
-fx-text-fill: #ffffff;
-fx-background-color: #333333;
-fx-padding: 10px;
-fx-border-color: #555555; /* Optional border for the cell */
-fx-border-color: #555555;
-fx-border-width: 1px;
-fx-border-radius: 4px;
-fx-background-radius: 4px;
Expand All @@ -289,5 +289,6 @@ table-view .column-header .label {
-fx-text-fill: white;
}



.scroll-bar {
-fx-pref-width: 1px;
}
2 changes: 1 addition & 1 deletion src/main/resources/view/ResultDisplay.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
<?import javafx.scene.layout.StackPane?>

<StackPane fx:id="placeHolder" styleClass="pane-with-border" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<TextArea fx:id="resultDisplay" minHeight="150" editable="false" styleClass="result-display" />
<TextArea fx:id="resultDisplay" minHeight="99" editable="false" styleClass="result-display" />
</StackPane>
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,26 @@ public void parse_missingParts_failure() {
assertParseFailure(parser, "", MESSAGE_INVALID_FORMAT);
}


@Test
public void parse_invalidPreamble_failure() {
// negative index
// Negative index should trigger invalid format
assertParseFailure(parser, "-5" + NAME_DESC_AMY, MESSAGE_INVALID_FORMAT);

// zero index
// Zero index should trigger invalid format
assertParseFailure(parser, "0" + NAME_DESC_AMY, MESSAGE_INVALID_FORMAT);

// invalid arguments being parsed as preamble
// Invalid arguments being parsed as preamble should trigger invalid format
assertParseFailure(parser, "1 some random string", MESSAGE_INVALID_FORMAT);

// invalid prefix being parsed as preamble
// Invalid prefix being parsed as preamble should trigger invalid format
assertParseFailure(parser, "1 i/ string", MESSAGE_INVALID_FORMAT);
}





@Test
public void parse_invalidValue_failure() {
// invalid name
Expand Down

0 comments on commit 588f063

Please sign in to comment.