localDateTimeRangeCallback
The user is allowed to navigate through all eternity.
So if there are many possible meaningful dates, all have to be fetched and populated in the localDateTimes, disabledCalenders and highlightedLocalDateTimes lists.
This could become quite a performance and memory issue.
In order to deal with this situation, the localDateTimeRangeCallback property can be used.
The localDateTimeRangeCallback is called each time a different range is shown in the picker and the LocalDateTimeRange parameter has the begin and end of the range that is going to be shown.
By registering to the localDateTimeRangeCallback, it is possible to populate the lists with the values relevant to the range.
Example
LocalDateTimePicker.setLocalDateTimeRangeCallback( (range) -> {
localDateTimePicker.disabledCalenders().clear;
localDateTimePicker.disabledCalenders.addAll( BusinessModel.findDisabledLocalDateTimesIn(range.getStartLocalDateTime(), range.getEndLocalDateTime() );
});
valueValidationCallback
Using the disabledLocalDateTimes collection only makes sense in non-time mode.
When time is shown, a lot of possibles times (up to milliseconds) can be selected on a single date, so populating the disabledLocalDateTimes list with all possible values is practically impossible.
To still be able to prevent certain LocalDateTimes to be selected, the valueValidationCallback is an alternative.
It allows, prior to a LocalDateTime being selected, to check if it is allowed.
Example
LocalDateTimePicker.valueValidationCallback( (localDateTime) -> {
if (some_condition(localDateTime)) {
return false;
}
return true;
});