Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wang Haitao iP #449

Open
wants to merge 61 commits into
base: master
Choose a base branch
from
Open

Conversation

HAITAO2003
Copy link

@HAITAO2003 HAITAO2003 commented Feb 3, 2025

Duke Task Manager: Now with JavaFX GUI! 🎨

A personal task management application that helps you keep track of todos, deadlines, and events.

Major Updates in this PR

  • Replaced command-line interface with a modern JavaFX GUI
  • Added interactive chat-style interface
  • Improved user experience with visual feedback
  • Maintained core functionality while upgrading the UI

Implementation Details

  1. Created new JavaFX components:

    • Main application window
    • Chat dialog boxes
    • Input field with send button
    • Scrollable conversation view
  2. Modified existing components:

    • Updated Duke class to support GUI
    • Enhanced Ui class for visual output
    • Maintained backward compatibility

Code Example

public class DialogBox extends HBox {
    @FXML
    private Label dialog;
    @FXML
    private ImageView displayPicture;

    private DialogBox(String text, String imagePath) {
        try {
            FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource("/view/DialogBox.fxml"));
            fxmlLoader.setController(this);
            fxmlLoader.setRoot(this);
            fxmlLoader.load();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Project Status

  • JavaFX GUI implementation
  • Chat interface
  • Basic styling
  • Advanced features
  • User documentation
  • Testing

Technical Details

The project now uses JavaFX for the GUI, with FXML for layout management. The original functionality is maintained through the command line interface new graphical interface.

For more information about JavaFX, visit OpenJFX documentation.

damithc and others added 17 commits July 11, 2024 16:52
In build.gradle, the dependencies on distZip and/or distTar causes
the shadowJar task to generate a second JAR file for which the
mainClass.set("seedu.duke.Duke") does not take effect.
Hence, this additional JAR file cannot be run.
For this product, there is no need to generate a second JAR file
to begin with.

Let's remove this dependency from the build.gradle to prevent the
shadowJar task from generating the extra JAR file.
1. Better modularisation of the code
2. added delete function
3. fixed output format problem
Copy link

@DESU-CLUB DESU-CLUB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All in all well done! There were a few violations but it was a really good job with the overall naming conventions

Jiayouzz for IP!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to git ignore the .class

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great naming conventions here for the formats!

} else {
try {
switch(parts[0]) {
case "deadline":

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the coding standards, cases have no indentations (same indent as switch)

@@ -0,0 +1,68 @@
import utils.Utils;

import java.util.ArrayList;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better to put ArrayList before custom imports like utils, as that caused me to violate the checkstyle

However the coding standards dont enforce this to that degree so this is really up to your personal preference

@@ -3,7 +3,7 @@
import java.util.Optional;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like how you're using typing in order to annotate your classes and allow for empties!

Comment on lines 15 to 45
public void add_item(Task item) {
this.list.add(item);
System.out.println("Got it. I've added this task:");
printTask(item);
Utils.output("Now you have " + this.list.size() + " tasks in the list.");
saveToFile();
}

public void delete_item_by_index(int index) throws DukeException {
if (index < 1 || index > list.size()) {
throw new DukeException("Invalid task number! Please provide a number between 1 and " + list.size());
}
Task removedTask = list.remove(index - 1);
System.out.println("Noted. I've removed this task:");
printTask(removedTask);
Utils.output("Now you have " + this.list.size() + " tasks in the list.");
saveToFile();

}

public void mark_done_by_index(int idx) {
if (idx > this.list.size()){
Utils.output("Task number does not exist!");
}else{
System.out.println("Nice! I've marked this task as done:");
Task item = this.list.get(idx - 1);
item.markDone();
printTask(item);
saveToFile();
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the naming convention for class methods.
Suggested:
addItem(args)
deleteItem(args)
markDone(args)

Add comprehensive assertions throughout Parser and Storage classes to
document and validate important code assumptions and invariants.
These assertions serve as both documentation and runtime checks
during development.

Parser changes:
- Add input validation assertions for all parameters
- Validate command string formatting and processing
- Add assertions for task-specific format requirements
- Ensure index operations remain within valid bounds
- Document state invariants after string operations

Storage changes:
- Add constructor validation for file path parameters
- Validate data structure integrity for task lists
- Add file operation invariants for read/write operations
- Ensure task conversion maintains data integrity
- Add format validation for task string parsing
Add comprehensive Javadoc comments to improve code documentation:
- Add class-level documentation for Parser
- Document all public and private methods
- Specify input formats and validation rules
- Document error conditions and exceptions

No functional changes, documentation only.
* branch-Level-10:
  Add better gui and finish up level 10 design
  Initial commit
Parser accepts deadline command with empty date value after /by keyword.
This causes unexpected exceptions when processing the command.

Add validation check to ensure deadline date is provided.
This ensures proper error message instead of runtime exceptions.

Similar validation needed for event parameters in future commits.
* 'master' of github.com:HAITAO2003/ip:
  Update README.md
  Update README.md
  Update README.md
  Update README.md
DialogBox class lacks proper documentation for its functionality and components.
This makes it difficult for new developers to understand the code purpose and usage.

Add comprehensive JavaDoc comments to class, methods, and fields.
Documentation describes the purpose of each component without changing any existing code.

Improved documentation aids in code maintenance and facilitates better understanding
of the GUI dialog system implementation.
Event class date-time fields are mutable and could potentially be modified after creation.
This violates the principle of immutability and could lead to inconsistent state.

Make startDateTime and endDateTime fields final to ensure immutability.
This guarantees that event time data remains consistent throughout the object lifecycle.

The change is minimal but improves code robustness and maintainability.
MainWindow class lacks proper documentation of its UI components and functionality.
This makes it difficult for new developers to understand the controller's purpose and behavior.

Add comprehensive JavaDoc comments to class, fields, and methods.
Documentation clarifies the role of each UI component and method without changing any functionality.

Improved documentation enhances code maintainability and provides better understanding
of the main window controller's responsibilities in the Duke application.
Field-level JavaDoc comments are redundant and state the obvious.
These verbose comments add noise without providing meaningful information.

Remove excessive field-level JavaDoc comments while preserving method documentation.
This maintains meaningful documentation while improving code readability.

Class and method JavaDoc remain intact to preserve important contextual information.
Method uses type casting after instanceof checks to access subclass methods.
This approach is verbose and requires redundant type casting.

Implement pattern matching with instanceof to simplify variable handling.

The refactoring reduces code verbosity while maintaining the same functionality.
Storage class uses verbose lambda expressions, manual type casting, and has redundant assertions.
These patterns make the code unnecessarily verbose and harder to maintain.

Replace lambdas with method references, implement pattern matching, and remove redundant assertions.
This leverages Java's modern features for more concise code while maintaining necessary validations.

Code functionality remains identical while reducing verbosity and potential for errors.
Project lacks visual representation and documentation in standard location.
This makes it difficult for users to understand the application's appearance and usage.

Add GUI screenshot and README file to the docs directory.
This follows standard practice for GitHub documentation and improves project presentation.

Documentation in the proper location improves discoverability for new users and contributors.
fix link to release page
Application's mascot name "Duke" is generic and lacks personality.
A more distinctive name would enhance the user experience and brand identity.

Change mascot name from "Duke" to "Dumpling" throughout the application.
This includes updating UI text, documentation, and related references.

The new name adds uniqueness and character to the application while maintaining
the same functionality and user interaction patterns.
- Add Launcher class to properly initialize JavaFX application
- Update build.gradle to include platform-specific JavaFX dependencies
- Configure shadowJar plugin to package all dependencies in a single executable JAR
- Fix cross-platform compatibility issues for Windows, Mac, and Linux

Resolves issue with "JavaFX runtime components are missing" error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants