From 0a5ed3d3dd9edb0dcd6b4ab6c19190d2e28d8c16 Mon Sep 17 00:00:00 2001 From: yisiox Date: Mon, 15 Apr 2024 18:32:09 +0800 Subject: [PATCH 01/10] Add null checks and move Asset and Tag --- src/main/java/seedu/address/logic/commands/AddCommand.java | 1 + src/main/java/seedu/address/logic/commands/AssetCommand.java | 2 +- src/main/java/seedu/address/logic/commands/EditCommand.java | 3 ++- src/main/java/seedu/address/logic/commands/RedoCommand.java | 3 +++ src/main/java/seedu/address/logic/commands/UndoCommand.java | 3 +++ src/main/java/seedu/address/logic/util/AddressBookParser.java | 4 ++-- src/main/java/seedu/address/model/AddressBook.java | 2 +- src/main/java/seedu/address/model/Model.java | 2 +- src/main/java/seedu/address/model/ModelManager.java | 2 +- src/main/java/seedu/address/model/person/Person.java | 2 +- .../seedu/address/model/{asset => person/fields}/Asset.java | 2 +- src/main/java/seedu/address/model/person/fields/Assets.java | 2 -- .../java/seedu/address/model/{tag => person/fields}/Tag.java | 2 +- src/main/java/seedu/address/model/person/fields/Tags.java | 2 -- src/main/java/seedu/address/ui/PersonCard.java | 4 ++-- .../java/seedu/address/logic/commands/AddCommandTest.java | 2 +- .../java/seedu/address/logic/commands/AssetCommandTest.java | 4 ++-- .../address/model/{asset => person/fields}/AssetTest.java | 2 +- .../java/seedu/address/model/person/fields/AssetsTest.java | 2 -- .../seedu/address/model/{tag => person/fields}/TagTest.java | 2 +- src/test/java/seedu/address/model/person/fields/TagsTest.java | 2 -- src/test/java/seedu/address/testutil/AssetBuilder.java | 2 +- 22 files changed, 26 insertions(+), 26 deletions(-) rename src/main/java/seedu/address/model/{asset => person/fields}/Asset.java (97%) rename src/main/java/seedu/address/model/{tag => person/fields}/Tag.java (97%) rename src/test/java/seedu/address/model/{asset => person/fields}/AssetTest.java (97%) rename src/test/java/seedu/address/model/{tag => person/fields}/TagTest.java (97%) diff --git a/src/main/java/seedu/address/logic/commands/AddCommand.java b/src/main/java/seedu/address/logic/commands/AddCommand.java index f42c65314b..700c1eae23 100644 --- a/src/main/java/seedu/address/logic/commands/AddCommand.java +++ b/src/main/java/seedu/address/logic/commands/AddCommand.java @@ -81,6 +81,7 @@ public String execute(Model model) throws CommandException { * @throws IllegalArgumentException if the user input does not conform the expected format */ public static AddCommand of(String args) throws IllegalArgumentException { + requireNonNull(args); ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, PREFIX_TAG, PREFIX_ASSET); diff --git a/src/main/java/seedu/address/logic/commands/AssetCommand.java b/src/main/java/seedu/address/logic/commands/AssetCommand.java index 93b93bbd9c..7f69ce22fa 100644 --- a/src/main/java/seedu/address/logic/commands/AssetCommand.java +++ b/src/main/java/seedu/address/logic/commands/AssetCommand.java @@ -11,7 +11,7 @@ import seedu.address.logic.util.ArgumentMultimap; import seedu.address.logic.util.ArgumentTokenizer; import seedu.address.model.Model; -import seedu.address.model.asset.Asset; +import seedu.address.model.person.fields.Asset; import seedu.address.model.person.fields.Prefix; /** diff --git a/src/main/java/seedu/address/logic/commands/EditCommand.java b/src/main/java/seedu/address/logic/commands/EditCommand.java index fc007324e6..5266464173 100644 --- a/src/main/java/seedu/address/logic/commands/EditCommand.java +++ b/src/main/java/seedu/address/logic/commands/EditCommand.java @@ -1,6 +1,7 @@ package seedu.address.logic.commands; import static java.util.Objects.requireNonNull; +import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS; import static seedu.address.model.person.fields.Address.PREFIX_ADDRESS; @@ -99,7 +100,7 @@ public String execute(Model model) throws CommandException { * edited with {@code editPersonDescriptor}. */ private static Person createEditedPerson(Person personToEdit, EditPersonDescriptor editPersonDescriptor) { - assert personToEdit != null; + requireAllNonNull(personToEdit, editPersonDescriptor); Name updatedName = editPersonDescriptor.getName().orElse(personToEdit.getName()); Phone updatedPhone = editPersonDescriptor.getPhone().orElse(personToEdit.getPhone()); diff --git a/src/main/java/seedu/address/logic/commands/RedoCommand.java b/src/main/java/seedu/address/logic/commands/RedoCommand.java index e7b2b9a1a6..65cb75e834 100644 --- a/src/main/java/seedu/address/logic/commands/RedoCommand.java +++ b/src/main/java/seedu/address/logic/commands/RedoCommand.java @@ -1,5 +1,7 @@ package seedu.address.logic.commands; +import static java.util.Objects.requireNonNull; + import seedu.address.logic.commands.exceptions.CommandException; import seedu.address.model.Model; @@ -19,6 +21,7 @@ public class RedoCommand extends Command { @Override public String execute(Model model) throws CommandException { + requireNonNull(model); if (!model.canRedo()) { throw new CommandException(MESSAGE_REDO_EXCEPTION); } diff --git a/src/main/java/seedu/address/logic/commands/UndoCommand.java b/src/main/java/seedu/address/logic/commands/UndoCommand.java index 401b201910..c1c54d53bd 100644 --- a/src/main/java/seedu/address/logic/commands/UndoCommand.java +++ b/src/main/java/seedu/address/logic/commands/UndoCommand.java @@ -1,5 +1,7 @@ package seedu.address.logic.commands; +import static java.util.Objects.requireNonNull; + import seedu.address.logic.commands.exceptions.CommandException; import seedu.address.model.Model; @@ -18,6 +20,7 @@ public class UndoCommand extends Command { @Override public String execute(Model model) throws CommandException { + requireNonNull(model); if (!model.canUndo()) { throw new CommandException(MESSAGE_UNDO_EXCEPTION); } diff --git a/src/main/java/seedu/address/logic/util/AddressBookParser.java b/src/main/java/seedu/address/logic/util/AddressBookParser.java index 42664a7efb..78994ede08 100644 --- a/src/main/java/seedu/address/logic/util/AddressBookParser.java +++ b/src/main/java/seedu/address/logic/util/AddressBookParser.java @@ -49,7 +49,7 @@ public static Command parseCommand(String userInput) throws ParseException { try { commandType = CommandType.valueOf(commandWord.toUpperCase()); } catch (IllegalArgumentException ie) { - logger.finer("This user input caused a ParseException: " + userInput); + logger.finer("This user command caused a ParseException: " + userInput); throw new ParseException(MESSAGE_UNKNOWN_COMMAND); } @@ -57,7 +57,7 @@ public static Command parseCommand(String userInput) throws ParseException { try { command = commandType.createCommand(arguments); } catch (IllegalArgumentException ie) { - logger.finer("This user input caused a ParseException: " + userInput); + logger.finer("These user command arguments caused a ParseException: " + userInput); throw new ParseException(ie.getMessage()); } diff --git a/src/main/java/seedu/address/model/AddressBook.java b/src/main/java/seedu/address/model/AddressBook.java index aa29b37fd8..8790b22bd9 100644 --- a/src/main/java/seedu/address/model/AddressBook.java +++ b/src/main/java/seedu/address/model/AddressBook.java @@ -9,10 +9,10 @@ import javafx.collections.ObservableList; import seedu.address.commons.util.ToStringBuilder; -import seedu.address.model.asset.Asset; import seedu.address.model.exceptions.AddressBookException; import seedu.address.model.person.Person; import seedu.address.model.person.UniquePersonList; +import seedu.address.model.person.fields.Asset; /** * Wraps all data at the address-book level. diff --git a/src/main/java/seedu/address/model/Model.java b/src/main/java/seedu/address/model/Model.java index 5fd8be05fb..970a20561f 100644 --- a/src/main/java/seedu/address/model/Model.java +++ b/src/main/java/seedu/address/model/Model.java @@ -5,9 +5,9 @@ import javafx.collections.ObservableList; import seedu.address.commons.core.GuiSettings; -import seedu.address.model.asset.Asset; import seedu.address.model.exceptions.AddressBookException; import seedu.address.model.person.Person; +import seedu.address.model.person.fields.Asset; /** * The API of the Model component. diff --git a/src/main/java/seedu/address/model/ModelManager.java b/src/main/java/seedu/address/model/ModelManager.java index b1eeff731c..601f553312 100644 --- a/src/main/java/seedu/address/model/ModelManager.java +++ b/src/main/java/seedu/address/model/ModelManager.java @@ -11,8 +11,8 @@ import javafx.collections.transformation.FilteredList; import seedu.address.commons.core.GuiSettings; import seedu.address.commons.core.LogsCenter; -import seedu.address.model.asset.Asset; import seedu.address.model.person.Person; +import seedu.address.model.person.fields.Asset; /** * Represents the in-memory model of the address book data. diff --git a/src/main/java/seedu/address/model/person/Person.java b/src/main/java/seedu/address/model/person/Person.java index 3e8810ab03..79fd536431 100644 --- a/src/main/java/seedu/address/model/person/Person.java +++ b/src/main/java/seedu/address/model/person/Person.java @@ -8,8 +8,8 @@ import com.fasterxml.jackson.annotation.JsonProperty; import seedu.address.commons.util.ToStringBuilder; -import seedu.address.model.asset.Asset; import seedu.address.model.person.fields.Address; +import seedu.address.model.person.fields.Asset; import seedu.address.model.person.fields.Assets; import seedu.address.model.person.fields.Email; import seedu.address.model.person.fields.Name; diff --git a/src/main/java/seedu/address/model/asset/Asset.java b/src/main/java/seedu/address/model/person/fields/Asset.java similarity index 97% rename from src/main/java/seedu/address/model/asset/Asset.java rename to src/main/java/seedu/address/model/person/fields/Asset.java index 5bf6661e6c..26789d90b6 100644 --- a/src/main/java/seedu/address/model/asset/Asset.java +++ b/src/main/java/seedu/address/model/person/fields/Asset.java @@ -1,4 +1,4 @@ -package seedu.address.model.asset; +package seedu.address.model.person.fields; import static java.util.Objects.requireNonNull; import static seedu.address.commons.util.AppUtil.checkArgument; diff --git a/src/main/java/seedu/address/model/person/fields/Assets.java b/src/main/java/seedu/address/model/person/fields/Assets.java index fca29ae46b..a75229c735 100644 --- a/src/main/java/seedu/address/model/person/fields/Assets.java +++ b/src/main/java/seedu/address/model/person/fields/Assets.java @@ -10,8 +10,6 @@ import com.fasterxml.jackson.annotation.JsonValue; -import seedu.address.model.asset.Asset; - /** * Represents a collection of assets associated to a person in the address book. */ diff --git a/src/main/java/seedu/address/model/tag/Tag.java b/src/main/java/seedu/address/model/person/fields/Tag.java similarity index 97% rename from src/main/java/seedu/address/model/tag/Tag.java rename to src/main/java/seedu/address/model/person/fields/Tag.java index 60c1d5f832..f557aaa4fe 100644 --- a/src/main/java/seedu/address/model/tag/Tag.java +++ b/src/main/java/seedu/address/model/person/fields/Tag.java @@ -1,4 +1,4 @@ -package seedu.address.model.tag; +package seedu.address.model.person.fields; import static java.util.Objects.requireNonNull; import static seedu.address.commons.util.AppUtil.checkArgument; diff --git a/src/main/java/seedu/address/model/person/fields/Tags.java b/src/main/java/seedu/address/model/person/fields/Tags.java index 005e457b2e..657f7bde82 100644 --- a/src/main/java/seedu/address/model/person/fields/Tags.java +++ b/src/main/java/seedu/address/model/person/fields/Tags.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.annotation.JsonValue; -import seedu.address.model.tag.Tag; - //@@author aureliony /** * Represents an abstraction for a list of tags. diff --git a/src/main/java/seedu/address/ui/PersonCard.java b/src/main/java/seedu/address/ui/PersonCard.java index 624301ab83..bb0aadb5da 100644 --- a/src/main/java/seedu/address/ui/PersonCard.java +++ b/src/main/java/seedu/address/ui/PersonCard.java @@ -7,9 +7,9 @@ import javafx.scene.layout.FlowPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Region; -import seedu.address.model.asset.Asset; import seedu.address.model.person.Person; -import seedu.address.model.tag.Tag; +import seedu.address.model.person.fields.Asset; +import seedu.address.model.person.fields.Tag; /** * An UI component that displays information of a {@code Person}. diff --git a/src/test/java/seedu/address/logic/commands/AddCommandTest.java b/src/test/java/seedu/address/logic/commands/AddCommandTest.java index 0ce120f823..a75c080826 100644 --- a/src/test/java/seedu/address/logic/commands/AddCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/AddCommandTest.java @@ -59,8 +59,8 @@ import seedu.address.model.Model; import seedu.address.model.ReadOnlyAddressBook; import seedu.address.model.ReadOnlyUserPrefs; -import seedu.address.model.asset.Asset; import seedu.address.model.person.Person; +import seedu.address.model.person.fields.Asset; import seedu.address.testutil.PersonBuilder; public class AddCommandTest { diff --git a/src/test/java/seedu/address/logic/commands/AssetCommandTest.java b/src/test/java/seedu/address/logic/commands/AssetCommandTest.java index 0bdc443351..d3886b6eab 100644 --- a/src/test/java/seedu/address/logic/commands/AssetCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/AssetCommandTest.java @@ -10,7 +10,7 @@ import static seedu.address.logic.commands.AssetCommand.MESSAGE_NOT_EDITED; import static seedu.address.logic.commands.AssetCommand.MESSAGE_SUCCESS; import static seedu.address.logic.commands.CommandTestUtil.assertParseFailure; -import static seedu.address.model.asset.Asset.MESSAGE_CONSTRAINTS; +import static seedu.address.model.person.fields.Asset.MESSAGE_CONSTRAINTS; import static seedu.address.testutil.Assert.assertThrows; import static seedu.address.testutil.TypicalPersons.getTypicalAddressBook; @@ -20,8 +20,8 @@ import seedu.address.model.Model; import seedu.address.model.ModelManager; import seedu.address.model.UserPrefs; -import seedu.address.model.asset.Asset; import seedu.address.model.person.Person; +import seedu.address.model.person.fields.Asset; import seedu.address.testutil.AssetBuilder; import seedu.address.testutil.PersonBuilder; diff --git a/src/test/java/seedu/address/model/asset/AssetTest.java b/src/test/java/seedu/address/model/person/fields/AssetTest.java similarity index 97% rename from src/test/java/seedu/address/model/asset/AssetTest.java rename to src/test/java/seedu/address/model/person/fields/AssetTest.java index b0064e156f..05680fce36 100644 --- a/src/test/java/seedu/address/model/asset/AssetTest.java +++ b/src/test/java/seedu/address/model/person/fields/AssetTest.java @@ -1,4 +1,4 @@ -package seedu.address.model.asset; +package seedu.address.model.person.fields; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/src/test/java/seedu/address/model/person/fields/AssetsTest.java b/src/test/java/seedu/address/model/person/fields/AssetsTest.java index 34b0eb1767..5aa25eb97b 100644 --- a/src/test/java/seedu/address/model/person/fields/AssetsTest.java +++ b/src/test/java/seedu/address/model/person/fields/AssetsTest.java @@ -10,8 +10,6 @@ import org.junit.jupiter.api.Test; -import seedu.address.model.asset.Asset; - class AssetsTest { private static final String INVALID_ASSET = " "; diff --git a/src/test/java/seedu/address/model/tag/TagTest.java b/src/test/java/seedu/address/model/person/fields/TagTest.java similarity index 97% rename from src/test/java/seedu/address/model/tag/TagTest.java rename to src/test/java/seedu/address/model/person/fields/TagTest.java index 07656b0fc9..8fed3afbac 100644 --- a/src/test/java/seedu/address/model/tag/TagTest.java +++ b/src/test/java/seedu/address/model/person/fields/TagTest.java @@ -1,4 +1,4 @@ -package seedu.address.model.tag; +package seedu.address.model.person.fields; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/src/test/java/seedu/address/model/person/fields/TagsTest.java b/src/test/java/seedu/address/model/person/fields/TagsTest.java index f5625e0af3..d663825a9c 100644 --- a/src/test/java/seedu/address/model/person/fields/TagsTest.java +++ b/src/test/java/seedu/address/model/person/fields/TagsTest.java @@ -10,8 +10,6 @@ import org.junit.jupiter.api.Test; -import seedu.address.model.tag.Tag; - class TagsTest { private static final String INVALID_TAG = "#friend"; diff --git a/src/test/java/seedu/address/testutil/AssetBuilder.java b/src/test/java/seedu/address/testutil/AssetBuilder.java index db0358b883..3fff8d4af7 100644 --- a/src/test/java/seedu/address/testutil/AssetBuilder.java +++ b/src/test/java/seedu/address/testutil/AssetBuilder.java @@ -1,6 +1,6 @@ package seedu.address.testutil; -import seedu.address.model.asset.Asset; +import seedu.address.model.person.fields.Asset; /** * A utility class to help with building Person objects. From 87c542b102d67a8989ec5cebe8790fd9399f704e Mon Sep 17 00:00:00 2001 From: yisiox Date: Mon, 15 Apr 2024 20:25:03 +0800 Subject: [PATCH 02/10] AddressBookParser.java: Revert change to logging --- src/main/java/seedu/address/logic/util/AddressBookParser.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/seedu/address/logic/util/AddressBookParser.java b/src/main/java/seedu/address/logic/util/AddressBookParser.java index 78994ede08..42664a7efb 100644 --- a/src/main/java/seedu/address/logic/util/AddressBookParser.java +++ b/src/main/java/seedu/address/logic/util/AddressBookParser.java @@ -49,7 +49,7 @@ public static Command parseCommand(String userInput) throws ParseException { try { commandType = CommandType.valueOf(commandWord.toUpperCase()); } catch (IllegalArgumentException ie) { - logger.finer("This user command caused a ParseException: " + userInput); + logger.finer("This user input caused a ParseException: " + userInput); throw new ParseException(MESSAGE_UNKNOWN_COMMAND); } @@ -57,7 +57,7 @@ public static Command parseCommand(String userInput) throws ParseException { try { command = commandType.createCommand(arguments); } catch (IllegalArgumentException ie) { - logger.finer("These user command arguments caused a ParseException: " + userInput); + logger.finer("This user input caused a ParseException: " + userInput); throw new ParseException(ie.getMessage()); } From fe2ebeb041796238a0d1d4ed10ab790758fc53ca Mon Sep 17 00:00:00 2001 From: aureliony <39163684+aureliony@users.noreply.github.com> Date: Mon, 15 Apr 2024 21:15:45 +0800 Subject: [PATCH 03/10] Fix box type formatting --- docs/UserGuide.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index ca493f68a3..8866f35b7b 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -45,7 +45,9 @@ referenced section immediately. A [glossary](#glossary) is provided in case you encounter any unfamiliar terms. + Look out for texts with icons similar to this, which would contain additional information, tips, or warnings. + #### New Users @@ -55,7 +57,9 @@ application and get started. After which, you may take a look at the [features](#features) of *AssetBook*, or simply follow this guide in order. + Don't worry if you don't have much technical know-how! We will guide you through step-by-step. + #### Experienced Users @@ -108,7 +112,9 @@ or skip to the [command summary](#command-summary). ### Setting Up + The following instructions are for **Windows**, **MacOS** and **Linux**. + 1. Ensure you have [Java 11](https://www.oracle.com/java/technologies/downloads/#java11) installed on your device. @@ -135,7 +141,9 @@ The following instructions are for **Windows**, **MacOS** and **Linux**.

+ Having trouble? You may find the FAQ useful. +
@@ -156,7 +164,9 @@ Here are the components of the GUI. 6. **Assets** + You can resize the command output box by dragging its top edge. + --- @@ -245,7 +255,9 @@ Let's update John's email address.

+ The index each contact has changes when you use the find command. + --- @@ -319,7 +331,9 @@ A valid input by the user corresponding to the above will be `add n\John Doe e\johndoe@example.com a\574 Ang Mo Kio Ave 10 p\12345678 A\L293D` + Command words are not case-sensitive, i.e. `add`, `Add`, `ADD`, etc. are all valid. + @@ -353,11 +367,15 @@ After successful execution of a command, some feedback will appear in the [comma If you enter something that the application did not expect or does not understand, an *error* message will show up instead. + **If you are using a PDF version of this document**, be careful when you copy and paste commands that span multiple lines, as space characters may be missing when copied over to the application. + + Note that the backslash `\` is reserved for prefixes. It is **not** allowed to be part of any field. + --- @@ -375,7 +393,9 @@ Adds a new contact. Format: `add n\NAME p\PHONE e\EMAIL a\ADDRESS [t\TAG]... [A\ASSET]...` + A contact can have any number of tags and assets (including 0). + #### Example @@ -446,7 +466,9 @@ If the command was not executed successfully, the proper format of the `add` com * Multiple assets can be specified at once. For example, a valid option is `A\asset1 A\asset2 A\asset3`. + You may assign the same asset to multiple contacts, so remember to name different assets with unique names. + --- @@ -483,7 +505,9 @@ Format: `edit INDEX [n\NAME] [p\PHONE] [e\EMAIL] [a\ADDRESS] [t\TAG]... [A\ASSET * You can remove all assets associated to the contact by typing `A\` without specifying any assets after it. + Edit **replaces** the current tags and assets of a contact. It does **not** add on to existing tags and assets. + --- @@ -511,7 +535,9 @@ Deletes all contacts. Format: `clear` + If you unintentionally deleted all your contacts, you can use the `undo` command to bring them back. + --- @@ -582,7 +608,9 @@ Format: `redo` If an asset name was changed, after `undo` was executed to verify what the previous asset name was, `redo` can be used to revert to the new asset name. + After executing an `undo` command, you cannot `redo` this if another modifying command was executed. + --- @@ -598,7 +626,9 @@ Press the `↑` arrow key to show older commands. Press the `↓` arrow key to show newer commands. + Only successfully executed commands will be shown. + --- From a9a4983ae2e5c436bbfd5ed6f360edfe2c624f0d Mon Sep 17 00:00:00 2001 From: aureliony <39163684+aureliony@users.noreply.github.com> Date: Mon, 15 Apr 2024 21:19:59 +0800 Subject: [PATCH 04/10] Remove asset from glossary --- docs/UserGuide.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 8866f35b7b..174d83bc99 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -774,9 +774,6 @@ Command | Format #### Alphanumeric Consists of only letters and numbers. -#### Asset -An item or amenity of logistical significance. - #### Character A single letter, number, or symbol. Examples: `a`, `1`, `&`, `-`. From 885e8b3a546a41524ca0a3aa338a6daa479bbd9a Mon Sep 17 00:00:00 2001 From: aureliony <39163684+aureliony@users.noreply.github.com> Date: Mon, 15 Apr 2024 21:24:18 +0800 Subject: [PATCH 05/10] Remove scrolling issue --- docs/UserGuide.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 174d83bc99..fc2ede2bb7 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -736,10 +736,6 @@ At present, names allow any special character except `\`. This is to allow the u that may include symbols such as `/`, `'` and `-`. As such, the application may accept all manner of gibberish for names. A remedy is planned for the future to perform more robust checks on names. -#### Scrolling -An astute user may notice that the ability to scroll with the keyboard is missing from the application. This feature -will be implemented as soon as possible in an upcoming release. - #### More Asset Details Some users may require assets to have more details recorded. We plan to add features that allow adding of more fields to assets such as serial number, location, etc. From 9e2e1742843c841e1991e302137cfab2a280c379 Mon Sep 17 00:00:00 2001 From: yisiox Date: Mon, 15 Apr 2024 22:32:06 +0800 Subject: [PATCH 06/10] Add logging to modifying commands --- .../java/seedu/address/logic/commands/AddCommand.java | 5 +++++ .../seedu/address/logic/commands/AssetCommand.java | 6 ++++++ .../java/seedu/address/logic/commands/CopyCommand.java | 10 ++++++++++ .../java/seedu/address/logic/commands/EditCommand.java | 5 +++++ 4 files changed, 26 insertions(+) diff --git a/src/main/java/seedu/address/logic/commands/AddCommand.java b/src/main/java/seedu/address/logic/commands/AddCommand.java index 700c1eae23..c2d59df0b0 100644 --- a/src/main/java/seedu/address/logic/commands/AddCommand.java +++ b/src/main/java/seedu/address/logic/commands/AddCommand.java @@ -9,8 +9,10 @@ import static seedu.address.model.person.fields.Phone.PREFIX_PHONE; import static seedu.address.model.person.fields.Tags.PREFIX_TAG; +import java.util.logging.Logger; import java.util.stream.Stream; +import seedu.address.commons.core.LogsCenter; import seedu.address.commons.util.ToStringBuilder; import seedu.address.logic.Messages; import seedu.address.logic.commands.exceptions.CommandException; @@ -53,6 +55,8 @@ public class AddCommand extends Command { public static final String MESSAGE_SUCCESS = "New contact added: %1$s"; public static final String MESSAGE_DUPLICATE_CONTACT = "This contact already exists."; + private static final Logger logger = LogsCenter.getLogger(AddCommand.class); + private final Person toAdd; /** @@ -68,6 +72,7 @@ public String execute(Model model) throws CommandException { requireNonNull(model); if (model.hasPerson(toAdd)) { + logger.finer("Recognized as duplicate person: " + toAdd.toString()); throw new CommandException(MESSAGE_DUPLICATE_CONTACT); } diff --git a/src/main/java/seedu/address/logic/commands/AssetCommand.java b/src/main/java/seedu/address/logic/commands/AssetCommand.java index 7f69ce22fa..ce4c1b7e5f 100644 --- a/src/main/java/seedu/address/logic/commands/AssetCommand.java +++ b/src/main/java/seedu/address/logic/commands/AssetCommand.java @@ -4,8 +4,10 @@ import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; +import java.util.logging.Logger; import java.util.stream.Stream; +import seedu.address.commons.core.LogsCenter; import seedu.address.commons.util.ToStringBuilder; import seedu.address.logic.commands.exceptions.CommandException; import seedu.address.logic.util.ArgumentMultimap; @@ -33,6 +35,8 @@ public class AssetCommand extends Command { public static final String MESSAGE_NOT_EDITED = "At least one field to edit must be provided."; public static final String MESSAGE_INVALID_ASSET_NAME = "The asset name provided is invalid"; + private static final Logger logger = LogsCenter.getLogger(AssetCommand.class); + private final Asset target; private final Asset editedAsset; @@ -52,9 +56,11 @@ public String execute(Model model) throws CommandException { requireNonNull(model); if (target.equals(editedAsset)) { + logger.finer("Asset recognized as unedited: " + editedAsset); throw new CommandException(MESSAGE_NOT_EDITED); } if (!model.hasAsset(target)) { + logger.finer("Asset recognized as non-existing: " + editedAsset); throw new CommandException(MESSAGE_INVALID_ASSET_NAME); } diff --git a/src/main/java/seedu/address/logic/commands/CopyCommand.java b/src/main/java/seedu/address/logic/commands/CopyCommand.java index 351c55432f..31a8219605 100644 --- a/src/main/java/seedu/address/logic/commands/CopyCommand.java +++ b/src/main/java/seedu/address/logic/commands/CopyCommand.java @@ -10,7 +10,9 @@ import static seedu.address.model.person.fields.Tags.PREFIX_TAG; import java.util.List; +import java.util.logging.Logger; +import seedu.address.commons.core.LogsCenter; import seedu.address.commons.core.index.Index; import seedu.address.commons.util.ToStringBuilder; import seedu.address.logic.Messages; @@ -42,6 +44,8 @@ public class CopyCommand extends Command { public static final String MESSAGE_NO_PARAM = "One field to copy must be provided."; public static final String MESSAGE_EXTRA_PARAM = "Only one field can be copied."; + private static final Logger logger = LogsCenter.getLogger(CopyCommand.class); + private final Index index; private final boolean[] info; @@ -78,21 +82,27 @@ private static String copyToClipboard(Person personToCopy, boolean[] info) { requireNonNull(personToCopy); if (info[0]) { + logger.finest("Copied name to clipboard"); return personToCopy.getName().toString(); } if (info[1]) { + logger.finest("Copied phone to clipboard"); return personToCopy.getPhone().toString(); } if (info[2]) { + logger.finest("Copied email to clipboard"); return personToCopy.getEmail().toString(); } if (info[3]) { + logger.finest("Copied address to clipboard"); return personToCopy.getAddress().toString(); } if (info[4]) { + logger.finest("Copied tags to clipboard"); return personToCopy.getTags().toString(); } if (info[5]) { + logger.finest("Copied assets to clipboard"); return personToCopy.getAssets().toString(); } diff --git a/src/main/java/seedu/address/logic/commands/EditCommand.java b/src/main/java/seedu/address/logic/commands/EditCommand.java index 5266464173..6b1e977d39 100644 --- a/src/main/java/seedu/address/logic/commands/EditCommand.java +++ b/src/main/java/seedu/address/logic/commands/EditCommand.java @@ -16,7 +16,9 @@ import java.util.List; import java.util.Objects; import java.util.Optional; +import java.util.logging.Logger; +import seedu.address.commons.core.LogsCenter; import seedu.address.commons.core.index.Index; import seedu.address.commons.util.CollectionUtil; import seedu.address.commons.util.ToStringBuilder; @@ -59,6 +61,8 @@ public class EditCommand extends Command { public static final String MESSAGE_NOT_EDITED = "At least one field to edit must be provided."; public static final String MESSAGE_DUPLICATE_CONTACT = "This contact already exists."; + private static final Logger logger = LogsCenter.getLogger(EditCommand.class); + private final Index index; private final EditPersonDescriptor editPersonDescriptor; @@ -87,6 +91,7 @@ public String execute(Model model) throws CommandException { Person editedPerson = createEditedPerson(personToEdit, editPersonDescriptor); if (!personToEdit.isSamePerson(editedPerson) && model.hasPerson(editedPerson)) { + logger.finer("Recognized as duplicate person: " + editedPerson); throw new CommandException(MESSAGE_DUPLICATE_CONTACT); } From f02f8e1971b92a2610a605122e5d890b54946d71 Mon Sep 17 00:00:00 2001 From: aureliony <39163684+aureliony@users.noreply.github.com> Date: Mon, 15 Apr 2024 22:48:23 +0800 Subject: [PATCH 07/10] Fix UG export to PDF formatting --- docs/UserGuide.md | 62 ++++++++++++++++++++------------------- docs/stylesheets/main.css | 22 ++++---------- 2 files changed, 38 insertions(+), 46 deletions(-) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index fc2ede2bb7..757df9f496 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -64,7 +64,7 @@ Don't worry if you don't have much technical know-how! We will guide you through #### Experienced Users -If you are not a new user and are just looking to refresh your memory, you can utilise the [table of contents](#table-of-contents) +If you are not a new user and are just looking to refresh your memory, you can utilize the [table of contents](#table-of-contents) or skip to the [command summary](#command-summary). --- @@ -122,7 +122,7 @@ The following instructions are for **Windows**, **MacOS** and **Linux**. 2. Download the latest `assetbook.jar` from [here](https://github.com/AY2324S2-CS2103T-W12-3/tp/releases).

- +

3. Move `assetbook.jar` into the folder where you want *AssetBook* to store the contact information. New users may simply @@ -133,6 +133,8 @@ The following instructions are for **Windows**, **MacOS** and **Linux**.

+
+ 4. To launch the application, double-click on `assetbook.jar` and a GUI similar to the one below should appear. Note that the application contains some sample data when launched for the first time. @@ -153,7 +155,7 @@ Having trouble? You may find the - +

1. **Command Input Box** @@ -189,7 +191,7 @@ Let's get started by adding our first contact, John Doe, into *AssetBook*. 1. **Click on the Command Input Box**: Begin by locating and clicking on the [command input box](#navigating-the-gui) near the bottom of the application.

- +

@@ -198,7 +200,7 @@ Let's get started by adding our first contact, John Doe, into *AssetBook*. Let's add your first contact, John, by copying the following command into the command input box:
`add n\John Doe p\98765432 e\johnd@example.com a\311, Clementi Ave 2, #02-25 t\friends t\owesMoney A\screwdriver`

- +

3. **Execute the Command**: @@ -209,7 +211,7 @@ Let's get started by adding our first contact, John Doe, into *AssetBook*. 4. **Confirmation**: Check for a confirmation message to verify that John Doe has been added successfully.

- +

--- @@ -225,16 +227,18 @@ Now that you've successfully added John Doe to *AssetBook*, let's try to find hi Let's now find the contact, John, we just added by entering the following command:
`find John`

- +

3. **Execute the Command**: After typing the command, simply press `Enter` to find the contact in *AssetBook*. +
+ 4. **View the Results**: John Doe will be displayed in the contacts list, along with the total number of contacts matching 'John' found.

- +

--- @@ -251,7 +255,7 @@ Let's update John's email address. We can find out what John's index is by checking the number currently beside his name. The `find` command makes it easier by reducing the number of contacts displayed. Here, he has index 1.

- +

@@ -269,7 +273,7 @@ We can edit John's email by typing the following command:
`edit 1 e\newemail@example.com`

- +

4. **Execute the Command**: @@ -280,7 +284,7 @@ We can edit John's email by typing the following command:
5. **Confirmation**: Look for a confirmation message, indicating that John's email has been successfully updated.

- +

--- @@ -298,16 +302,18 @@ Let's update our existing assets. `asset o\screwdriver n\screw`

- +

3. **Execute the Command**: After entering the command, press `Enter`. This will update the asset details in *AssetBook*. +
+ 4. **Confirmation**: Check for a confirmation message to ensure that the asset has been successfully updated.

- +

--- @@ -403,7 +409,7 @@ A contact can have any number of tags and assets (including 0). `add n\John Doe e\johndoe@example.com a\574 Ang Mo Kio Ave 10 p\12345678 A\L293D`

- +

@@ -414,7 +420,7 @@ If the command was executed successfully, the following message will appear:
`New contact added: John Doe; Phone: 12345678; Email: johndoe@example.com; Address: 574 Ang Mo Kio Ave 10; Tags: []; Assets: [[L293D]]`

- +

@@ -424,7 +430,7 @@ If the command was executed successfully, the following message will appear:
If the command was not executed successfully, the proper format of the `add` command will be shown to you instead.

- +

@@ -473,8 +479,6 @@ You may assign the same asset to multiple contacts, so remember to name differen --- -
- ### Deleting a Contact: `delete` Delete a contact by specifying its index. @@ -548,16 +552,6 @@ If you unintentionally deleted all your contacts, you can use the `undo` command This section contains the details for **non-modifying commands** and other useful shortcuts. -### Listing all Contacts: `list` - -Displays all contacts. - -Format: `list` - -* Useful when you have filtered the contacts list with `find`. - ---- - ### Finding Contacts: `find` Finds contacts by name, tag or asset. @@ -570,7 +564,7 @@ Find contacts whose name, tags, or assets contain `jo`:
`find jo`

- +

3 matches were found, each with `jo` found in a different field and at different positions. @@ -582,7 +576,15 @@ Find contacts whose name, tags, or assets contain `jo`:
--- -
+### Listing all Contacts: `list` + +Displays all contacts. + +Format: `list` + +* Useful when you have filtered the contacts list with `find`. + +--- ### Undoing Commands: `undo` diff --git a/docs/stylesheets/main.css b/docs/stylesheets/main.css index dbc9035e91..b57edcfaec 100644 --- a/docs/stylesheets/main.css +++ b/docs/stylesheets/main.css @@ -156,27 +156,17 @@ mark { .btn { font-size: 0.65rem !important; } + img { + zoom: 0.8; /* might not work on some browsers */ + } } -h1, +h2, +h3, h4, h5, h6 { - color: darkslategray; -} - -h2 { - font-weight: bold; - background-color: darkslategray; - color: #FFFFFF; - padding: 8px 8px 12px 8px; -} - -h3 { - font-weight: bold; - background-color: darkolivegreen; - color: #FFFFFF; - padding: 8px 8px 12px 8px; + color: #e46c0a; }