Package com.storedobject.vaadin
Class TimerComponent
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.littemplate.LitTemplate
com.storedobject.helper.LitComponent
com.storedobject.vaadin.TimerComponent
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasStyle,com.vaadin.flow.internal.Template,Serializable
@Tag("so-timer")
@JsModule("./so/timer/so-timer.js")
public class TimerComponent
extends LitComponent
implements com.vaadin.flow.component.HasStyle
A simple component to use as an up/down counter. The counting is done in seconds.
- Author:
- Syam
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceListener interface for theTimerComponentclass. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Abort the timer.com.vaadin.flow.shared.RegistrationaddListener(TimerComponent.Listener listener) Add a listener to this timer.voidcountDown(int seconds) Count down.voidcountUp(int seconds) Count up.com.vaadin.flow.dom.StylegetStyle()voidSet a prefix for the display.voidSet a suffix for the display.Methods inherited from class com.storedobject.helper.LitComponent
executeJS, onDetachMethods inherited from class com.vaadin.flow.component.littemplate.LitTemplate
getChildrenMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, 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.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Constructor Details
-
TimerComponent
public TimerComponent()Constructor.
-
-
Method Details
-
addListener
Add a listener to this timer.- Parameters:
listener- Listener.- Returns:
- Registration that can be used to remove the listener.
-
countUp
public void countUp(int seconds) Count up.- Parameters:
seconds- Seconds
-
countDown
public void countDown(int seconds) Count down.- Parameters:
seconds- Seconds
-
abort
public void abort()Abort the timer. -
setPrefix
Set a prefix for the display. This value will be displayed as a prefix to the timer value.For example, you may want to display something like "Waiting for 23 seconds". Here, "Waiting for " is the prefix and " seconds" is the suffix.
- Parameters:
prefix- Prefix.
-
setSuffix
Set a suffix for the display. This value will be displayed as a prefix to the timer value.For example, you may want to display something like "Waiting for 23 seconds". Here, "Waiting for " is the prefix and " seconds" is the suffix.
- Parameters:
suffix- Suffix.
-
getStyle
public com.vaadin.flow.dom.Style getStyle()- Specified by:
getStylein interfacecom.vaadin.flow.component.HasStyle
-