Class Date
- java.lang.Object
-
- ch.sahits.game.openpatrician.model.Date
-
- All Implemented Interfaces:
ch.sahits.game.openpatrician.utilities.IInvalidatable
@Component public class Date extends java.lang.Object implements ch.sahits.game.openpatrician.utilities.IInvalidatableRepresentation of the date within the game. This class is thread safe. The Date is implemented as a singleton. However there is no getInstance method to retrieve the once created instance, so it must be referenced elsewhere.- Author:
- Andi Hotz, (c) Sahits GmbH, 2011 Created on Sep 16, 2011
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_INVALID_START_YEAR
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javafx.beans.binding.StringBindingdayDateBinding()Bind the representation of the day as a String.java.time.LocalDateTimegetCurrentDate()Retrieve the immutable DateTimejavafx.beans.property.ObjectProperty<java.time.LocalDateTime>getCurrentDateProperty()Retrieve the immutable DateTimevoidinvalidate()voidresetStartYear(int startYear)voidsetStartYear(int startYear)voidsetTickUpdate(int minutes)Set the tick update in number of minutesvoidupdateTime(java.time.LocalDateTime newTime)Change the time.
-
-
-
Field Detail
-
DEFAULT_INVALID_START_YEAR
public static final int DEFAULT_INVALID_START_YEAR
- See Also:
- Constant Field Values
-
-
Method Detail
-
resetStartYear
public void resetStartYear(int startYear)
-
setStartYear
public void setStartYear(int startYear)
-
updateTime
public void updateTime(java.time.LocalDateTime newTime)
Change the time.- Parameters:
newTime- new time
-
setTickUpdate
public void setTickUpdate(int minutes)
Set the tick update in number of minutes- Parameters:
minutes- tick update
-
dayDateBinding
public javafx.beans.binding.StringBinding dayDateBinding()
Bind the representation of the day as a String.- Returns:
- string binding for the current date
- See Also:
ModelTranslations.toDisplayString(LocalDateTime)
-
getCurrentDate
public java.time.LocalDateTime getCurrentDate()
Retrieve the immutable DateTime- Returns:
- current date
-
getCurrentDateProperty
public javafx.beans.property.ObjectProperty<java.time.LocalDateTime> getCurrentDateProperty()
Retrieve the immutable DateTime- Returns:
- observable of the current date,
-
invalidate
public void invalidate()
- Specified by:
invalidatein interfacech.sahits.game.openpatrician.utilities.IInvalidatable
-
-