diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 00000000..1d38e9d8 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,39 @@ +# This workflow will build a Java project with Gradle +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Java CI with Gradle + +on: [push, pull_request] + +jobs: + build: + strategy: + matrix: + platform: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.platform }} + + steps: + - name: Set up repository + uses: actions/checkout@master + + - name: Set up repository + uses: actions/checkout@master + with: + ref: master + + - name: Merge to master + run: git checkout --progress --force ${{ github.sha }} + + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + + - name: Setup JDK 11 + uses: actions/setup-java@v1 + with: + java-version: '11' + java-package: jdk+fx + + - name: Build and check with Gradle + run: ./gradlew check + + diff --git a/README.md b/README.md index 9d95025b..8f725dca 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# Duke project template +[![CI Status](https://github.com/tototto/ip/actions/workflows/gradle.yml/badge.svg)](https://github.com/tototto/ip/actions) + +# duke.Duke project template This is a project template for a greenfield Java project. It's named after the Java mascot _Duke_. Given below are instructions on how to use it. @@ -15,7 +17,7 @@ Prerequisites: JDK 11, update Intellij to the most recent version. 1. Click `Open or Import`. 1. Select the project directory, and click `OK` 1. If there are any further prompts, accept the defaults. -1. After the importing is complete, locate the `src/main/java/Duke.java` file, right-click it, and choose `Run Duke.main()`. If the setup is correct, you should see something like the below: +1. After the importing is complete, locate the `src/main/java/duke.Duke.java` file, right-click it, and choose `Run duke.Duke.main()`. If the setup is correct, you should see something like the below: ``` Hello from ____ _ diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..53e3bb78 --- /dev/null +++ b/build.gradle @@ -0,0 +1,62 @@ +plugins { + id 'java' + id 'application' + id 'checkstyle' + id 'com.github.johnrengelman.shadow' version '5.1.0' +} + +repositories { + mavenCentral() +} + +dependencies { + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' + + String javaFxVersion = '11' + + implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win' + implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac' + implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux' + implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'win' + implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'mac' + implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'linux' + implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'win' + implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'mac' + implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'linux' + implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win' + implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac' + implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux' +} + +test { + useJUnitPlatform() + + testLogging { + events "passed", "skipped", "failed" + + showExceptions true + exceptionFormat "full" + showCauses true + showStackTraces true + showStandardStreams = false + } +} + +application { + mainClassName = "duke.Launcher" +} + +shadowJar { + archiveBaseName = "duke" + archiveClassifier = null +} + +checkstyle { + toolVersion = '8.29' +} + +run{ + standardInput = System.in +} + diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 00000000..36d469c8 --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,398 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml new file mode 100644 index 00000000..135ea49e --- /dev/null +++ b/config/checkstyle/suppressions.xml @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file diff --git a/data.txt b/data.txt new file mode 100644 index 00000000..4a385cc9 --- /dev/null +++ b/data.txt @@ -0,0 +1,21 @@ +[D] [✘] read book (by: 2/2/20 12pm) +[T] [✘] return book +[T] [✓] buy iphone 12 +[D] [✘] sell ipad (by: 30/10/2020 12pm) +[E] [✘] join webinar (at: 12/06/2020 4am) +[D] [✘] sample ded task (by: 20/2/2222 3pm) +[D] [✓] thanks giving dinner (by: 12/12/12 4pm) +[D] [✘] fskdg (by: 12/12/21 7pm) +[E] [✓] tgsdfsdf (at: 12/12/12 5pm-6pm) +[T] [✘] just checking +[D] [✘] birthday party today (by: 12/12/12 5pm) +[E] [✓] eating competition (at: 12/12/21 5pm-6pm) +[T] [✓] sample +[D] [✘] task desc (by: 12/12/99 4pm) +[E] [✓] wwdc at night (at: 12/4/21 5pm-6pm) +[T] [✓] ttt +[E] [✓] uuu iii (at: 5/5/21 9pm) +[D] [✓] iii ffsf sdfd (by: 4/3/12 9pm) +[T] [✓] gggggg +[T] [✓] iiiiiiii +[D] [✘] dfsfgg (by: 5/5/5 12pm) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md new file mode 100644 index 00000000..32a88ef0 --- /dev/null +++ b/docs/DeveloperGuide.md @@ -0,0 +1,138 @@ +# Developer Guide + +## Design + +### Architecture + +![Image of SoftwareArchitecture](https://github.com/tototto/ip/blob/master/docs/images/architecture.jpg?raw=true) + +The Architecture Diagram given above explains the high-level design of the App. Given below is a quick overview of each component. + +The App consist of 9 components. + +* UI: The UI of the App. +* Duke: The main logic handler of the App. +* Command: The control variable of the App. +* FileManager: Reads data from, and writes data to, the hard disk. +* Storage: Contains the in-memory data of the app. +* Search: Searches the data +* Task: Define the structure of each task. +* Input: Define how input is recieved. +* Output: Define how output is displayed. + +### How the architecture components interact with each other + +The Sequence Diagram below shows how the components interact with each other for the scenario where the user issues the command todo xxx. + +![Image of SequenceDiagram](https://github.com/tototto/ip/blob/master/docs/images/Interaction.jpg?raw=true) + +The sections below give more details of some of each component. + +### Duke component + +![Image of DukeComponent](https://github.com/tototto/ip/blob/master/docs/images/Duke.jpg?raw=true) + +The Duke componenet is the main handler of the App logic. It is associated with and contains all other classes as they are needed and necessary for the sucessful implementation of the logic in Duke. Duke uses the other classes in the order that is required to work the logic. + +The Duke componenet is called by the UI componenet which is implemented using JavaFX. + +### Command component + +![Image of CommandComponent](https://github.com/tototto/ip/blob/master/docs/images/CmdComponent.jpg?raw=true) + +User provide input to the App and they are pared by the InputParser class to produce a Keyword String object. +Command and input entered by the user with the keyword are passed into the Command componenet by Duke. +Command Components handles the different input of user entered into Duke based on the keyword extracted. +Based on the keywords that was parsed, different actions are taken by the Command componenet. + +Such as: + * Adding a todo + * Adding a deadline + * Marking a task as done + * Deleting a task + +Based on the different keywords, the user remaning input are further parsed using the API of other componenet such as the InputParser. +Task can then be created or updated or action can be taken, such as deleting or displaying help. +The storage can be updated based on the result of the command executed. +The result of the command execution is encapsulated as a output string object and is passed back to the Ui. +In addition, the Command Component can also instruct the Ui to perform certain actions, such as displaying help to the user. +The result is stored in the Storage componenet and then written to the file by the FileManager Component. + +## Implementation + +Add todo task Implementation + +The add todo feature add items in Duke. It is facillated by the Command Class which comprises of the following implementation for the add functionality: + +* ```InputParser``` - Parses the remaining input after keyword and prepares them to be added to the App +* ```ListHandler``` - Add the input to the in-memory storage list +* ```Task``` - Define how the task is structured in the App +* ```DisplayHandler``` - Controls the result of the command execution + +The following sequence diagram shows how the Add todo operation works. + +![Image of CommandComponent](https://github.com/tototto/ip/blob/master/docs/images/AddTodoImplementation.jpg?raw=true) + +##### Design consideration: +Aspect: Add Todo can otherwise be implemented + +###### Alternative 1: Allow user to store all task including Events & Deadline using the Todo command instead of having seperate command such as Deadline & Event for each of them. +Pros: Improve usability. User now only needs to remember one command.
+Cons: difficult to implement. + + +## Product scope +### Target user profile +* Is a manager, student or individual who needs to manage tasks. +* prefer desktop apps over other types. +* can type fast. +* prefers typing to mouse interactions. +* is reasonably comfortable using CLI apps. + +### Value proposition +manage defects faster than a typical mouse/GUI driven app. Allows the user to better manage the personal or work issues. + +## Non-Functional Requirements + +* Should work on any mainstream OS as long as it has Java 11 or above installed. +* Should be able to hold up to 1000 task without a noticeable sluggishness in performance for typical usage. +* A user with above average typing speed for regular English text (i.e. not code, not system admin commands) should be able to accomplish most of the tasks faster using commands than using the mouse +* Should load from and save to from a text files + + +## Glossary + +* *Mainstream OS:* Windows, Linux, Unix, OS-X. + +## Instructions for manual testing + +### Launch and Shutdown + +1. Initial launch + 1. Download the jar file and copy into an empty folder + 2. Use Command Prompt to run jar file with `java -jar` command. + 3. type exit command to exit from the program. + +2. Re-launch the app by running `java -jar` command with Command Prompt. + +### Adding a todo task +1. Add the Todo task through following command: + 1. Todo {task description here} + +### Listing all task in the system +1. Enter the command + 1. List +2. List of all task in the system will be listed in the order they were created. + +### Delete a particular task in the system +1. Enter the command + 1. Delete {index}. Eg: Delete 1 +2. The first Defect will be deleted. + +### Load a list of Defects into the progam upon lauch +1. Program looks for and loads data.txt +2. If file is not found, no task will be preloaded. Program starts as per normal operation. + +### Save a list of task into itlogger.txt upon exit +1. Saves all task into the data.txt file when user issues any command. +2. If file does not exist, data.txt will be created. diff --git a/docs/README.md b/docs/README.md index fd440695..b889b8e8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,20 +1,9 @@ -# User Guide +Duke is an education project. +This application has a GUI that can allow user to manage task. -## Features +NUS TIC4002 iP submission -### Feature 1 -Description of feature. +Useful links: +* [User Guide](UserGuide.md) +* [Developer Guide](DeveloperGuide.md) -## Usage - -### `Keyword` - Describe action - -Describe action and its outcome. - -Example of usage: - -`keyword (optional arguments)` - -Expected outcome: - -`outcome` diff --git a/docs/Ui.png b/docs/Ui.png new file mode 100644 index 00000000..6c576cb4 Binary files /dev/null and b/docs/Ui.png differ diff --git a/docs/UserGuide.md b/docs/UserGuide.md new file mode 100644 index 00000000..854d2eed --- /dev/null +++ b/docs/UserGuide.md @@ -0,0 +1,106 @@ +# User Guide + +## Quick Start + +1. Ensure you have Java 11 or above installed in your Computer. + +1. Download the latest Duke.jar from the release page. + +1. Copy the file to the folder you want to use as the home folder for Duke. + +1. Double-click the file to start the app. + +## Features +Allows user to add task to Duke and manage a list of pending items. + +### Features +* Adding task to Duke + * Adding a simple task + * Adding a task with a deadline (date & time) + * Adding an event with a deadline (date & time range) +* Allowing user to mark a task as completed +* Viewing a list of task + +### `Keyword` - Describe action + +Keyword | +------------ | +```todo``` | +```deadline``` | +```event``` | +```list``` | +```done``` | +```delete``` | +```bye``` | +```help```| + +## Usage + +##### ```todo``` +Adds a task to Duke with task description given in ``````. +##### Usage: ```todo ``` + +##### Examples: +* ```todo Buy an iPhone 12 at launch date``` + +##### ```deadline``` +Adds a task with deadline to Duke with task description given in ``````. +State completion deadline of the date & the time in ```