Skip to content
This repository has been archived by the owner on Sep 29, 2022. It is now read-only.

Commit

Permalink
Update note filter in DG and show all notes after note delete (AY1920…
Browse files Browse the repository at this point in the history
…S1-CS2103T-F12-3#234)

* Add changes from team repo (#5)

* Refactor package name from 'seedu.address' to 'tagline'

* Update mainClassName in build.gradle

* Merge pull request #6 from from AY1920S1-CS2103T-F12-3/master

* Refactor package name from 'seedu.address' to 'tagline'

* Update mainClassName in build.gradle

* Added Contact Command + Basic Commands to UserGuide.adoc

* Update mentions of AddressBook to TagLine

* Update AboutUs.adoc

* Add more use cases to Developer Guide

* Update team name

* Add newline after EOF for README and AboutUs

* Fix Yehez image name

* Merge PR #10 from AY1920S1-CS2103T-F12-3/main

* Update Prof name in AboutUs (#35)

#21

* Rename Yehezkiel image (#36)

* Fix typos in Developer Guide and User Guide (#37)

* Updates from upstream (#14)

* Add chat pane to GUI (#9)

* Refactor result pane view (AY1920S1-CS2103T-F12-3#42)

* Implement view switching in GUI (AY1920S1-CS2103T-F12-3#46)

* Refactor Contact Command Parsers (AY1920S1-CS2103T-F12-3#43)

* Update contact parser (AY1920S1-CS2103T-F12-3#62)

* Rename person to contact (AY1920S1-CS2103T-F12-3#65)

* Fix merge conflicts from upstream

* Fix merge conflicts

* Add missing files to master from upstream

* Remove dummy view

* Merge updates from  AY1920S1-CS2103T-F12-3/main (#18)

Add DeleteNoteCommandTest

* Updates from upstream (#19)

* Refactor TagList to UniqueTagList and TagBook to follow structure

Full changelist:
- Refactor TagList to UniqueTagList
- Add TagBook to implement ReadOnlyTagBook
- Change storage to use ReadOnlyTagBook instead of TagList
- Include new definition of equality for Tags (all fields equal except ID)
- Standardize UniqueXXXXList method naming convention

* Update architecture diagrams, UI structure, user stories, use cases and NFRs (AY1920S1-CS2103T-F12-3#108)

* Fix NoteBook.java for duplicate findNote()

* Updates from upstream (#21)

* Update Dev Guide Proposed Component (AY1920S1-CS2103T-F12-3#123)

* DG changes in diagram to update future proposed implementation

* clearer docs

* added linebreaks

* line breaks

* linebreak

* formatting

* Refactor ResultPane into a separate class (AY1920S1-CS2103T-F12-3#103)

* Update AboutUs.adoc for team members to commit

* Add a newline in AboutUs.adoc

* Add more use cases to Developer Guide

* Fix missing endline

* Update various docs to display TagLine

* Add placeholder image

* Fix minor typo in user guide

* Update Tagline to TagLine

* Update team name

* Fix some typos in user guide and developer guide

* Add some tests and remove ContactCard index

* Add new test to NoteListCardTest

* Remove magic literal in NoteListCard

* Fix variable declaration order

* Refactor ResultPane into a separate class

* Add missing Javadoc

* Add note filtering implementation to DG (AY1920S1-CS2103T-F12-3#124)

* Merge updates from AY1920S1-CS2103T-F12-3/main

Tests for delete note
Tests for edit note
XML for DG
Group feature

* Add detailed example for note create, delete, edit in UG

* Add detail example for note list, clear in UG

* Set image width to 600

* Add images for UG

* Fix some bugs in UG

* Add comment on deleted note id

* Update note filter in DG

* Show all notes after deleting

* Fix test error

* Fix test error

* Fix checkstyle
  • Loading branch information
shiweing authored and e0031374 committed Nov 8, 2019
1 parent e1d5ec5 commit 787e2d8
Show file tree
Hide file tree
Showing 13 changed files with 300 additions and 106 deletions.
50 changes: 35 additions & 15 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ image::ExecutingTagNoteCommand.png[]

This whole process has executed the `TagNoteCommand`.

=== [Proposed] Note filtering feature
=== Note filtering feature
==== Description

The user can filter notes by providing a filter in the <<UserGuide#note-list, `note list`>> command.
Expand All @@ -584,47 +584,67 @@ Types of filter:
* Prefix `@` - filter by contact
* Prefix `%` - filter by group

==== Proposed Implementation
==== Implementation

The note filter mechanism is facilitated by the link:{repoURL}/src/main/java/tagline/logic/commands/note/NoteFilter.java[`NoteFilter`] class.
It contains the filter value and the enum `FilterType`.

The note filter mechanism is facilitated by the `Filter` inner class in link:{repoURL}/src/main/java/tagline/logic/commands/note/ListNoteCommand.java[`ListNoteCommand`].
It contains a String filter value and the enum `FilterType`.
A `NoteFilter` is generated by the `NoteFilterUtil` inner class in link:{repoURL}/src/main/java/tagline/logic/parser/note/ListNoteParser.java[`ListNoteParser`] and passed into link:{repoURL}/src/main/java/tagline/logic/commands/note/ListNoteCommand.java[`ListNoteCommand`].

A `Filter` is generated by the `NoteFilterUtil` inner class in link:{repoURL}/src/main/java/tagline/logic/parser/note/ListNoteParser.java[`ListNoteParser`] and passed into `ListNoteCommand`.
`ListNoteCommand` then creates a `Predicate` based on the filter and updates the list of notes in the UI via `Model`.

===== Filter by String keyword

Filter by keyword also implements the link:{repoURL}/src/main/java/tagline/model/note/NoteContainsKeywordsPredicate.java[`NoteContainsKeywordsPredicate`]. The `Predicate` is passed into `Model#updateFilteredNoteList()` to list only notes that contain the keywords.
Filter by keyword is facilitated by the following classes:

* link:{repoURL}/src/main/java/tagline/logic/commands/note/KeywordFilter.java[`KeywordFilter`] - implementation of `NoteFilter` that is passed into `ListNoteCommand`
* link:{repoURL}/src/main/java/tagline/model/note/NoteContainsKeywordsPredicate.java[`NoteContainsKeywordsPredicate`] - `Predicate` passed into `Model#updateFilteredNoteList()` to list only notes that contain the keywords.

Given below is an example scenario where the user enters a command to filter notes by keywords.

**Step 1:** The user command is passed through the `LogicManager` and a `ListNoteCommand` with the `Filter` containing the keywords and `FilterType.KEYWORD` is returned.
**Step 1:** The user command is passed through the `LogicManager` to `ListNoteParser`. `ListNoteParser` checks the input arguments and identify the String keywords.

The keywords are passed into `NoteFilterUtil#generateKeywordFilter()` which returns a `KeywordFilter` containing the keywords and `FilterType.KEYWORD`.

.Sequence diagram of parsing note filter user command to obtain a `ListNoteCommand`
.Sequence diagram of parsing `note list` user command to obtain a `ListNoteCommand`
image::FilterKeywordSequenceDiagram1.png[]

**Step 2:** The `ListNoteCommand` returned will be executed by the `LogicManager`. If a `Filter` exists and is of `FilterType.KEYWORD`, `ListNoteCommand#filterAndListByKeyword()` will be called.
**Step 2:** The `ListNoteCommand` returned will be executed by the `LogicManager`. If a `NoteFilter` exists and is of `FilterType.KEYWORD`, `ListNoteCommand#filterAndListByKeyword()` will be called.

.Sequence diagram of executing `ListNoteCommand` to update filtered note list by keyword in `Model`
image::FilterKeywordSequenceDiagram2.png[]

The method will create a `NoteContainsKeywordsPredicate` and update the list of notes to be displayed via `Model`.
The method will create a `NoteContainsKeywordsPredicate` and update the list of notes to be displayed via `Model#updateFilteredNoteList()`.

image::FilterKeywordExample.png[]

===== Filter by Tag

Filter by `Tag` makes use of the `TagManager#findTag()` to obtain the `Tag` by passing in the `TagId`. It implements the `NoteContainsTagPredicate` which is passed into `Model#updateFilteredNoteList()` to list only notes that contain the tag.
Filter by `Tag` is facilitated by the following classes/methods:

* link:{repoURL}/src/main/java/tagline/logic/parser/tag/TagParserUtil.java[`TagParserUtil#parseTag()`] - to obtain the `Tag` objects from the user input tag strings
* link:{repoURL}/src/main/java/tagline/logic/commands/note/TagFilter.java[`TagFilter`] - implementation of `NoteFilter` that is passed into `ListNoteCommand`
* link:{repoURL}/src/main/java/tagline/model/note/NoteContainsKeywordsPredicate.java[`NoteContainsTagsPredicate`] - `Predicate` passed into `Model#updateFilteredNoteList()` to list only notes that is tagged by specified `Tag`

Given below is an example scenario where the user enters a command to filter notes by tag.

**Step 1:** Similar to filtering by keyword, the user command is passed through the `LogicManager` and a `ListNoteCommand` with the `Filter` containing the keywords and `FilterType.TAG` is returned.
**Step 1:** Similar to filtering by keyword, the user command is passed to the `ListNoteParser`. The `ListNoteParser` checks the input arguments and identify the tag strings.

The tag strings are passed into `NoteFilterUtil#generateTagFilter()`. `TagParserUtil#parseTag()` is called to get `Tag` from the tag string. `TagFilter` containing the list of tags and `FilterType.TAG` is returned.

**Step 2:** The `ListNoteCommand` returned will be executed by the `LogicManager`. If a `Filter` exists and is of `FilterType.TAG`, `ListNoteCommand#filterAndListByTag()` will be called.
.Sequence diagram of parsing user input tag strings to obtain a `ListNoteCommand`
image::FilterTagSequenceDiagram1.png[]

The method will create a `TagId` from the user input and obtain the `Tag` through the `TagManager#findTag()`. The `Tag obtained will be passed into the `NoteContainsTagPredicate`. The `Predicate` is then used to filter the list of notes via `Model`.
**Step 2:** The `ListNoteCommand` returned will be executed by the `LogicManager`. If a `NoteFilter` exists and is of `FilterType.TAG`, `ListNoteCommand#filterAndListByTag()` will be called.

.Sequence diagram of executing `ListNoteCommand` to update filtered note list by `Tag` in `Model`
image::FilterTagSequenceDiagram.png[]
image::FilterTagSequenceDiagram2.png[]

The method will check if the tags in the `NoteFilter` exists via `Model#findTag()`. If a `Tag` does not exist, an error message will be displayed.

If all tags exist, the tags will be passed into the `NoteContainsTagsPredicate` and update the list of notes to be displayed via `Model#updateFilteredNoteList()`.

image::FilterTagExample.png[]

=== Logging

Expand Down
Loading

0 comments on commit 787e2d8

Please sign in to comment.