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 Classes
    Modifier and Type
    Class
    Description
    static class 
    Event that is sent when the timer is stopped by invoking the stop() method.
    static class 
    Event that is sent after the specified time interval in the delay attribute has passed since the timer started.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final String
     
    protected static final String
     
    protected static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.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
     
    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
    Starts the timer if it is not running.
    void
    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

  • 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 to true, the timer runs in cycles at equal intervals defined in the delay attribute. Otherwise, the timer runs only once after the timeout specified in the delay attribute after the timer start. The Default value is false.
      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 to true, the timer starts immediately after the view opening. The default value is false, which means that the timer will start only when its start() 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