Top Description Fields Constructors Methods
com.dlsc.gemsfx.daterange

public Class DateRangePreset

extends Object
Class Inheritance
Imports
java.util.Objects, java.util.function.Supplier

A date range preset is used to populate the "presets" area with the DateRangeView control. Users can click on a preset, e.g. "last week" to automatically select the date range that represents last week.

Presets have to be implemented in such a way that they return the correct date range at any time, meaning the dates can not be fixed at the time of the creation of the date range, but they have to be computed on-the-fly. The UI might have been up and running for several days, hence the meaning of "last week" might have changed.

Field Summary

Modifier and TypeField and Description
private final Supplier<DateRange>
private final String

Constructor Summary

AccessConstructor and Description
public
DateRangePreset(String
the title / name of the preset, e.g. "last week"
title
,
Supplier<DateRange>
the supplier returning the date range object for the preset
dateRangeSupplier
)

Constructs a new date range preset with the given title and date range supplier.

Method Summary

Modifier and TypeMethod and Description
public final Supplier<DateRange>
public final String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dateRangeSupplierback to summary
private final Supplier<DateRange> dateRangeSupplier
titleback to summary
private final String title

Constructor Detail

DateRangePresetback to summary
public DateRangePreset(String title, Supplier<DateRange> dateRangeSupplier)

Constructs a new date range preset with the given title and date range supplier. The supplier will be used to retrieve the date range on-the-fly when the user clicks on the preset.

Parameters
title:String

the title / name of the preset, e.g. "last week"

dateRangeSupplier:Supplier<DateRange>

the supplier returning the date range object for the preset

Method Detail

getDateRangeSupplierback to summary
public final Supplier<DateRange> getDateRangeSupplier()
getTitleback to summary
public final String getTitle()