Class JmixTimer
java.lang.Object
com.vaadin.flow.component.Component
io.jmix.flowui.kit.component.timer.JmixTimer
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasStyle,Serializable
@Tag("jmix-timer")
@JsModule("./src/timer/jmix-timer.js")
public class JmixTimer
extends com.vaadin.flow.component.Component
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEvent that is sent when the timer is stopped by invoking thestop()method.static classEvent that is sent after the specified time interval in thedelayattribute has passed since the timer started. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddActionListener(com.vaadin.flow.component.ComponentEventListener<JmixTimer.JmixTimerTickEvent> listener) Adds an action listener.com.vaadin.flow.shared.RegistrationaddStopListener(com.vaadin.flow.component.ComponentEventListener<JmixTimer.JmixTimerStopEvent> listener) Adds timer stop listener.intgetDelay()booleanbooleanvoidsetAutostart(boolean autostart) Sets whether to start the timer automatically.voidsetDelay(int delay) Sets timer interval in milliseconds.voidsetRepeating(boolean repeating) Sets whether repeated executions of the timer are turned on.voidstart()Starts the timer if it is not running.voidstop()Stops timer if it is running.Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Field Details
-
DELAY_PROPERTY_NAME
- See Also:
-
REPEATING_PROPERTY_NAME
- See Also:
-
AUTOSTART_PROPERTY_NAME
- See Also:
-
-
Constructor Details
-
JmixTimer
public JmixTimer()
-
-
Method Details
-
isRepeating
public boolean isRepeating()- Returns:
trueif repeated executions are enabled,falseotherwise
-
setRepeating
public void setRepeating(boolean repeating) Sets whether repeated executions of the timer are turned on. If the attribute is set totrue, the timer runs in cycles at equal intervals defined in thedelayattribute. Otherwise, the timer runs only once after the timeout specified in thedelayattribute after the timer start. The Default value isfalse.- Parameters:
repeating-trueto enable repeated executions,falseotherwise
-
getDelay
public int getDelay()- Returns:
- timer interval in milliseconds
-
setDelay
public void setDelay(int delay) Sets timer interval in milliseconds.- Parameters:
delay- timer interval in milliseconds
-
isAutostart
public boolean isAutostart()- Returns:
- whether the timer starts automatically
-
setAutostart
public void setAutostart(boolean autostart) Sets whether to start the timer automatically. When it is set totrue, the timer starts immediately after the view opening. The default value isfalse, which means that the timer will start only when itsstart()method is invoked.- Parameters:
autostart- whether to start the timer automatically
-
start
public void start()Starts the timer if it is not running. -
stop
public void stop()Stops timer if it is running. -
addActionListener
public com.vaadin.flow.shared.Registration addActionListener(com.vaadin.flow.component.ComponentEventListener<JmixTimer.JmixTimerTickEvent> listener) Adds an action listener.- Parameters:
listener- a listener to add- Returns:
- a registration handle to remove the listener
-
addStopListener
public com.vaadin.flow.shared.Registration addStopListener(com.vaadin.flow.component.ComponentEventListener<JmixTimer.JmixTimerStopEvent> listener) Adds timer stop listener.- Parameters:
listener- a listener to add- Returns:
- a registration handle to remove the listener
-