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

Add ability to reset CalendarPicker value to null #197

Merged
merged 2 commits into from
Jul 13, 2024

Conversation

leewyatt
Copy link
Contributor

leewyatt added 2 commits July 13, 2024 03:40
- Allow the CalendarPicker to reset its value to null, enabling the user to indicate no date selection.
The value binding for the CalendarPicker's text property is revised to handle null cases. Previously, there was no check for a null value which could have caused issues when no date was selected. Now, when the value is null, it displays "No Date Selected". Also, the order of the UI elements in the VBox has been adjusted for a better user experience.
Copy link

sonarcloud bot commented Jul 12, 2024

@@ -26,7 +26,7 @@ public void start(Stage stage) {
calendarPicker.setValue(LocalDate.now());

Label valueLabel = new Label();
valueLabel.textProperty().bind(Bindings.createStringBinding(() -> calendarPicker.getConverter().toString(calendarPicker.getValue()), calendarPicker.valueProperty()));
valueLabel.textProperty().bind(Bindings.createStringBinding(() -> calendarPicker.getValue() == null ? "No Date Selected" : calendarPicker.getConverter().toString(calendarPicker.getValue()), calendarPicker.valueProperty()));
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not a fan of having messages like that because it requires internationalisation.

@dlemmermann dlemmermann merged commit 01af033 into master Jul 13, 2024
4 checks passed
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.

2 participants