Class OceanusDateConfig
java.lang.Object
io.github.tonywasher.joceanus.oceanus.date.OceanusDateConfig
- All Implemented Interfaces:
OceanusEventRegistrar.OceanusEventProvider<OceanusDateEvent>
public class OceanusDateConfig
extends Object
implements OceanusEventRegistrar.OceanusEventProvider<OceanusDateEvent>
Date Configuration.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAllow Null Date selection.capitaliseString(String pValue) Capitalise first letter of string.Obtain current date.formatDate(LocalDate pDate) Format a date according to configured rules.intObtain current day of month or zero if not current month.Get the current month.Get the earliest select-able date.intObtain Earliest day of month or zero if not current month.Obtain registration object for listeners.Get the latest select-able date.intObtain Latest day of month or zero if not current month.Get the locale.Get the selected date.intObtain Selected day of month or zero if not current month.voidInitialise the current month.booleanisAllowed(int pDay) Determine whether the day in the month is allowed.static booleanisDateChanged(OceanusDate pFirst, OceanusDate pSecond) Has the date changed?static booleanisSameMonth(OceanusDate pFirst, OceanusDate pSecond) Are the dates in the same month.static booleanisSameYear(OceanusDate pFirst, OceanusDate pSecond) Are the dates in the same year.voidAdjust current month to next month.voidnextYear()Adjust current month to next year.voidAdjust current month to previous month.voidAdjust current month to previous year.protected final voidRebuild names.voidsetAllowed(Predicate<OceanusDate> pAllowed) Set the Allowed predicate.voidsetAllowNullDateSelection(boolean pAllowNullDateSelection) Allow null date selection.final voidsetEarliestDate(OceanusDate pEarliest) Set the earliest date.final voidsetLatestDate(OceanusDate pLatest) Set the latest date.final voidSet the Locale.final voidsetSelectedDate(OceanusDate pDate) Set the selected date.voidsetSelectedDay(int pDay) Set selected day in current month (called from dialog).voidsetShowNarrowDays(boolean pShowNarrowDays) Show Narrow Days.booleanShow Narrow Days.
-
Constructor Details
-
OceanusDateConfig
Constructor.- Parameters:
pFormatter- the date formatter
-
-
Method Details
-
getEventRegistrar
Description copied from interface:OceanusEventRegistrar.OceanusEventProviderObtain registration object for listeners.- Specified by:
getEventRegistrarin interfaceOceanusEventRegistrar.OceanusEventProvider<OceanusDateEvent>- Returns:
- the registrar
-
getLocale
Get the locale.- Returns:
- the locale
-
getSelectedDate
Get the selected date.- Returns:
- the Selected date
-
getEarliestDate
Get the earliest select-able date.- Returns:
- the Earliest date
-
getLatestDate
Get the latest select-able date.- Returns:
- the Latest date
-
getCurrentMonth
Get the current month.- Returns:
- the current month
-
allowNullDateSelection
public boolean allowNullDateSelection()Allow Null Date selection.- Returns:
- true/false
-
showNarrowDays
public boolean showNarrowDays()Show Narrow Days.- Returns:
- true/false
-
setAllowed
Set the Allowed predicate.- Parameters:
pAllowed- the predicate
-
isAllowed
public boolean isAllowed(int pDay) Determine whether the day in the month is allowed.- Parameters:
pDay- the day of the current month- Returns:
- true/false
-
setLocale
Set the Locale.- Parameters:
pLocale- the Locale
-
setAllowNullDateSelection
public void setAllowNullDateSelection(boolean pAllowNullDateSelection) Allow null date selection. If this flag is set an additional button will be displayed allowing the user to explicitly select no date, thus setting the SelectedDate to null.- Parameters:
pAllowNullDateSelection- true/false
-
setShowNarrowDays
public void setShowNarrowDays(boolean pShowNarrowDays) Show Narrow Days. If this flag is set Days are show in narrow rather than short form.- Parameters:
pShowNarrowDays- true/false
-
rebuildNames
protected final void rebuildNames()Rebuild names. -
setEarliestDate
Set the earliest date. This is the earliest date that may be selected. If the configured latest date is earlier than this date, it will be set to this date to ensure a valid range.- Parameters:
pEarliest- the Earliest select-able date (or null if unlimited)
-
setLatestDate
Set the latest date. This is the latest date that may be selected. If the configured earliest date is later than this date, it will be set to this date to ensure a valid range.- Parameters:
pLatest- the Latest select-able date (or null if unlimited)
-
formatDate
Format a date according to configured rules.- Parameters:
pDate- the date to format- Returns:
- the formatted date
-
capitaliseString
Capitalise first letter of string.- Parameters:
pValue- the string to capitalise the first letter of- Returns:
- the capitalised string
-
currentDate
Obtain current date.- Returns:
- the current date
-
getCurrentDay
public int getCurrentDay()Obtain current day of month or zero if not current month.- Returns:
- the current month day
-
getSelectedDay
public int getSelectedDay()Obtain Selected day of month or zero if not current month.- Returns:
- the selected month day
-
getEarliestDay
public int getEarliestDay()Obtain Earliest day of month or zero if not current month.- Returns:
- the earliest month day
-
getLatestDay
public int getLatestDay()Obtain Latest day of month or zero if not current month.- Returns:
- the latest month day
-
previousMonth
public void previousMonth()Adjust current month to previous month. -
nextMonth
public void nextMonth()Adjust current month to next month. -
previousYear
public void previousYear()Adjust current month to previous year. -
nextYear
public void nextYear()Adjust current month to next year. -
setSelectedDate
Set the selected date.- Parameters:
pDate- the Selected date
-
setSelectedDay
public void setSelectedDay(int pDay) Set selected day in current month (called from dialog).- Parameters:
pDay- the selected day
-
initialiseCurrent
public void initialiseCurrent()Initialise the current month. -
isDateChanged
Has the date changed?- Parameters:
pFirst- the first datepSecond- the second date- Returns:
true/false
-
isSameMonth
Are the dates in the same month.- Parameters:
pFirst- the first date (maybe null)pSecond- the second date- Returns:
- true/false
-
isSameYear
Are the dates in the same year.- Parameters:
pFirst- the first date (maybe null)pSecond- the second date- Returns:
- true/false
-