@Tag(value="simple-timer")
@JsModule(value="./simple-timer/simple-timer.js")
public class SimpleTimer
extends com.vaadin.flow.component.Component
implements com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle
| Modifier and Type | Class and Description |
|---|---|
static class |
SimpleTimer.TimerEndedEvent
Event that gets triggered when the timer reaches 0
|
| Constructor and Description |
|---|
SimpleTimer()
Creates a timer with a start time of 60
|
SimpleTimer(Number startTime)
Creates a timer using the start time passed in the constructor
|
| Modifier and Type | Method and Description |
|---|---|
com.vaadin.flow.shared.Registration |
addTimerEndEvent(com.vaadin.flow.component.ComponentEventListener<SimpleTimer.TimerEndedEvent> listener)
Adds a timer ended listener that will be triggered when the timer reaches 0
|
BigDecimal |
getCurrentTime()
Returns the current value of the timer
|
boolean |
isRunning()
Returns the status of the timer
|
void |
pause()
Stops the timer, does nothing if already stopped
|
void |
reset()
Resets the current value to the start time
|
void |
setCountUp(boolean countUp)
Changes the behavior to count up or down Default is false for count down
|
void |
setStartTime(Number startTime)
Sets the start time
|
void |
start()
Starts or stops the timer if it is already started
|
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetHeight, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, setHeight, setHeightFull, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidthFullpublic SimpleTimer()
public SimpleTimer(Number startTime)
startTime - value in seconds for the start timepublic void setStartTime(Number startTime)
startTime - value in seconds for the start timepublic void setCountUp(boolean countUp)
countUp - public void start()
public void pause()
public void reset()
@Synchronize(property="isRunning",
value="is-running-changed")
public boolean isRunning()
@Synchronize(value="current-time-changed") public BigDecimal getCurrentTime()
public com.vaadin.flow.shared.Registration addTimerEndEvent(com.vaadin.flow.component.ComponentEventListener<SimpleTimer.TimerEndedEvent> listener)
listener - Copyright © 2019–2020 Flowing Code. All rights reserved.