diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000000..a7e534d140
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,51 @@
+plugins {
+ id 'java'
+ id 'application'
+ id 'checkstyle'
+ id 'org.openjfx.javafxplugin' version '0.0.7'
+ id 'com.github.johnrengelman.shadow' version '5.1.0'
+}
+
+group 'seedu.duke'
+version '0.1.0'
+
+application {
+ // Change this to your main class.
+ mainClassName = "duke.Launcher"
+}
+
+run {
+ standardInput = System.in
+}
+
+checkstyle{
+ toolVersion = '8.23'
+}
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ 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'
+}
+
+shadowJar {
+ archiveBaseName = "duke"
+ archiveVersion = "0.1.3"
+ archiveClassifier = null
+ archiveAppendix = null
+}
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
new file mode 100644
index 0000000000..b1a57ba6c0
--- /dev/null
+++ b/config/checkstyle/checkstyle.xml
@@ -0,0 +1,257 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/README.md b/docs/README.md
index fd44069597..a7cd5ea696 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,20 +1,135 @@
# User Guide
-## Features
+## Features and Usage:
-### Feature 1
-Description of feature.
+**Compile and run:**
-## Usage
+To generate the jar file:
-### `Keyword` - Describe action
+cd to this repository and run
-Describe action and its outcome.
+```
+./gradlew shadowJar
+```
-Example of usage:
+To run the generated jar file:
-`keyword (optional arguments)`
+```
+java -jar duke-0.1.3.jar
+```
-Expected outcome:
+**Test:**
-`outcome`
+You should use "/" to divide your command, task name and date, if needed.
+
+**Add tasks:**
+
+1. add todo task to task list:
+
+ ```
+ todo/task name
+ ```
+
+ for example:
+
+ ```
+ todo/finish my IP task
+ ```
+
+2. add event:
+
+ add an event to task list:
+
+ ```
+ event/event name/date
+ ```
+
+ for example:
+
+ ```
+ event/finish my IP task/March 1st 2020
+ ```
+
+3. add task with deadline
+
+ add an task with deadline to task list:
+
+ deadline/task name/date
+
+ for example:
+
+ ```
+ deadline/finish my IP task/March 1st 2020
+ ```
+
+4. delete task with its name
+
+ delete a task
+
+ ```
+ delete/task name
+ ```
+
+ for example:
+
+ ```
+ delete/finish my IP task
+ ```
+
+**Save tasks:**
+
+1. save tasks to disk:
+
+ ```
+ save
+ ```
+
+**Show tasks:**
+
+1. print all tasks in the chat box:
+
+ ```
+ list
+ ```
+
+Find task:
+
+1. Find a task with its name:
+
+ ```
+ find/task name
+ ```
+
+ for example:
+
+ ```
+ find/finish my IP task
+ ```
+
+**Mark tasks:**
+
+1. mark task as done:
+
+ ```
+ done/task name
+ ```
+
+ for example:
+
+ ```
+ done/finish my IP task
+ ```
+
+2. mark task as undone:
+
+ ```
+ undone/task name
+ ```
+
+ for example:
+
+ ```
+ undone/finish my IP task
+ ```
+
+
\ No newline at end of file
diff --git a/docs/UI.png b/docs/UI.png
new file mode 100644
index 0000000000..1560acf325
Binary files /dev/null and b/docs/UI.png differ
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000000..87b738cbd0
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000000..295e2ffd31
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Tue Feb 11 04:36:00 CST 2020
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStorePath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000000..af6708ff22
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000000..6d57edc706
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000000..d1e92fe5db
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'duke'
diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java
deleted file mode 100644
index 5d313334cc..0000000000
--- a/src/main/java/Duke.java
+++ /dev/null
@@ -1,10 +0,0 @@
-public class Duke {
- public static void main(String[] args) {
- String logo = " ____ _ \n"
- + "| _ \\ _ _| | _____ \n"
- + "| | | | | | | |/ / _ \\\n"
- + "| |_| | |_| | < __/\n"
- + "|____/ \\__,_|_|\\_\\___|\n";
- System.out.println("Hello from\n" + logo);
- }
-}
diff --git a/src/main/java/duke/DialogBox.java b/src/main/java/duke/DialogBox.java
new file mode 100644
index 0000000000..ebc25cc5fe
--- /dev/null
+++ b/src/main/java/duke/DialogBox.java
@@ -0,0 +1,46 @@
+package duke;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.geometry.Pos;
+import javafx.scene.Node;
+import javafx.scene.control.Label;
+import javafx.scene.image.ImageView;
+import javafx.scene.layout.HBox;
+
+
+public class DialogBox extends HBox {
+ private Label text;
+ private ImageView displayPicture;
+
+ public DialogBox(Label l, ImageView iv) {
+ text = l;
+ displayPicture = iv;
+
+ text.setWrapText(true);
+ displayPicture.setFitWidth(100.0);
+ displayPicture.setFitHeight(100.0);
+
+ this.setAlignment(Pos.TOP_RIGHT);
+ this.getChildren().addAll(text, displayPicture);
+ }
+
+ /**
+ * Flips the dialog box such that the ImageView is on the left and text on the right.
+ */
+ private void flip() {
+ this.setAlignment(Pos.TOP_LEFT);
+ ObservableList tmp = FXCollections.observableArrayList(this.getChildren());
+ FXCollections.reverse(tmp);
+ this.getChildren().setAll(tmp);
+ }
+
+ public static DialogBox getUserDialog(Label l, ImageView iv) {
+ return new DialogBox(l, iv);
+ }
+
+ public static DialogBox getDukeDialog(Label l, ImageView iv) {
+ var db = new DialogBox(l, iv);
+ db.flip();
+ return db;
+ }
+}
diff --git a/src/main/java/duke/HelloDuke.java b/src/main/java/duke/HelloDuke.java
new file mode 100644
index 0000000000..1ae5717654
--- /dev/null
+++ b/src/main/java/duke/HelloDuke.java
@@ -0,0 +1,38 @@
+package duke;
+
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class HelloDuke {
+ private static String WELCOME_LOGO = " Hello! This is Duke.";
+
+ private static String EXIT_LOGO = "Bye! See you again. ";
+
+ private static String ERROR_INFORM = "It seems sth is going wrong... ";
+
+ public static void Start(){
+ System.out.println(WELCOME_LOGO);
+ }
+
+ public static void Exit(){
+ System.out.println(EXIT_LOGO);
+ }
+
+ public static void HandleError(){
+ System.out.println((ERROR_INFORM));
+ }
+
+ public static void Print_Out(String s){
+ String output_string = " ";
+ System.out.println(output_string);
+ }
+
+ public static void Print_List(List strs){
+ AtomicInteger ctr = new AtomicInteger();
+ StringBuilder strBldr = new StringBuilder();
+
+ System.out.println(strBldr.toString());
+ }
+
+
+}
diff --git a/src/main/java/duke/Launcher.java b/src/main/java/duke/Launcher.java
new file mode 100644
index 0000000000..46b39d6d63
--- /dev/null
+++ b/src/main/java/duke/Launcher.java
@@ -0,0 +1,15 @@
+package duke;
+import javafx.application.Application;
+
+/**
+ * A launcher class to workaround classpath issues.
+ */
+
+public class Launcher {
+ public static void main(String[] args) {
+ Application.launch(UI.class, args);
+ }
+}
+
+
+
diff --git a/src/main/java/duke/UI.java b/src/main/java/duke/UI.java
new file mode 100644
index 0000000000..ff3076400e
--- /dev/null
+++ b/src/main/java/duke/UI.java
@@ -0,0 +1,146 @@
+package duke;
+
+import javafx.application.Application;
+import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.control.Label;
+import javafx.scene.control.ScrollPane;
+import javafx.scene.control.TextField;
+import javafx.scene.layout.AnchorPane;
+import javafx.scene.layout.Region;
+import javafx.scene.layout.VBox;
+import javafx.stage.Stage;
+import javafx.scene.image.Image;
+import javafx.scene.image.ImageView;
+import tasks.TaskManager;
+
+
+public class UI extends Application {
+ private ScrollPane scrollPane;
+ private VBox dialogContainer;
+ private TextField userInput;
+ private Button sendButton;
+ private Scene scene;
+ private TaskManager manager = new TaskManager();
+
+
+ private Image user = new Image(this.getClass().getResourceAsStream("/images/1.png"));
+ private Image duke = new Image(this.getClass().getResourceAsStream("/images/2.png"));
+
+ @Override
+ public void start(Stage stage) {
+ //Step 1. Setting up required components
+
+ //The container for the content of the chat to scroll.
+ scrollPane = new ScrollPane();
+ dialogContainer = new VBox();
+ scrollPane.setContent(dialogContainer);
+
+ userInput = new TextField();
+ sendButton = new Button("Send");
+
+ AnchorPane mainLayout = new AnchorPane();
+ mainLayout.getChildren().addAll(scrollPane, userInput, sendButton);
+
+ scene = new Scene(mainLayout);
+
+ stage.setScene(scene);
+ stage.show();
+
+ // more code to be added here later
+ stage.setTitle("Duke");
+ stage.setResizable(false);
+ stage.setMinHeight(600.0);
+ stage.setMinWidth(400.0);
+
+ mainLayout.setPrefSize(400.0, 600.0);
+
+ scrollPane.setPrefSize(385, 535);
+ scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
+ scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);
+
+ scrollPane.setVvalue(1.0);
+ scrollPane.setFitToWidth(true);
+
+ // You will need to import `javafx.scene.layout.Region` for this.
+ dialogContainer.setPrefHeight(Region.USE_COMPUTED_SIZE);
+
+ userInput.setPrefWidth(325.0);
+
+ sendButton.setPrefWidth(55.0);
+
+ AnchorPane.setTopAnchor(scrollPane, 1.0);
+
+ AnchorPane.setBottomAnchor(sendButton, 1.0);
+ AnchorPane.setRightAnchor(sendButton, 1.0);
+
+ AnchorPane.setLeftAnchor(userInput, 1.0);
+ AnchorPane.setBottomAnchor(userInput, 1.0);
+
+ //Step 3. Add functionality to handle user input.
+ sendButton.setOnMouseClicked((event) -> {
+ dialogContainer.getChildren().add(getDialogLabel(userInput.getText()));
+ userInput.clear();
+ });
+
+ userInput.setOnAction((event) -> {
+ dialogContainer.getChildren().add(getDialogLabel(userInput.getText()));
+ userInput.clear();
+ });
+
+
+ //Scroll down to the end every time dialogContainer's height changes.
+ dialogContainer.heightProperty().addListener((observable) -> scrollPane.setVvalue(1.0));
+
+ //Part 3. Add functionality to handle user input.
+ sendButton.setOnMouseClicked((event) -> {
+ handleUserInput();
+ });
+
+ userInput.setOnAction((event) -> {
+ handleUserInput();
+ });
+ }
+
+ /**
+ * Iteration 1:
+ * Creates a label with the specified text and adds it to the dialog container.
+ * @param text String containing text to add
+ * @return a label with the specified text that has word wrap enabled.
+ */
+
+ private Label getDialogLabel(String text) {
+ // You will need to import `javafx.scene.control.Label`.
+ Label textToAdd = new Label(text);
+ textToAdd.setWrapText(true);
+ return textToAdd;
+ }
+
+ /**
+ * Iteration 2:
+ * Creates two dialog boxes, one echoing user input and the other containing Duke's reply and then appends them to
+ * the dialog container. Clears the user input after processing.
+ */
+
+ private void handleUserInput() {
+ Label userText = new Label(userInput.getText());
+ Label dukeText = new Label(getResponse(userInput.getText()));
+ dialogContainer.getChildren().addAll(
+ DialogBox.getUserDialog(userText, new ImageView(user)),
+ DialogBox.getDukeDialog(dukeText, new ImageView(duke))
+ );
+ userInput.clear();
+ }
+
+
+
+ /**
+ * You should have your own function to generate a response to user input.
+ * Replace this stub with your completed method.
+ */
+ private String getResponse(String input) {
+
+ return manager.Input_Solver(input);
+ }
+}
+
diff --git a/src/main/java/duke/tasks/TaskManager.java b/src/main/java/duke/tasks/TaskManager.java
new file mode 100644
index 0000000000..1f08be5093
--- /dev/null
+++ b/src/main/java/duke/tasks/TaskManager.java
@@ -0,0 +1,207 @@
+package tasks;
+
+import javafx.util.Pair;
+import ui.HelloDuke;
+
+import javax.swing.*;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+
+public class TaskManager {
+ private List Task_List = new ArrayList<>();
+
+ private String[] parser(String input_str){
+ String[] command_content = input_str.split("/");
+
+ return command_content;
+ }
+
+ public String Print_Task_List(){
+ if (Task_List.size() == 0){
+ return("There is no task now, please add some tasks.");
+ }
+ else {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < Task_List.size(); i++) {
+ sb.append(Task_List.get(i).print_task());
+ sb.append("\n");
+ }
+ return sb.toString();
+ }
+ }
+
+ public String Print_Bye_Info(){
+ return "Goodbye and see you again!";
+ }
+
+ public String Add_DDL(String event, String Date){
+ for (int i = 0; i < Task_List.size(); i++) {
+ if (Task_List.get(i).TaskName.equals(event)) {
+ return "Task already added";
+ }
+ }
+ TaskType task = new TaskType(false, event, "D", Date);
+ this.Task_List.add(task);
+ return "Task added successfully";
+ }
+
+ public String Add_Event(String event, String Date){
+ if (Task_List.size() > 0) {
+ for (int i = 0; i < Task_List.size(); i++) {
+ if (Task_List.get(i).TaskName.equals(event)) {
+ return "Task already added";
+ }
+ }
+ }
+ TaskType task = new TaskType(false, event, "E", Date);
+ this.Task_List.add(task);
+ return "Task added successfully";
+ }
+
+ public String Add_ToDo(String event){
+ if (Task_List.size() > 0) {
+ for (int i = 0; i < Task_List.size(); i++) {
+ if (Task_List.get(i).TaskName.equals(event)) {
+ return "Task already added";
+ }
+ }
+ }
+ TaskType task = new TaskType(false, event, "T", "None");
+ this.Task_List.add(task);
+ return "Task added successfully";
+ }
+
+ public void Mark_task(String event){
+ for (int i = 0; i < Task_List.size(); i++){
+ if (Task_List.get(i).TaskName.equals(event)){
+ Task_List.get(i).is_finished = true;
+ break;
+ }
+ }
+ }
+
+ public void Unmark_task(String event){
+ for (int i = 0; i < Task_List.size(); i++){
+ if (Task_List.get(i).TaskName.equals(event)){
+ Task_List.get(i).is_finished = true;
+ break;
+ }
+ }
+ }
+
+
+ public void Delete_Task(String event){
+ for (int i = 0; i < Task_List.size(); i++){
+ if (Task_List.get(i).TaskName.equals(event)){
+ Task_List.remove(i);
+ break;
+ }
+ }
+ }
+
+
+ public String Search_By_Task(String event){
+ int i = 0;
+ for (i = 0; i < Task_List.size(); i++){
+ if (Task_List.get(i).TaskName.equals(event)){
+ return(Task_List.get(i).print_task());
+ }
+ }
+ return("This task cannot be found!");
+ }
+
+
+ public String Save_task() {
+ try {
+ Path currentPath = Paths.get(System.getProperty("user.dir"));
+ Path filePath = Paths.get(currentPath.toString(), "Tasks.txt");
+ String path = filePath.toString();
+ File file = new File(path);
+ if (!file.exists()) {
+ file.createNewFile();
+ }
+ FileWriter fileWritter = new FileWriter(file.getName(),true);
+ BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
+ bufferWritter.write(Print_Task_List());
+ bufferWritter.close();
+ return "Saved successfuly to " + path;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return "Save failed";
+ }
+ }
+
+
+ public String Input_Solver(String input_str){
+ String[] input_list = parser(input_str);
+
+ //for (int i = 0; i < input_list.length; i++){
+ // System.out.println(input_list[i]);
+ //}
+
+ if (input_list[0].equals("list")){
+ assert input_list.length == 1;
+ return Print_Task_List();
+ }
+
+ else if (input_list[0].equals("bye")){
+ assert input_list.length == 1;
+ return Print_Bye_Info();
+ }
+
+ else if (input_list[0].equals("deadline")){
+ assert input_list.length == 3;
+ return Add_DDL(input_list[1], input_list[2]);
+ }
+
+ else if (input_list[0].equals("event")){
+ assert input_list.length == 3;
+ return Add_Event(input_list[1], input_list[2]);
+ }
+
+ else if (input_list[0].equals("todo")){
+ assert input_list.length == 2;
+ return Add_ToDo(input_list[1]);
+ }
+
+ else if (input_list[0].equals("done")){
+ assert input_list.length == 2;
+ Mark_task(input_list[1]);
+ return "Finished mark";
+ }
+
+ else if (input_list[0].equals("undone")){
+ assert input_list.length == 2;
+ Unmark_task(input_list[1]);
+ return "Finished unmark";
+ }
+
+ else if (input_list[0].equals("search")){
+ assert input_list.length == 2;
+ return Search_By_Task(input_list[1]);
+ }
+
+ else if (input_list[0].equals("delete")){
+ assert input_list.length == 2;
+ Delete_Task(input_list[1]);
+ return "Already deleted";
+ }
+
+ else if (input_list[0].equals("save")){
+ assert input_list.length == 1;
+ return(Save_task());
+ }
+
+ return("This command " +
+ input_str + " is not valid, please check again.");
+
+ }
+}
diff --git a/src/main/java/duke/tasks/TaskType.java b/src/main/java/duke/tasks/TaskType.java
new file mode 100644
index 0000000000..f9105b52b5
--- /dev/null
+++ b/src/main/java/duke/tasks/TaskType.java
@@ -0,0 +1,33 @@
+package tasks;
+
+public class TaskType {
+ public boolean is_finished;
+ public String Type;
+ public String TaskName;
+ public String Date;
+
+ TaskType(boolean is_finished, String TaskName, String Type, String Date){
+ this.is_finished = is_finished;
+ this.Type = Type;
+ this.TaskName = TaskName;
+ this.Date = Date;
+ }
+
+ public void mark(){
+ this.is_finished = true;
+ }
+
+ public void unmark(){
+ this.is_finished = false;
+ }
+
+ public String print_task(){
+ String out_string = "[N]["+Type+"] " + TaskName + " / " + Date;
+
+ if (this.is_finished){
+ out_string = "[Y]["+Type+"] " + TaskName + " / " + Date;
+ }
+ return out_string;
+ }
+
+}
diff --git a/src/main/resources/META-INF/MANIFEST.MF b/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..8a51453653
--- /dev/null
+++ b/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: Launcher
+
diff --git a/src/main/resources/images/1.png b/src/main/resources/images/1.png
new file mode 100644
index 0000000000..f4e84eb030
Binary files /dev/null and b/src/main/resources/images/1.png differ
diff --git a/src/main/resources/images/2.png b/src/main/resources/images/2.png
new file mode 100644
index 0000000000..af0b2d18c0
Binary files /dev/null and b/src/main/resources/images/2.png differ
diff --git a/text-ui-test/runtest.sh b/text-ui-test/runtest.sh
new file mode 100644
index 0000000000..0c5605af79
--- /dev/null
+++ b/text-ui-test/runtest.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+
+# create bin directory if it doesn't exist
+if [ ! -d "../bin" ]
+then
+ mkdir ../bin
+fi
+
+# delete output from previous run
+if [ -e "./ACTUAL.TXT" ]
+then
+ rm ACTUAL.TXT
+fi
+
+# compile the code into the bin folder, terminates if error occurred
+if ! javac -cp ../src -Xlint:none -d ../bin ../src/main/java/Duke.java
+then
+ echo "********** BUILD FAILURE **********"
+ exit 1
+fi
+
+# run the program, feed commands from input.txt file and redirect the output to the ACTUAL.TXT
+java -classpath ../bin Duke < input.txt > ACTUAL.TXT
+
+# compare the output to the expected output
+diff ACTUAL.TXT EXPECTED.TXT
+if [ $? -eq 0 ]
+then
+ echo "Test result: PASSED"
+ exit 0
+else
+ echo "Test result: FAILED"
+ exit 1
+fi
\ No newline at end of file
diff --git a/tutorials/javaFxTutorialPart1.md b/tutorials/javaFxTutorialPart1.md
index 561daeca43..6400dfa154 100644
--- a/tutorials/javaFxTutorialPart1.md
+++ b/tutorials/javaFxTutorialPart1.md
@@ -27,18 +27,25 @@ A JavaFX application is like a play you are directing. Instead of creating props
Update your `build.gradle` to include the following lines:
```groovy
-plugins {
- id 'java'
- id 'org.openjfx.javafxplugin' version '0.0.7'
-}
-
repositories {
mavenCentral()
}
-javafx {
- version = "11.0.2"
- modules = [ 'javafx.controls', 'javafx.fxml' ]
+dependencies {
+ 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'
}
```