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 class
Event that is sent when the timer is stopped by invoking thestop()
method.static class
Event that is sent after the specified time interval in thedelay
attribute has passed since the timer started. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.Registration
addActionListener
(com.vaadin.flow.component.ComponentEventListener<JmixTimer.JmixTimerTickEvent> listener) Adds an action listener.com.vaadin.flow.shared.Registration
addStopListener
(com.vaadin.flow.component.ComponentEventListener<JmixTimer.JmixTimerStopEvent> listener) Adds timer stop listener.int
getDelay()
boolean
boolean
void
setAutostart
(boolean autostart) Sets whether to start the timer automatically.void
setDelay
(int delay) Sets timer interval in milliseconds.void
setRepeating
(boolean repeating) Sets whether repeated executions of the timer are turned on.void
start()
Starts the timer if it is not running.void
stop()
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, setVisible
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
Methods 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:
true
if repeated executions are enabled,false
otherwise
-
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 thedelay
attribute. Otherwise, the timer runs only once after the timeout specified in thedelay
attribute after the timer start. The Default value isfalse
.- Parameters:
repeating
-true
to enable repeated executions,false
otherwise
-
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
-