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

Space in MonthViewSkin is shown with a time and causes NPEs #206

Open
baumeister opened this issue Oct 9, 2023 · 1 comment
Open

Space in MonthViewSkin is shown with a time and causes NPEs #206

baumeister opened this issue Oct 9, 2023 · 1 comment

Comments

@baumeister
Copy link

When using the MonthView will full day event, fake helper entries are create to occupy space.
These entries will display with a time in the view:

image

See the 12:00 entries in the above image

These space entries are clickable and if done so, will cause an NPE because they don't belong to a calendar:

Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Cannot invoke "com.calendarfx.model.Calendar.readOnlyProperty()" because the return value of "com.calendarfx.model.Entry.getCalendar()" is null
at com.calendarfx.view.popover.EntryDetailsView.(EntryDetailsView.java:102)
at com.calendarfx.view.popover.EntryPopOverContentPane.(EntryPopOverContentPane.java:60)

However this issue can easily be resolved by setting them also to fullday:

So add the setFullDay line MonthViewSkin:update

                                          /*
            				 * Do not use factory for this. SPACE is important to guarantee that the blank
            				 * entries have the same height as the regular entries.
            				 */
            				MonthEntryView label = new MonthEntryView(new Entry<>(SPACE));
            				label.setVisible(false);
            				label.getEntry().setFullDay(true);
            				label.getProperties().put("control", getSkinnable());
            				fullDayNodes[i] = label;

Now the space item correctly shows as white space without a time, and is not clickable and does not cause NPEs.

@baumeister
Copy link
Author

For a test case, the same code can be used as mentioned here:

#193 (comment)

@baumeister baumeister changed the title Space in MonthView skin is shown with a time Space in MonthView skin is shown with a time and causes NPEs Oct 9, 2023
@baumeister baumeister changed the title Space in MonthView skin is shown with a time and causes NPEs Space in MonthViewSkin is shown with a time and causes NPEs Oct 9, 2023
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

No branches or pull requests

1 participant