-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add support for class name generator for InlineDatePicker #92
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
Conversation
WalkthroughThis pull request updates the project’s build configuration and several code components. The project version in Changes
Suggested reviewers
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/test/java/com/flowingcode/addons/ycalendar/YearI18NDemo.java (1)
55-61
: Demonstration of Class Name Generator Feature
Within the conditional block (using the//#if vaadin eq 0
directive), the demo sets a class name generator on the calendar component. This generator assigns the"weekend"
class for Saturdays and Sundays, illustrating the new feature support. Ensure that usage of this generator (particularly its integration with the InlineDatePicker component) is documented and thoroughly tested in real-world scenarios.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (30)
pom.xml
(2 hunks)src/main/java/com/flowingcode/addons/ycalendar/AbstractCalendarComponent.java
(1 hunks)src/main/java/com/flowingcode/addons/ycalendar/DateSelectedEvent.java
(1 hunks)src/main/java/com/flowingcode/addons/ycalendar/InlineDatePicker.java
(5 hunks)src/main/java/com/flowingcode/addons/ycalendar/MonthCalendar.java
(4 hunks)src/main/java/com/flowingcode/addons/ycalendar/YearCalendar.java
(3 hunks)src/main/java/com/flowingcode/addons/ycalendar/YearChangedEvent.java
(1 hunks)src/main/java/com/flowingcode/addons/ycalendar/YearMonthField.java
(1 hunks)src/main/resources/META-INF/frontend/fc-inline-date-picker/fc-inline-date-picker.js
(2 hunks)src/main/resources/META-INF/frontend/fc-month-calendar/fc-month-calendar.js
(1 hunks)src/main/resources/META-INF/frontend/fc-month-calendar/month-calendar-mixin.js
(1 hunks)src/main/resources/META-INF/frontend/fc-year-calendar/fc-calendar-utils.js
(1 hunks)src/main/resources/META-INF/frontend/fc-year-calendar/fc-year-calendar.js
(1 hunks)src/main/resources/META-INF/frontend/fc-year-month-field/fc-year-month-field.js
(1 hunks)src/test/java/com/flowingcode/addons/ycalendar/DemoView.java
(1 hunks)src/test/java/com/flowingcode/addons/ycalendar/InlineDatePickerDemo.java
(3 hunks)src/test/java/com/flowingcode/addons/ycalendar/LocaleSelector.java
(1 hunks)src/test/java/com/flowingcode/addons/ycalendar/MonthDemo.java
(1 hunks)src/test/java/com/flowingcode/addons/ycalendar/TestUtils.java
(2 hunks)src/test/java/com/flowingcode/addons/ycalendar/YearDemo.java
(1 hunks)src/test/java/com/flowingcode/addons/ycalendar/YearI18NDemo.java
(1 hunks)src/test/java/com/flowingcode/addons/ycalendar/YearMonthCalendarDemoView.java
(1 hunks)src/test/java/com/flowingcode/addons/ycalendar/YearMonthFieldDemo.java
(1 hunks)src/test/java/com/flowingcode/addons/ycalendar/YearReadonlyDemo.java
(1 hunks)src/test/java/com/flowingcode/addons/ycalendar/it/AbstractViewTest.java
(1 hunks)src/test/java/com/flowingcode/addons/ycalendar/it/ViewIT.java
(1 hunks)src/test/java/com/flowingcode/addons/ycalendar/test/SerializationTest.java
(1 hunks)src/test/java/com/flowingcode/vaadin/addons/DemoLayout.java
(1 hunks)src/test/resources/META-INF/frontend/styles/test_year-month-calendar.css
(1 hunks)src/test/resources/META-INF/frontend/styles/ycalendar-styles.css
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build-vaadin24
🔇 Additional comments (47)
src/test/resources/META-INF/frontend/styles/test_year-month-calendar.css (1)
5-5
: Consistent Copyright Update
The updated notice now correctly reflects the extended period ("2021 - 2025"). No functional changes were made in this CSS file, and the update is consistent with other files in the project.src/main/resources/META-INF/frontend/fc-year-calendar/fc-year-calendar.js (1)
5-6
: Metadata Update Confirmation
The copyright notice has been updated from "2021 - 2023" (or similar previous range) to "2021 - 2025", ensuring consistency across the project.src/test/java/com/flowingcode/addons/ycalendar/YearI18NDemo.java (1)
1-6
: Header Update Consistency
The copyright header is updated to "2021 - 2025", which aligns with the recent metadata updates across multiple files.src/test/java/com/flowingcode/addons/ycalendar/it/ViewIT.java (1)
1-6
: Consistent Copyright Notice Update
The header now reflects the updated copyright period ("2021 - 2025"). As this change is purely metadata, no further action is required.src/test/java/com/flowingcode/addons/ycalendar/LocaleSelector.java (1)
1-6
: Alignment of Copyright Metadata
The copyright notice in this file has been extended to "2021 - 2025", which maintains consistency with the overall project update.src/test/java/com/flowingcode/vaadin/addons/DemoLayout.java (1)
5-5
: Update Copyright Notice
The copyright line has been updated to "Copyright (C) 2021 - 2025 Flowing Code". This metadata change is consistent with other updates in the project and does not affect functionality.src/test/java/com/flowingcode/addons/ycalendar/MonthDemo.java (1)
5-5
: Update Copyright Notice
The copyright notice has been extended to 2025 to reflect the updated period.src/main/resources/META-INF/frontend/fc-month-calendar/fc-month-calendar.js (1)
5-5
: Maintain Consistent Copyright Update
The diff updates the copyright statement to "Copyright (C) 2021 - 2025 Flowing Code". No functional changes are introduced in this file.src/test/java/com/flowingcode/addons/ycalendar/YearMonthCalendarDemoView.java (1)
5-5
: Update Copyright Notice
The copyright range in the header has been updated to "2021 - 2025 Flowing Code". This is a straightforward metadata update that aligns with project-wide consistency.src/main/resources/META-INF/frontend/fc-year-calendar/fc-calendar-utils.js (1)
5-5
: Update Copyright Notice
The copyright header now reflects "Copyright (C) 2021 - 2025 Flowing Code". There is no impact on the functionality of theformatDate
utility.src/test/java/com/flowingcode/addons/ycalendar/test/SerializationTest.java (1)
5-5
: Update Copyright NoticeThe copyright header was updated to extend the year range to 2025. This is a metadata update only and does not impact the test or serialization functionality.
src/main/resources/META-INF/frontend/fc-year-month-field/fc-year-month-field.js (1)
5-5
: Update Copyright NoticeThe copyright comment now correctly reflects the extended period (2021 - 2025). This change is purely informational and does not affect the component functionality.
src/main/java/com/flowingcode/addons/ycalendar/DateSelectedEvent.java (1)
5-5
: Update Copyright NoticeThe change in the copyright header—from "2021 - 2023" to "2021 - 2025"—ensures consistency with the project's updated metadata. No functional aspects are impacted.
src/main/java/com/flowingcode/addons/ycalendar/YearChangedEvent.java (1)
5-5
: Update Copyright NoticeThe copyright notice has been updated to extend the range to 2025. This is a simple metadata update and does not affect the event logic or API.
src/main/resources/META-INF/frontend/fc-month-calendar/month-calendar-mixin.js (1)
5-5
: Update Copyright NoticeThe copyright information in the header now reflects "2021 - 2025". As with the other files, this is a metadata update that does not impact functionality or styling.
src/main/java/com/flowingcode/addons/ycalendar/YearMonthField.java (1)
5-5
: Metadata Update – Copyright Header ChangeThe header now reflects "Copyright (C) 2021 - 2025 Flowing Code". This is a coordinated metadata refresh across the project and does not impact functionality.
src/test/java/com/flowingcode/addons/ycalendar/it/AbstractViewTest.java (1)
5-5
: Metadata Update – Copyright Header RefreshThe updated header showing "2021 - 2025" ensures consistency with the project’s branding. This change is purely informational.
src/test/java/com/flowingcode/addons/ycalendar/YearReadonlyDemo.java (1)
5-5
: Metadata Update – License Header RevisionThe revision in the header to "Copyright (C) 2021 - 2025 Flowing Code" aligns with the project-wide update. No functionality is affected.
src/test/java/com/flowingcode/addons/ycalendar/YearMonthFieldDemo.java (1)
5-5
: Metadata Update – Uniform Header UpdateThe license header in this file has been updated to "2021 - 2025", matching the rest of the project. This is a non-functional update.
src/main/java/com/flowingcode/addons/ycalendar/AbstractCalendarComponent.java (1)
5-5
: Metadata Update – Revised Copyright NoticeThe header now presents "Copyright (C) 2021 - 2025 Flowing Code". This update is consistent across multiple files and does not introduce any changes to functionality.
src/test/java/com/flowingcode/addons/ycalendar/YearDemo.java (1)
5-5
: Copyright year updated appropriately.The copyright year has been extended to 2025, which aligns with the project's ongoing development and maintenance.
src/test/java/com/flowingcode/addons/ycalendar/DemoView.java (1)
5-5
: Copyright year updated correctly.The copyright notice has been extended to include 2025, consistent with the project's active development.
src/test/resources/META-INF/frontend/styles/ycalendar-styles.css (1)
5-5
: Copyright year updated appropriately.The copyright year range has been extended to 2025, maintaining consistency with other files in the project.
src/test/java/com/flowingcode/addons/ycalendar/TestUtils.java (2)
5-5
: Copyright year updated correctly.The copyright notice has been extended to include 2025, consistent with other files in the project.
70-74
: Holiday dates for 2025 added appropriately.Five new holiday dates for 2025 have been added to the HOLIDAYS set, ensuring the calendar will properly display holidays for the upcoming year. This proactively maintains the utility's functionality for future dates.
pom.xml (3)
7-7
: Version increment aligns with semantic versioningThe version increase from 4.3.2-SNAPSHOT to 4.4.0-SNAPSHOT follows semantic versioning principles, correctly indicating a minor version bump for the new feature being added (class name generator for InlineDatePicker).
210-210
: Added exclusion pattern for generated filesAdding "/main/dev-bundle/" to the exclusion patterns for the license plugin prevents it from adding license headers to generated files in the dev-bundle directory, which is appropriate since these files are machine-generated.
204-204
:✅ Verification successful
Updated license-maven-plugin to a newer version
The license-maven-plugin has been updated from version 1.14 to 2.3.0, which is a significant version jump. This update likely provides bug fixes and new features for license management.
🏁 Script executed:
#!/bin/bash # Check release dates and release notes for license-maven-plugin versions curl -s "https://search.maven.org/solrsearch/select?q=g:org.codehaus.mojo+AND+a:license-maven-plugin+AND+v:2.3.0&rows=20&wt=json" | jq '.response.docs[0]'Length of output: 628
License Maven Plugin Update Verified
- The updated version in
pom.xml
is now<version>2.3.0</version>
, confirming the switch from 1.14 to 2.3.0.- The Maven Central query indicates that version 2.3.0 is valid and available, suggesting added bug fixes and features for improved license management.
src/test/java/com/flowingcode/addons/ycalendar/InlineDatePickerDemo.java (3)
5-5
: Updated copyright yearThe copyright year has been updated to include 2025, maintaining compliance with intellectual property requirements.
27-27
: Added import for DayOfWeek enumAdded necessary import for the DayOfWeek enum which is used in the new class name generator implementation.
46-54
: Implemented class name generator for InlineDatePickerThe implementation adds visual distinction for weekends and holidays in the calendar by assigning specific CSS class names. This directly addresses the feature requested in issue #91.
The class name generator follows a clear, logical pattern:
- "weekend" for Saturdays and Sundays
- "holiday" for public holidays (as determined by TestUtils.isPublicHoliday)
- null for regular weekdays
This approach provides good customization flexibility while maintaining clear semantics.
src/main/java/com/flowingcode/addons/ycalendar/YearCalendar.java (3)
5-5
: Updated copyright yearThe copyright year has been updated to include 2025, maintaining compliance with intellectual property requirements.
33-33
: Added import for Optional classAdded necessary import for the java.util.Optional class which is used in the refactored refreshItem method.
98-99
: Refactored className generation using OptionalThe code has been refactored to use Optional.ofNullable instead of a conditional check, making it more concise and readable while maintaining the same functionality.
This functional programming approach reduces the risk of null pointer exceptions and follows modern Java best practices. The change also maintains consistency with similar implementations in other calendar components.
src/main/resources/META-INF/frontend/fc-inline-date-picker/fc-inline-date-picker.js (3)
5-5
: Updated copyright yearThe copyright year has been updated to include 2025, maintaining compliance with intellectual property requirements.
94-96
: Enhanced month change handler with event dispatchingThe __onDisplayMonthChange method has been improved to:
- Store the yearMonth value in a variable for better clarity
- Dispatch a "month-change" event with the yearMonth value
This change enables the Java InlineDatePicker component to track the currently displayed month, which is essential for the class name generator functionality when refreshing calendar items.
103-109
: Added day styling methods to support class name generatorTwo new methods have been added that delegate to the underlying month calendar component:
- _setStyleForDay: Applies a CSS class to a specific day
- _clearEmptyDaysStyle: Removes styling from empty days
These methods are crucial for implementing the class name generator functionality, allowing the InlineDatePicker to apply custom styling to specific dates (weekends, holidays, etc.).
src/main/java/com/flowingcode/addons/ycalendar/MonthCalendar.java (3)
5-5
: Updated copyright year.Copyright year has been extended to 2025.
125-127
: Improved code with stream operations.The refactoring of the
refreshAll
method using streams is a good improvement that simplifies the code and makes it more maintainable. This approach is more concise than the previous implementation using a loop.
139-143
: Improved null handling with Optional.Using
Optional.ofNullable
is a clean approach to handle potential null values from the class name generator. This simplifies the code while maintaining the same functionality.src/main/java/com/flowingcode/addons/ycalendar/InlineDatePicker.java (7)
47-49
: Added fields to support class name generation.New private fields
classNameGenerator
andyearMonth
provide the foundation for the class name generation feature, allowing customized styling of calendar days.
60-62
: Added event listener to track month changes.The month-change event listener ensures the component's internal state stays synchronized with the UI, which is essential for correctly applying styles when the user navigates between months.
106-109
: Added class name generator API.The
setClassNameGenerator
method provides a clean API for setting custom styling logic, following the same pattern used in other Vaadin components. The immediate call torefreshAll()
ensures styles are applied without requiring additional user action.
112-117
: Implemented style refresh functionality.The
refreshAll
method efficiently updates styles for all days in the current month using a stream operation, maintaining consistency with the implementation inMonthCalendar
.
124-131
: Added item-specific refresh method.The
refreshItem
method allows for targeted style updates of individual dates, with proper validation to ensure the date belongs to the current month and year. UsingOptional
for handling potentially null class name generators is a good practice.
133-138
: Enhanced setValue to maintain state consistency.The overridden
setValue
method ensures that theyearMonth
field is updated when a new date is set, maintaining consistency between the selected date and the displayed month. The null check adds robustness.
140-146
: Added helper method for month updates.The private
setYearMonth
method centralizes the logic for updating the month state and refreshing the display, with an optimization to avoid unnecessary refreshes when the month hasn't changed.
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.
LGTM
Close #91
Summary by CodeRabbit