@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
|
boolean |
isVisible() |
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 |
setFractions(boolean fractions)
Enables showing fractions of a second
|
void |
setHours(boolean hours)
Enables showing hours and minutes
|
void |
setMinutes(boolean minutes)
Enables showing minutes
|
void |
setStartTime(Number startTime)
Sets the start time
|
void |
setVisible(boolean visible) |
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, onAttach, onDetach, onEnabledStateChanged, set, setElement, setIdclone, 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 setFractions(boolean fractions)
fractions - public void setMinutes(boolean minutes)
minutes - public void setHours(boolean hours)
hours - 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 - public boolean isVisible()
isVisible in class com.vaadin.flow.component.Componentpublic void setVisible(boolean visible)
setVisible in class com.vaadin.flow.component.ComponentCopyright © 2019–2020 Flowing Code. All rights reserved.