Skip to content

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

@baumeister

Description

@baumeister

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions