Class Details
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasComponents,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasTheme,com.vaadin.flow.component.shared.HasThemeVariant<DetailsVariant>,com.vaadin.flow.component.shared.HasTooltip,Serializable
The Summary is the part that is always visible, and typically describes the contents, for example, with a title. Clicking on the summary toggles the content area’s visibility. The summary supports rich content and can contain any component. This can be utilized for example to indicate the status of the corresponding content.
The content area is the collapsible part of Details. It can contain any component. When the content area is collapsed, the content is invisible and inaccessible by keyboard or screen reader.
- Author:
- Vaadin Ltd
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionDetails()Initializes a new Details component.Details(com.vaadin.flow.component.Component summary) Initializes a new Details using the provided summary.Details(com.vaadin.flow.component.Component summary, com.vaadin.flow.component.Component content) Initializes a new Details using the provided summary and content.Details(com.vaadin.flow.component.Component summary, com.vaadin.flow.component.Component... components) Initializes a new Details using the provided summary and content components.Initializes a new Details component with a summary text provided by a signal.Details(com.vaadin.flow.signals.Signal<String> summaryTextSignal, com.vaadin.flow.component.Component content) Initializes a new Details component with a summary text provided by a signal and content.Details(com.vaadin.flow.signals.Signal<String> summaryTextSignal, com.vaadin.flow.component.Component... components) Initializes a new Details component with a summary text provided by a signal and optional content components.Initializes a new Details using the provided summary.Initializes a new Details using the provided summary and content.Initializes a new Details using the provided summary and content components. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given text to the content sectionvoidadd(Collection<com.vaadin.flow.component.Component> components) Adds components to the content sectionvoidaddComponentAtIndex(int index, com.vaadin.flow.component.Component component) Adds the given component to the content section at the specific index.com.vaadin.flow.shared.RegistrationaddOpenedChangeListener(com.vaadin.flow.component.ComponentEventListener<Details.OpenedChangeEvent> listener) Adds a listener to get notified when the opened state of the component changes.<T,S extends com.vaadin.flow.signals.Signal<T>>
voidbindChildren(com.vaadin.flow.signals.Signal<List<S>> list, com.vaadin.flow.function.SerializableFunction<S, com.vaadin.flow.component.Component> childFactory) voidbindSummaryText(com.vaadin.flow.signals.Signal<String> signal) Binds aSignal's value to the summary text content of this component and keeps the summary text synchronized with the signal value while the element is in attached state.protected com.vaadin.flow.component.ComponentCreates the summary container component.Stream<com.vaadin.flow.component.Component> Returns the content components which were added viaHasComponents.add(Component...)com.vaadin.flow.component.ComponentReturns summary component which was set viasetSummary(Component)orsetSummaryText(String)booleanisOpened()voidremove(Collection<com.vaadin.flow.component.Component> components) Removes specified components from the content sectionvoidRemoves all components from the content sectionvoidsetOpened(boolean opened) True if the details are opened and the content is displayedvoidsetSummary(com.vaadin.flow.component.Component summary) Sets the component summaryvoidsetSummaryText(String summary) Sets the summary text of the details component.Methods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, 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, 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.HasComponents
add, addComponentAsFirst, removeMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
bindEnabled, isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasSize
bindHeight, bindWidth, 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, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, bindThemeName, bindThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant
addThemeVariants, bindThemeVariant, removeThemeVariants, setThemeVariant, setThemeVariants, setThemeVariantsMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipMarkdown, setTooltipText
-
Constructor Details
-
Details
public Details()Initializes a new Details component. -
Details
Initializes a new Details using the provided summary.- Parameters:
summary- the summary component to set.- See Also:
-
Details
public Details(com.vaadin.flow.component.Component summary) Initializes a new Details using the provided summary.- Parameters:
summary- the summary component to set.- See Also:
-
Details
Initializes a new Details component with a summary text provided by a signal.- Parameters:
summaryTextSignal- the signal that provides the summary text
-
Details
Initializes a new Details using the provided summary and content.- Parameters:
summary- the summary text to set.content- the content component to add.- See Also:
-
Details
public Details(com.vaadin.flow.component.Component summary, com.vaadin.flow.component.Component content) Initializes a new Details using the provided summary and content.- Parameters:
summary- the summary component to set.content- the content component to add.- See Also:
-
Details
public Details(com.vaadin.flow.signals.Signal<String> summaryTextSignal, com.vaadin.flow.component.Component content) Initializes a new Details component with a summary text provided by a signal and content.- Parameters:
summaryTextSignal- the signal that provides the summary text.content- the content component to add.
-
Details
Initializes a new Details using the provided summary and content components.- Parameters:
summary- the summary text to set.components- the content components to add.- See Also:
-
Details
public Details(com.vaadin.flow.component.Component summary, com.vaadin.flow.component.Component... components) Initializes a new Details using the provided summary and content components.- Parameters:
summary- the summary component to set.components- the content components to add.- See Also:
-
Details
public Details(com.vaadin.flow.signals.Signal<String> summaryTextSignal, com.vaadin.flow.component.Component... components) Initializes a new Details component with a summary text provided by a signal and optional content components.- Parameters:
summaryTextSignal- the signal that provides the summary text.components- the content components to add.
-
-
Method Details
-
createSummaryContainer
protected com.vaadin.flow.component.Component createSummaryContainer()Creates the summary container component.- Returns:
- the summary container
-
setSummary
public void setSummary(com.vaadin.flow.component.Component summary) Sets the component summary- Parameters:
summary- the summary component to set, ornullto remove any previously set summary- See Also:
-
getSummary
public com.vaadin.flow.component.Component getSummary()Returns summary component which was set viasetSummary(Component)orsetSummaryText(String)- Returns:
- the summary component,
nullif nothing was set
-
setSummaryText
Sets the summary text of the details component.- Parameters:
summary- the summary text to set, ornullfor empty text- See Also:
-
getSummaryText
- Returns:
- summary section content as string (empty string if nothing was set)
-
bindSummaryText
Binds aSignal's value to the summary text content of this component and keeps the summary text synchronized with the signal value while the element is in attached state. When the element is in detached state, signal value changes have no effect.nullsignal unbinds the existing binding.While a Signal is bound, any attempt to set the summary text manually throws
. Same happens when trying to bind a new Signal while one is already bound.invalid reference
BindingActiveException- Parameters:
signal- the signal to bind ornullto unbind any existing binding- See Also:
-
add
Adds components to the content section- Specified by:
addin interfacecom.vaadin.flow.component.HasComponents- Parameters:
components- the components to add- See Also:
-
add
Adds the given text to the content section- Specified by:
addin interfacecom.vaadin.flow.component.HasComponents- Parameters:
text- the text to add, not null- See Also:
-
remove
Removes specified components from the content section- Specified by:
removein interfacecom.vaadin.flow.component.HasComponents- Parameters:
components- the components to remove
-
removeAll
public void removeAll()Removes all components from the content section- Specified by:
removeAllin interfacecom.vaadin.flow.component.HasComponents
-
addComponentAtIndex
public void addComponentAtIndex(int index, com.vaadin.flow.component.Component component) Adds the given component to the content section at the specific index.In case the specified component has already been added to another parent, it will be removed from there and added to the content section of this one.
- Specified by:
addComponentAtIndexin interfacecom.vaadin.flow.component.HasComponents- Parameters:
index- the index, where the component will be added. The index must be non-negative and may not exceed the children countcomponent- the component to add, value should not be null
-
bindChildren
public <T,S extends com.vaadin.flow.signals.Signal<T>> void bindChildren(com.vaadin.flow.signals.Signal<List<S>> list, com.vaadin.flow.function.SerializableFunction<S, com.vaadin.flow.component.Component> childFactory) - Specified by:
bindChildrenin interfacecom.vaadin.flow.component.HasComponents
-
getContent
Returns the content components which were added viaHasComponents.add(Component...)- Returns:
- the child components of the content section
-
isOpened
@Synchronize(property="opened", value="opened-changed") public boolean isOpened()- Returns:
- whether details are expanded or collapsed
-
setOpened
public void setOpened(boolean opened) True if the details are opened and the content is displayed
- Parameters:
opened- the boolean value to set
-
addOpenedChangeListener
public com.vaadin.flow.shared.Registration addOpenedChangeListener(com.vaadin.flow.component.ComponentEventListener<Details.OpenedChangeEvent> listener) Adds a listener to get notified when the opened state of the component changes.- Parameters:
listener- the listener- Returns:
- a
Registrationfor removing the event listener
-