-
Notifications
You must be signed in to change notification settings - Fork 58
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
Update EnhancedPasswordField functionality and styling #185
Conversation
The EnhancedPasswordField class and its usage have been updated to include CSS pseudo classes for displaying the password. The creation of a simple password field has been simplified to remove unnecessary methods and use better-suited CSS styles for handling the visibility of the password. Moreover, the icon used to toggle the visibility of the password has been changed to be defined in CSS rather than directly in the Java code.
Switched the listener on showPasswordProperty to a subscribe method in the 'EnhancedPasswordField' class. This change promotes cleaner code structure and improves the readability of the EnhancedPasswordField component's code.
gemsfx/src/main/resources/com/dlsc/gemsfx/enhanced-password-field.css
Outdated
Show resolved
Hide resolved
gemsfx/src/main/java/com/dlsc/gemsfx/EnhancedPasswordField.java
Outdated
Show resolved
Hide resolved
The UI elements for EnhancedPasswordField were updated, specifically replacing a FontIcon with a Region, and modifying the CSS styling for these elements. Additionally, toggle functionality was modified to handle mouse click events correctly.
The clickOnNode method in the UIUtil class has been refactored to check if a mouse event is either a single or a multiple primary button click. An overloaded version of the method now accepts a boolean parameter to specify whether the event should be a single click or not. Additionally, minor fixes were done in the comments and format in UIUtil class. The method MouseClicked in EnhancedPasswordField.java was also modified to utilize the new clickOnNode method.
gemsfx/src/main/java/com/dlsc/gemsfx/EnhancedPasswordField.java
Outdated
Show resolved
Hide resolved
This commit renamed the "showing" pseudo class to "showing-password" in the EnhancedPasswordField class. The related CSS rules have been updated accordingly. This naming change provides a clearer understanding of the class's function.
Replaced the setOnMouseClicked event handler with a MOUSE_PRESSED event handler in the EnhancedPasswordField class. This will prevent unwanted event propagation when the rightWrapper node is clicked. Added event.consume() to ensure the event is fully processed.
|
* @return {@code true} if the event is a stable primary button click, {@code false} otherwise. | ||
* @throws NullPointerException if the event is null. | ||
*/ | ||
public static boolean clickOnNode(MouseEvent event, boolean isSingleClick) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"isStillSincePressed" can never be "still". "still" means that the mouse has not been moved between the last two pressed events.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your guidance. After testing, it turned out to be exactly as you said. If it is a mouse press or release, the first triggered event always returns false for isStillSincePress.
The EnhancedPasswordField class and its usage have been updated to include CSS pseudo classes for displaying the password. The creation of a simple password field has been simplified to remove unnecessary methods and use better-suited CSS styles for handling the visibility of the password. Moreover, the icon used to toggle the visibility of the password has been changed to be defined in CSS rather than directly in the Java code.