com.vaadin.flow.component.details.
Class Details
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.flow.component.details.Details
-
All Implemented Interfaces:
AttachNotifier, DetachNotifier, HasElement, HasEnabled, HasStyle, HasTheme, Serializable
Direct Known Subclasses:
@Tag(value="vaadin-details") @NpmPackage(value="@vaadin/vaadin-details", version="1.2.1") @JsModule(value="@vaadin/vaadin-details/src/vaadin-details.js") public class Details extends Component implements HasEnabled, HasTheme, HasStyle
See Also:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
Details.OpenedChangeEvent
-
Constructor Summary
Constructors Constructor and Description Details()
Initializes a new Details component.
Details(Component summary, Component content)
Initializes a new Details using the provided summary and content.
Details(String summary, Component content)
Initializes a new Details using the provided summary and content.
-
Method Summary
All Methods Modifier and Type Method and Description void
addContent(Component... components)
Adds components to the content section
Registration
addOpenedChangeListener(ComponentEventListener<Details.OpenedChangeEvent> listener)
Adds a listener to get notified when the opened state of the component changes.
void
addThemeVariants(DetailsVariant... variants)
Adds theme variants to the component.
Stream<Component>
getContent()
Returns the content components which were added via
setContent(Component)
or viaaddContent(Component...)
Component
getSummary()
Returns summary component which was set via
setSummary(Component)
orsetSummaryText(String)
String
getSummaryText()
boolean
isOpened()
void
removeThemeVariants(DetailsVariant... variants)
Removes theme variants from the component.
void
setContent(Component content)
Sets the component content
void
setOpened(boolean opened)
True if the details are opened and the content is displayed
void
setSummary(Component summary)
Sets the component summary
void
setSummaryText(String summary)
Creates a text wrapper and sets a summary via
setSummary(Component)
-
Methods inherited from class com.vaadin.flow.component.Component
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, 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.HasEnabled
isEnabled, setEnabled
-
Methods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
-
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
-
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
-
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
-
-
-
-
Constructor Detail
-
Details
public Details()
Initializes a new Details component.
-
Details
public Details(String summary, Component content)
Initializes a new Details using the provided summary and content.
Parameters:
summary
- the summary text to set.content
- the content component to set.See Also:
-
-
Method Detail
-
setSummary
public void setSummary(Component summary)
Sets the component summary
Parameters:
summary
- the summary component to set, ornull
to remove any previously set summarySee Also:
-
getSummary
public Component getSummary()
Returns summary component which was set via
setSummary(Component)
orsetSummaryText(String)
Returns:
the summary component,
null
if nothing was set
-
setSummaryText
public void setSummaryText(String summary)
Creates a text wrapper and sets a summary via
setSummary(Component)
-
getSummaryText
public String getSummaryText()
Returns:
summary section content as string (empty string if nothing was set)
-
setContent
public void setContent(Component content)
Sets the component content
Parameters:
content
- the content of the component to set, ornull
to remove any previously set contentSee Also:
-
addContent
public void addContent(Component... components)
Adds components to the content section
Parameters:
components
- the components to addSee Also:
-
getContent
public Stream<Component> getContent()
Returns the content components which were added via
setContent(Component)
or viaaddContent(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
-
addThemeVariants
public void addThemeVariants(DetailsVariant... variants)
Adds theme variants to the component.
Parameters:
variants
- theme variants to add
-
removeThemeVariants
public void removeThemeVariants(DetailsVariant... variants)
Removes theme variants from the component.
Parameters:
variants
- theme variants to remove
-
addOpenedChangeListener
public Registration addOpenedChangeListener(ComponentEventListener<Details.OpenedChangeEvent> listener)
Adds a listener to get notified when the opened state of the component changes.
Parameters:
listener
- the listenerReturns:
a
Registration
for removing the event listener
-
-