Package com.vaadin.flow.component.html
Class NativeDetails
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.HtmlComponent
com.vaadin.flow.component.html.NativeDetails
- All Implemented Interfaces:
AttachNotifier,ClickNotifier<NativeDetails>,DetachNotifier,HasElement,HasSize,HasStyle,Serializable
@Tag("details")
public class NativeDetails
extends HtmlComponent
implements ClickNotifier<NativeDetails>
Component representing a
<details> element.- Author:
- Vaadin Ltd
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classComponent representing a<summary>element.static classRepresents the DOM event "toggle". -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new details with an empty summary.NativeDetails(Component summaryContent) Creates a new details with the given content of the summary.NativeDetails(Component summaryContent, Component content) Creates a new details using the provided summary content and content.NativeDetails(String summary) Creates a new details with the given summary.NativeDetails(String summary, Component content) Creates a new details using the provided summary and content. -
Method Summary
Modifier and TypeMethodDescriptionAdds a listener fortoggleevents fired by the details, which are dispatched to the details element whenever its state changes between open and closed.Returns the details content which was set viasetContent(Component).ReturnsNativeDetails.Summarycomponent associated with this details.Returns the textual summary of this details.booleanisOpen()Return whether or not the details is opened and the content is displayed.voidsetContent(Component content) Sets the details content and removes the previously set content.voidsetOpen(boolean open) Sets whether or not the details should be opened.voidsetSummary(Component... summaryContent) Sets the components of the summary.voidsetSummaryText(String summary) Sets the text of the summary.Methods inherited from class com.vaadin.flow.component.HtmlComponent
getTitle, setTitleMethods inherited from class com.vaadin.flow.component.Component
addListener, 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.ClickNotifier
addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListenerMethods 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.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, setClassName
-
Constructor Details
-
NativeDetails
public NativeDetails()Creates a new details with an empty summary. -
NativeDetails
Creates a new details with the given summary.- Parameters:
summary- the summary to set.
-
NativeDetails
Creates a new details with the given content of the summary.- Parameters:
summaryContent- the summary content to set.
-
NativeDetails
Creates a new details using the provided summary and content.- Parameters:
summary- the summary text to set.content- the content component to set.
-
NativeDetails
Creates a new details using the provided summary content and content.- Parameters:
summaryContent- the summary content to set.content- the content component to set.
-
-
Method Details
-
getSummary
ReturnsNativeDetails.Summarycomponent associated with this details.- Returns:
- the summary component
-
getSummaryText
Returns the textual summary of this details.- Returns:
- the text content of the summary, not
null - See Also:
-
setSummaryText
Sets the text of the summary. Removes previously set components of the summary.- Parameters:
summary- the summary text to set.- See Also:
-
setSummary
Sets the components of the summary. Removes previously set text or components of the summary.- Parameters:
summaryContent- the summary content to set.- See Also:
-
getContent
Returns the details content which was set viasetContent(Component).- Returns:
- the content of the details, can be
null.
-
setContent
Sets the details content and removes the previously set content.- Parameters:
content- the content of the details to set- See Also:
-
isOpen
Return whether or not the details is opened and the content is displayed.- Returns:
- whether details are expanded or collapsed
-
setOpen
public void setOpen(boolean open) Sets whether or not the details should be opened.trueif the details should be opened and the content should be displayed,falseto collapse it.- Parameters:
open- the boolean value to set
-
addToggleListener
Adds a listener fortoggleevents fired by the details, which are dispatched to the details element whenever its state changes between open and closed.Note: This event is always triggered on client side. Resulting in
isFromClient()to always returntrue.- Parameters:
listener- the listener- Returns:
- a
Registrationfor removing the event listener
-