Class ThemeToggle
java.lang.Object
com.vaadin.flow.component.Component
de.bytestore.hostinger.components.themetoggle.ThemeToggle
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier<ThemeToggle>,com.vaadin.flow.component.ClickNotifier<ThemeToggle>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable<ThemeToggle>,com.vaadin.flow.component.FocusNotifier<ThemeToggle>,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasText,com.vaadin.flow.component.HasTheme,com.vaadin.flow.component.shared.HasTooltip,io.jmix.flowui.kit.component.HasTitle,Serializable
@Tag("theme-toggle")
@JsModule("./src/theme-switcher/theme-toggle.js")
public class ThemeToggle
extends com.vaadin.flow.component.Component
implements com.vaadin.flow.component.ClickNotifier<ThemeToggle>, com.vaadin.flow.component.Focusable<ThemeToggle>, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasText, com.vaadin.flow.component.shared.HasTooltip, io.jmix.flowui.kit.component.HasTitle
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText
com.vaadin.flow.component.HasText.WhiteSpace -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionThemeToggle(com.vaadin.flow.component.Component icon) ThemeToggle(String text, com.vaadin.flow.component.Component icon) -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddThemeChangeListener(com.vaadin.flow.component.ComponentEventListener<ThemeToggle.ThemeToggleThemeChangedEvent> listener) com.vaadin.flow.component.ComponentgetIcon()Gets the component that is defined as the icon of this button.booleanGet the state for the autofocus property of the button.voidsetAutofocus(boolean autofocus) Set the button to be input focused when the page loads.voidsetIcon(com.vaadin.flow.component.Component icon) Sets the given component as the icon of this button.voidsetStorageKey(String storageKey) voidSets the given string as the text content of this component.Methods inherited from class com.vaadin.flow.component.Component
findAncestor, from, getChildren, getElement, getId, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, isAttached, isVisible, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, setId, setVisibleMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.ClickNotifier
addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasText
getText, getWhiteSpace, setWhiteSpaceMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface io.jmix.flowui.kit.component.HasTitle
getTitle, setTitleMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipText
-
Field Details
-
STORAGE_KEY_PROPERTY
- See Also:
-
THEME_CHANGED_EVENT
- See Also:
-
-
Constructor Details
-
ThemeToggle
public ThemeToggle() -
ThemeToggle
public ThemeToggle(com.vaadin.flow.component.Component icon) -
ThemeToggle
-
-
Method Details
-
setText
Sets the given string as the text content of this component.This method removes any existing text-content and replaces it with the given text.
This method also sets or removes this button's
theme=iconattribute based on whether this button contains only an icon after this operation or not.- Specified by:
setTextin interfacecom.vaadin.flow.component.HasText- Parameters:
text- the text content to set, may benullto only remove existing text
-
getIcon
public com.vaadin.flow.component.Component getIcon()Gets the component that is defined as the icon of this button.- Returns:
- the icon of this button, or
nullif the icon is not set
-
setIcon
public void setIcon(@Nullable com.vaadin.flow.component.Component icon) Sets the given component as the icon of this button.Even though you can use almost any component as an icon, some good options are
IconandImage.This method also sets or removes this button's
theme=iconattribute based on whether this button contains only an icon after this operation or not.- Parameters:
icon- component to be used as an icon, may benullto only remove the current icon, can't be a text-node
-
isAutofocus
public boolean isAutofocus()Get the state for the autofocus property of the button.This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- Returns:
- the
autofocusproperty from the button
-
setAutofocus
public void setAutofocus(boolean autofocus) Set the button to be input focused when the page loads.- Parameters:
autofocus- the boolean value to set
-
getStorageKey
-
setStorageKey
-
addThemeChangeListener
public com.vaadin.flow.shared.Registration addThemeChangeListener(com.vaadin.flow.component.ComponentEventListener<ThemeToggle.ThemeToggleThemeChangedEvent> listener)
-