localDateRangeCallback
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 localDates, disabledCalenders and highlightedLocalDates lists.
This could become quite a performance and memory issue.
In order to deal with this situation, the localDateRangeCallback property can be used.
The localDateRangeCallback is called each time a different range is shown in the picker and the LocalDateRange parameter has the begin and end of the range that is going to be shown.
By registering to the localDateRangeCallback, it is possible to populate the lists with the values relevant to the range.
Example
localDatePicker.setLocalDateRangeCallback( (range) -> {
localDatePicker.disabledCalenders().clear;
localDatePicker.disabledCalenders.addAll( BusinessModel.findDisabledLocalDatesIn(range.getStartLocalDate(), range.getEndLocalDate() );
});
valueValidationCallback
Using the disabledLocalDates 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 disabledLocalDates list with all possible values is practically impossible.
To still be able to prevent certain LocalDates to be selected, the valueValidationCallback is an alternative.
It allows, prior to a LocalDate being selected, to check if it is allowed.
Example
localDatePicker.valueValidationCallback( (localDate) -> {
if (some_condition(localDate)) {
return false;
}
return true;
});