use of eu.hansolo.tilesfx.events.TimeEvent in project tilesfx by HanSolo.
the class Tile method tick.
private void tick() {
Platform.runLater(() -> {
ZonedDateTime oldTime = getTime();
setTime(getTime().plus(java.time.Duration.ofMillis(updateInterval)));
ZonedDateTime now = time.get();
if (isAlarmsEnabled())
checkAlarms(now);
if (getCheckSectionsForValue() && timeSections != null) {
for (TimeSection timeSection : timeSections) {
timeSection.checkForTimeAndDate(now);
}
}
if (timeEventListeners.isEmpty())
return;
// Fire TimeEvents
if (oldTime.getSecond() != now.getSecond())
fireTimeEvent(new TimeEvent(Tile.this, now, TimeEventType.SECOND));
if (oldTime.getMinute() != now.getMinute())
fireTimeEvent(new TimeEvent(Tile.this, now, TimeEventType.MINUTE));
if (oldTime.getHour() != now.getHour())
fireTimeEvent(new TimeEvent(Tile.this, now, TimeEventType.HOUR));
});
}
Aggregations