From e274bb8a01fb77ebef61c20236fee3138d2a8380 Mon Sep 17 00:00:00 2001 From: MingYiAw Date: Mon, 11 Nov 2024 18:15:38 +0800 Subject: [PATCH 1/2] fix: Fix PE-D Bugs --- src/main/java/seedu/address/logic/Messages.java | 1 + .../address/logic/commands/SearchPolicyCommand.java | 4 ++-- src/main/java/seedu/address/logic/parser/ParserUtil.java | 9 ++++++--- src/main/java/seedu/address/model/person/Birthday.java | 2 +- src/main/java/seedu/address/ui/PersonListPanel.java | 3 +++ src/main/resources/view/MainWindow.css | 4 ++++ 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/java/seedu/address/logic/Messages.java b/src/main/java/seedu/address/logic/Messages.java index 05df1e1da12..86c18f2890e 100644 --- a/src/main/java/seedu/address/logic/Messages.java +++ b/src/main/java/seedu/address/logic/Messages.java @@ -19,6 +19,7 @@ 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): "; + public static final String MESSAGE_INVALID_POLICY_NAME = "The policy name format is invalid."; public static final String MESSAGE_INVALID_POLICY_FORMAT = "The policy name format is invalid."; public static final String MESSAGE_INVALID_POLICY_DISPLAYED_INDEX = "The policy index provided is invalid"; public static final String MESSAGE_DUPLICATE_POLICY_NAME = "The policy name provided is duplicated"; diff --git a/src/main/java/seedu/address/logic/commands/SearchPolicyCommand.java b/src/main/java/seedu/address/logic/commands/SearchPolicyCommand.java index 5d0be0bf939..a4b808dfe23 100644 --- a/src/main/java/seedu/address/logic/commands/SearchPolicyCommand.java +++ b/src/main/java/seedu/address/logic/commands/SearchPolicyCommand.java @@ -1,7 +1,7 @@ package seedu.address.logic.commands; import static java.util.Objects.requireNonNull; -import static seedu.address.logic.Messages.MESSAGE_INVALID_POLICY_FORMAT; +import static seedu.address.logic.Messages.MESSAGE_INVALID_POLICY_NAME; import static seedu.address.logic.Messages.MESSAGE_SUCCESS_SEARCH_POLICY; import static seedu.address.logic.parser.CliSyntax.PREFIX_SEARCH_POLICY; @@ -33,7 +33,7 @@ public class SearchPolicyCommand extends Command { public SearchPolicyCommand(String policyName) throws CommandException { requireNonNull(policyName); if (!isValidPolicyName(policyName)) { - throw new CommandException(MESSAGE_INVALID_POLICY_FORMAT); + throw new CommandException(MESSAGE_INVALID_POLICY_NAME); } this.policyName = policyName; } diff --git a/src/main/java/seedu/address/logic/parser/ParserUtil.java b/src/main/java/seedu/address/logic/parser/ParserUtil.java index 7e7b48aa71e..e15b5e546fc 100644 --- a/src/main/java/seedu/address/logic/parser/ParserUtil.java +++ b/src/main/java/seedu/address/logic/parser/ParserUtil.java @@ -2,6 +2,7 @@ import static java.util.Objects.requireNonNull; import static seedu.address.logic.Messages.MESSAGE_DUPLICATE_POLICY_INDEX; +import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; import static seedu.address.logic.Messages.MESSAGE_INVALID_POLICY_FORMAT; import static seedu.address.logic.parser.CliSyntax.PREFIX_NEXT_PAYMENT_DATE; import static seedu.address.logic.parser.CliSyntax.PREFIX_PAYMENT_AMOUNT; @@ -18,6 +19,8 @@ import seedu.address.commons.core.index.Index; import seedu.address.commons.util.StringUtil; +import seedu.address.logic.Messages; +import seedu.address.logic.commands.EditCommand; import seedu.address.logic.commands.exceptions.CommandException; import seedu.address.logic.parser.exceptions.ParseException; import seedu.address.model.person.Address; @@ -198,7 +201,7 @@ public static Policy parsePolicy(String policyArgs) throws ParseException { if (!arePrefixesPresent(argMultimap, PREFIX_POLICY_NAME, PREFIX_POLICY_START_DATE, PREFIX_POLICY_END_DATE, PREFIX_NEXT_PAYMENT_DATE, PREFIX_PAYMENT_AMOUNT)) { - throw new ParseException(String.format(MESSAGE_INVALID_POLICY_FORMAT)); + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditCommand.MESSAGE_USAGE)); } argMultimap.verifyNoDuplicatePrefixesFor(PREFIX_POLICY_NAME, PREFIX_POLICY_START_DATE, @@ -241,9 +244,9 @@ public static Map parsePolicies(Collection policies) thro Index index; try { - index = ParserUtil.parseIndex(argMultimap.getPreamble()); + index = parseIndex(argMultimap.getPreamble()); } catch (ParseException pe) { - throw new ParseException(String.format(MESSAGE_INVALID_POLICY_FORMAT), pe); + throw new ParseException(String.format(Messages.MESSAGE_INVALID_POLICY_DISPLAYED_INDEX), pe); } if (toEditIndexSet.contains(index.getZeroBased())) { diff --git a/src/main/java/seedu/address/model/person/Birthday.java b/src/main/java/seedu/address/model/person/Birthday.java index ba80a0a6def..e8c12b18eeb 100644 --- a/src/main/java/seedu/address/model/person/Birthday.java +++ b/src/main/java/seedu/address/model/person/Birthday.java @@ -14,7 +14,7 @@ public class Birthday { public static final String MESSAGE_CONSTRAINTS = "Birthdays should be in the format 'yyyy-MM-dd', " - + "must be a valid date, and must be a date after today's date."; + + "must be a valid date, and must be a date before today's date."; private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd"); diff --git a/src/main/java/seedu/address/ui/PersonListPanel.java b/src/main/java/seedu/address/ui/PersonListPanel.java index f4c501a897b..6e3c41cb719 100644 --- a/src/main/java/seedu/address/ui/PersonListPanel.java +++ b/src/main/java/seedu/address/ui/PersonListPanel.java @@ -2,6 +2,9 @@ import java.util.logging.Logger; +import javafx.application.Platform; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.scene.control.ListCell; diff --git a/src/main/resources/view/MainWindow.css b/src/main/resources/view/MainWindow.css index ad3fb9ab46b..5710fc0fb4c 100644 --- a/src/main/resources/view/MainWindow.css +++ b/src/main/resources/view/MainWindow.css @@ -1,3 +1,7 @@ +/* + * Edited from "DarkTheme.css" + */ + .background { -fx-background-color: white; background-color: #383838; /* Used in the default.html file */ From 11ecfdf34de45d0e1e887c2d105accfeed425b92 Mon Sep 17 00:00:00 2001 From: MingYiAw Date: Mon, 11 Nov 2024 18:19:05 +0800 Subject: [PATCH 2/2] style: Fix Checkstyle --- src/main/java/seedu/address/logic/parser/ParserUtil.java | 1 - src/main/java/seedu/address/ui/PersonListPanel.java | 3 --- 2 files changed, 4 deletions(-) diff --git a/src/main/java/seedu/address/logic/parser/ParserUtil.java b/src/main/java/seedu/address/logic/parser/ParserUtil.java index e15b5e546fc..b5fdddff41c 100644 --- a/src/main/java/seedu/address/logic/parser/ParserUtil.java +++ b/src/main/java/seedu/address/logic/parser/ParserUtil.java @@ -3,7 +3,6 @@ import static java.util.Objects.requireNonNull; import static seedu.address.logic.Messages.MESSAGE_DUPLICATE_POLICY_INDEX; import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; -import static seedu.address.logic.Messages.MESSAGE_INVALID_POLICY_FORMAT; import static seedu.address.logic.parser.CliSyntax.PREFIX_NEXT_PAYMENT_DATE; import static seedu.address.logic.parser.CliSyntax.PREFIX_PAYMENT_AMOUNT; import static seedu.address.logic.parser.CliSyntax.PREFIX_POLICY_END_DATE; diff --git a/src/main/java/seedu/address/ui/PersonListPanel.java b/src/main/java/seedu/address/ui/PersonListPanel.java index 6e3c41cb719..f4c501a897b 100644 --- a/src/main/java/seedu/address/ui/PersonListPanel.java +++ b/src/main/java/seedu/address/ui/PersonListPanel.java @@ -2,9 +2,6 @@ import java.util.logging.Logger; -import javafx.application.Platform; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.scene.control.ListCell;