Skip to content

Commit

Permalink
Merge branch 'branch-A-CheckStyle'
Browse files Browse the repository at this point in the history
  • Loading branch information
WM71811 committed Sep 6, 2020
2 parents a548430 + 4aba529 commit ab27e0c
Show file tree
Hide file tree
Showing 23 changed files with 496 additions and 65 deletions.
399 changes: 399 additions & 0 deletions config/checkstyle/checkstyle.xml

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions config/checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0"?>

<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">

<suppressions>
<suppress checks="JavadocType" files=".*Test\.java"/>
<suppress checks="MissingJavadocMethodCheck" files=".*Test\.java"/>
</suppressions>
3 changes: 3 additions & 0 deletions data/tasks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ event|✘|meeting|2pm
event|✘|meeting2|2020-11-10
deadline|✘|prepare presentation|Sep 10 2020
todo|✓|complete assignment
todo|✓|12
todo|✓|13
todo|✘|14
28 changes: 18 additions & 10 deletions src/main/java/duke/DialogBox.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package duke;

import javafx.fxml.FXML;
import javafx.scene.control.Label;
import java.io.IOException;
import java.util.Collections;

import javafx.collections.FXCollections;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.fxml.FXMLLoader;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Rectangle;
import java.io.IOException;
import java.util.Collections;


/**
* Represents a dialog box consisting of an ImageView to represent the speaker's face and a label
Expand All @@ -25,15 +26,22 @@ public class DialogBox extends HBox {
@FXML
private ImageView displayPicture;

/**
* Constructs a dialogbox and load the fxml file.
*
* @param input Input text.
* @param image Image of the user or Duke.
*/
public DialogBox(String input, Image image) {
try {
FXMLLoader fxmlLoader = new FXMLLoader(MainWindow.class.getResource("/view/DialogBox.fxml"));
fxmlLoader.setController(this);
fxmlLoader.setRoot(this);
fxmlLoader.load();
dialog.setText(input);
Circle clip = new Circle(displayPicture.getFitWidth()/2,
displayPicture.getFitHeight()/2, displayPicture.getFitWidth()/2);
Circle clip = new Circle(displayPicture.getFitWidth() / 2,
displayPicture.getFitHeight() / 2,
displayPicture.getFitWidth() / 2);
displayPicture.setClip(clip);
displayPicture.setImage(image);
} catch (IOException e) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/duke/Duke.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package duke;

import duke.command.Command;
import duke.command.ExitCommand;
import duke.exception.InvalidInputException;
import duke.parser.Parser;
import duke.storage.Storage;
Expand All @@ -15,11 +14,12 @@
*/
public class Duke {

private static final String byeMessage = "bye";

private Storage storage;
private TaskList taskList;
private Ui ui;
private boolean canCloseWindow = false;
private static final String byeMessage = "bye";

/**
* Creates a duke object and initializes storage, taskList and ui.
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/duke/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
* Launches the programme.
*/
public class Launcher {
/**
* Launches Duke.
*
* @param args Java command line arguments.
*/
public static void main(String[] args) {
try {
Application.launch(Main.class, args);
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/duke/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
*/
public class Main extends Application {

private static final String MAIN_WINDOW_PATH = "/view/MainWindow.fxml";

private Duke duke = new Duke();
private final String MAIN_WINDOW_PATH = "/view/MainWindow.fxml";

/**
* Starts
Expand All @@ -33,4 +34,4 @@ public void start(Stage stage) {
e.printStackTrace();
}
}
}
}
11 changes: 7 additions & 4 deletions src/main/java/duke/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
* layout for the other controls.
*/
public class MainWindow extends AnchorPane {

private static final double TIME_DELAY = 1;
private static final String USER_IMAGE_PATH = "/images/user.png";
private static final String DUKE_IMAGE_PATH = "/images/duke.png";

@FXML
private ScrollPane scrollPane;
@FXML
Expand All @@ -27,12 +32,10 @@ public class MainWindow extends AnchorPane {

private Duke duke;

private final double TIME_DELAY = 1;
private final String USER_IMAGE_PATH = "/images/user.png";
private final String DUKE_IMAGE_PATH = "/images/duke.png";
private Image userImage = new Image(this.getClass().getResourceAsStream(USER_IMAGE_PATH));
private Image dukeImage = new Image(this.getClass().getResourceAsStream(DUKE_IMAGE_PATH));


/**
* Initializes the GUI window.
*/
Expand Down Expand Up @@ -76,4 +79,4 @@ private void handleUserInput() {
}

}
}
}
4 changes: 2 additions & 2 deletions src/main/java/duke/command/AddCommand.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package duke.command;
import duke.exception.InvalidInputException;
import duke.storage.Storage;
import duke.task.Task;
import duke.task.TaskList;
import duke.ui.Ui;
import duke.exception.InvalidInputException;
import duke.task.Task;

/**
* Represents an AddCommand and handles methods related to commands about adding a task.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/duke/command/Command.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package duke.command;
import duke.exception.InvalidInputException;
import duke.storage.Storage;
import duke.task.TaskList;
import duke.ui.Ui;
import duke.exception.InvalidInputException;

/**
* Represents a Command and handles methods related to commands.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/duke/command/DeleteCommand.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package duke.command;
import duke.exception.InvalidInputException;
import duke.storage.Storage;
import duke.task.Task;
import duke.task.TaskList;
import duke.ui.Ui;
import duke.exception.InvalidInputException;
import duke.task.Task;

/**
* Represents a DeleteCommand and handles methods related to commands
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/duke/command/DoneCommand.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package duke.command;
import duke.exception.InvalidInputException;
import duke.storage.Storage;
import duke.task.Task;
import duke.task.TaskList;
import duke.ui.Ui;
import duke.exception.InvalidInputException;

/**
* Represents a DoneCommand and handles methods related to commands
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/duke/command/ErrorCommand.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package duke.command;
import duke.exception.InvalidInputException;
import duke.storage.Storage;
import duke.task.TaskList;
import duke.ui.Ui;
import duke.exception.InvalidInputException;

/**
* Represents an ErrorCommand and handles methods related to
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/duke/command/ExitCommand.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package duke.command;
import duke.exception.InvalidInputException;
import duke.storage.Storage;
import duke.task.TaskList;
import duke.ui.Ui;
import duke.exception.InvalidInputException;

/**
* Represents an ExitCommand and handles methods related to commands
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/duke/command/FindCommand.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package duke.command;

import java.util.ArrayList;

import duke.exception.InvalidInputException;
import duke.storage.Storage;
import duke.task.Task;
import duke.task.TaskList;
import duke.ui.Ui;

import java.util.ArrayList;

/**
* Represents a FindCommand and handles methods related to commands
* about finding matching tasks associated with a keyword.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/duke/command/ListCommand.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package duke.command;
import duke.exception.InvalidInputException;
import duke.storage.Storage;
import duke.task.TaskList;
import duke.ui.Ui;
import duke.exception.InvalidInputException;

/**
* Represents a ListCommand and handles methods related to commands
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/duke/exception/InvalidRequestException.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package duke.exception;

import duke.exception.InvalidInputException;

/**
* Represents an InvalidRequestException and handles the exceptions related
* to invalid user requests.
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/duke/parser/Parser.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package duke.parser;

import duke.command.Command;
import duke.command.ExitCommand;
import duke.command.AddCommand;
import duke.command.Command;
import duke.command.DeleteCommand;
import duke.command.DoneCommand;
import duke.command.ListCommand;
import duke.command.ErrorCommand;
import duke.command.ExitCommand;
import duke.command.FindCommand;
import duke.exception.InvalidInputException;
import duke.command.ListCommand;
import duke.exception.InvalidDeadlineException;
import duke.exception.InvalidEventException;
import duke.exception.InvalidInputException;
import duke.exception.InvalidRequestException;
import duke.exception.InvalidTodoException;
import duke.exception.InvalidDeadlineException;
import duke.task.Deadline;
import duke.task.Event;
import duke.task.Task;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/duke/parser/TimeParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* parsing the string representing the time of tasks.
*/
public class TimeParser {

private LocalDate localDate;
private String time;

Expand Down
21 changes: 12 additions & 9 deletions src/main/java/duke/storage/Storage.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package duke.storage;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

import duke.exception.InvalidFilePathException;
import duke.task.Deadline;
import duke.task.Event;
import duke.task.Task;
import duke.task.TaskList;
import duke.task.Todo;
import duke.task.Deadline;
import duke.task.Event;

import java.io.File;
import java.util.Scanner;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;

/**
* Represents the storage class. Storage class is a class consists of methods
Expand Down Expand Up @@ -47,7 +48,7 @@ public Storage(String filePath, String directoryPath) {
this.directoryPath = directoryPath;
}
} catch (InvalidFilePathException e) {
e.getMessage();
e.getMessage();
}
}

Expand Down Expand Up @@ -93,6 +94,8 @@ public TaskList read() {
event.setWhetherTaskDone(whetherIsDone);
listOfTasks.add(event);
break;
default:
break;
}
}
scanner.close();
Expand All @@ -108,7 +111,7 @@ public TaskList read() {
*
* @param listOfTasks The list of tasks.
*/
public void write( ArrayList<Task> listOfTasks) {
public void write(ArrayList<Task> listOfTasks) {
try {
FileWriter fileWriter = new FileWriter(filePath);
for (Task task : listOfTasks) {
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/duke/task/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public String getName() {
* @param whetherIsDone Boolean showing whether the duke.task is done.
*/
public void setWhetherTaskDone(String whetherIsDone) {
isDone = whetherIsDone.equals("true");
isDone = whetherIsDone.equals("true");
}

/**
Expand All @@ -92,7 +92,6 @@ public String writeToFile() {
*/
@Override
public String toString() {
return "[" +
this.getStatusSymbol() + "] " + taskName;
return "[" + this.getStatusSymbol() + "] " + taskName;
}
}

0 comments on commit ab27e0c

Please sign in to comment.