How to change week of calender?

11 views
Skip to first unread message

Nat569On

unread,
Jan 22, 2022, 6:22:49 AM1/22/22
to JFXtras Developers
I'm using VCalender and VCalenderAgenda but I can't see any way to change the week that is currently being displayed?

tbee

unread,
Jan 22, 2022, 6:26:46 AM1/22/22
to JFXtras Developers
If memory serves, ICalendarAgenda extends Agenda, and that has a setDisplayedCalendar/setDisplayedLocalDateTime. That will be used to tell the presentation (skin) to show a different time range.

tbee

unread,
Jan 22, 2022, 7:33:18 AM1/22/22
to JFXtras Developers

NB; the reason why a value with a time is used (Calendar and LocalDateTime both have time) is that Agenda does not know what the skin needs. The most used week based skin only uses date, but maybe a skin is active that shows just a few hours of a day, and then time is relevant.

Nat569On

unread,
Jan 22, 2022, 2:27:54 PM1/22/22
to JFXtras Developers
Yes that works, thanks. Another question: Is there a way to make it so that appointments cannot overlap?

tbee

unread,
Jan 22, 2022, 2:38:29 PM1/22/22
to JFXtras Developers
Hm... The answer would be maybe, but no. Not as a drawing constraint while changing stuff in Agenda. But if you were using Agenda itself, then you are in control of the appointment implementation. Appointment is only an interface and Agenda itself only requires instances of a class that implements that interface. So it is possible to override the setEndTime(Calendar), and then check all other appointments and then decide to accept that value or not (and show an error). Not perfect but maybe close enough.

However, VCalendarAgenda has its own classes implementing Appointment, so there it is not possible to "get a finger in between".

I think it would not be that difficult to add a callback to Agenda, which is called when modifying an appointment, but the behavior of when that callback returns "not allowed" would be tricky.

So: no.
Reply all
Reply to author
Forward
0 new messages