Interface HasTheme
- All Superinterfaces:
HasElement,Serializable
- All Known Subinterfaces:
HasThemeVariant<TVariantEnum>
- All Known Implementing Classes:
AccordionPanel,Avatar,AvatarGroup,Badge,BigDecimalField,Button,Card,Chart,Checkbox,CheckboxGroup,CollaborationAvatarGroup,CollaborationMessageInput,ComboBox,ComboBoxBase,Crud,CrudGrid,CustomField,Dashboard,DatePicker,DateTimePicker,Details,Dialog,DrawerToggle,EmailField,Grid,GridPro,HorizontalLayout,IntegerField,Map,MapBase,MasterDetailLayout,MenuBar,MessageInput,MultiSelectComboBox,Notification,NumberField,PasswordField,Popover,ProgressBar,RadioButtonGroup,RichTextEditor,Scroller,Select,SideNav,SplitLayout,Tab,Tabs,TabSheet,TextArea,TextField,TimePicker,TreeGrid,Upload,UploadButton,UploadFileList,VerticalLayout,VirtualList
Component which has theme attribute.
Implementation of HasElement.getElement() may return any type of element.
- Since:
- 1.0
- Author:
- Vaadin Ltd
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddThemeName(String themeName) Adds a theme name to this component.default voidaddThemeNames(String... themeNames) Adds one or more theme names to this component.default voidbindThemeName(String name, Signal<Boolean> signal) Binds the presence of the given theme name to the provided signal so that the theme name is added when the signal value istrueand removed when the value isfalse.default StringGets the theme names for this component.default ThemeListGets the set of theme names used for this element.default booleanhasThemeName(String themeName) Checks if the component has the given theme name.default booleanremoveThemeName(String themeName) Removes a theme name from this component.default voidremoveThemeNames(String... themeNames) Removes one or more theme names from component.default voidsetThemeName(String themeName) Sets the theme names of this component.default voidsetThemeName(String themeName, boolean set) Sets or removes the given theme name for this component.Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
-
Method Details
-
addThemeName
Adds a theme name to this component.- Parameters:
themeName- the theme name to add, notnull
-
removeThemeName
Removes a theme name from this component.- Parameters:
themeName- the theme name to remove, notnull- Returns:
trueif the theme name was removed,falseif the theme list didn't contain the theme name
-
setThemeName
Sets the theme names of this component. This method overwrites any previous set theme names.- Parameters:
themeName- a space-separated string of theme names to set, or empty string to remove all theme names
-
getThemeName
Gets the theme names for this component.- Returns:
- a space-separated string of theme names, empty string if there
are no theme names or
nullif attribute (theme) is not set at all
-
getThemeNames
Gets the set of theme names used for this element. The returned set can be modified to add or remove theme names. The contents of the set is also reflected in the value of thethemeattribute.- Returns:
- a list of theme names, never
null - See Also:
-
setThemeName
Sets or removes the given theme name for this component.- Parameters:
themeName- the theme name to set or remove, notnullset-trueto set the theme name,falseto remove it
-
hasThemeName
Checks if the component has the given theme name.- Parameters:
themeName- the theme name to check for- Returns:
trueif the component has the given theme name,falseotherwise
-
addThemeNames
Adds one or more theme names to this component. Multiple theme names can be specified by using multiple parameters.- Parameters:
themeNames- the theme name or theme names to be added to the component
-
removeThemeNames
Removes one or more theme names from component. Multiple theme names can be specified by using multiple parameters.- Parameters:
themeNames- the theme name or theme names to be removed from the component
-
bindThemeName
Binds the presence of the given theme name to the provided signal so that the theme name is added when the signal value istrueand removed when the value isfalse.Passing
nullas thesignalremoves any existing binding for the given theme name. When unbinding, the current presence of the theme name is left unchanged.While a binding for the given theme name is active, manual calls to
addThemeName(String),removeThemeName(String),setThemeName(String, boolean),addThemeNames(String...),removeThemeNames(String...)or equivalents inThemeListfor that name will throw acom.vaadin.flow.dom.BindingActiveException. Bindings are lifecycle-aware and only active while the owningElementis in attached state; they are deactivated while the element is in detached state.Bulk operations that indiscriminately replace or clear the theme list (for example
Set.clear()or setting thethemeattribute viasetThemeName(String)) clear all bindings.- Parameters:
name- the theme name to bind, notnullor blanksignal- the boolean signal to bind to, notnull- Throws:
BindingActiveException- thrown when there is already an existing binding- Since:
- 25.1
-