Class NativeDetails

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.HtmlComponent
com.vaadin.flow.component.html.NativeDetails
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.ClickNotifier<NativeDetails>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, Serializable

@Tag("details") public class NativeDetails extends com.vaadin.flow.component.HtmlComponent implements com.vaadin.flow.component.ClickNotifier<NativeDetails>
Component representing a <details> element.
Author:
Vaadin Ltd
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Component representing a <summary> element.
    static class 
    Represents the DOM event "toggle".
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new details with an empty summary.
    NativeDetails(com.vaadin.flow.component.Component summaryContent)
    Creates a new details with the given content of the summary.
    NativeDetails(com.vaadin.flow.component.Component summaryContent, com.vaadin.flow.component.Component content)
    Creates a new details using the provided summary content and content.
    Creates a new details with the given summary.
    NativeDetails(String summary, com.vaadin.flow.component.Component content)
    Creates a new details using the provided summary and content.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.vaadin.flow.shared.Registration
    addToggleListener(com.vaadin.flow.component.ComponentEventListener<NativeDetails.ToggleEvent> listener)
    Adds a listener for toggle events fired by the details, which are dispatched to the details element whenever its state changes between open and closed.
    com.vaadin.flow.component.Component
    Returns the details content which was set via setContent(Component).
    Returns NativeDetails.Summary component associated with this details.
    Returns the textual summary of this details.
    boolean
    Return whether or not the details is opened and the content is displayed.
    void
    setContent(com.vaadin.flow.component.Component content)
    Sets the details content and removes the previously set content.
    void
    setOpen(boolean open)
    Sets whether or not the details should be opened.
    void
    setSummary(com.vaadin.flow.component.Component... summaryContent)
    Sets the components of the summary.
    void
    Sets the text of the summary.

    Methods inherited from class com.vaadin.flow.component.HtmlComponent

    getTitle, setTitle

    Methods 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, 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.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.ClickNotifier

    addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods 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, setWidthFull

    Methods 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

      public NativeDetails(String summary)
      Creates a new details with the given summary.
      Parameters:
      summary - the summary to set.
    • NativeDetails

      public NativeDetails(com.vaadin.flow.component.Component summaryContent)
      Creates a new details with the given content of the summary.
      Parameters:
      summaryContent - the summary content to set.
    • NativeDetails

      public NativeDetails(String summary, com.vaadin.flow.component.Component content)
      Creates a new details using the provided summary and content.
      Parameters:
      summary - the summary text to set.
      content - the content component to set.
    • NativeDetails

      public NativeDetails(com.vaadin.flow.component.Component summaryContent, com.vaadin.flow.component.Component content)
      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

      public NativeDetails.Summary getSummary()
      Returns NativeDetails.Summary component associated with this details.
      Returns:
      the summary component
    • getSummaryText

      public String getSummaryText()
      Returns the textual summary of this details.
      Returns:
      the text content of the summary, not null
      See Also:
      • Element.getText()
    • setSummaryText

      public void setSummaryText(String summary)
      Sets the text of the summary. Removes previously set components of the summary.
      Parameters:
      summary - the summary text to set.
      See Also:
    • setSummary

      public void setSummary(com.vaadin.flow.component.Component... summaryContent)
      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

      public com.vaadin.flow.component.Component getContent()
      Returns the details content which was set via setContent(Component).
      Returns:
      the content of the details, can be null.
    • setContent

      public void setContent(com.vaadin.flow.component.Component content)
      Sets the details content and removes the previously set content.
      Parameters:
      content - the content of the details to set
      See Also:
    • isOpen

      @Synchronize(property="open", value="toggle", allowInert=true) public boolean 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. true if the details should be opened and the content should be displayed, false to collapse it.
      Parameters:
      open - the boolean value to set
    • addToggleListener

      public com.vaadin.flow.shared.Registration addToggleListener(com.vaadin.flow.component.ComponentEventListener<NativeDetails.ToggleEvent> listener)
      Adds a listener for toggle events 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 return true.

      Parameters:
      listener - the listener
      Returns:
      a Registration for removing the event listener