Class LinkkiSection

  • All Implemented Interfaces:
    com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, Serializable, HasCaption
    Direct Known Subclasses:
    BaseSection, GridSection

    @Tag("linkki-section")
    @CssImport("./styles/linkki-section.css")
    @JsModule("./src/linkki-section.ts")
    public class LinkkiSection
    extends com.vaadin.flow.component.HtmlComponent
    implements HasCaption
    A section consists of a header displaying a caption and a body/content containing controls to view and edit data. Optionally the section can be closed and opened. When the section is closed only the header is shown.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      LinkkiSection​(String caption)
      Creates a new section with the given caption that cannot be closed.
      LinkkiSection​(String caption, boolean closeable, int columns)
      Creates a new section with the given caption.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addHeaderButton​(com.vaadin.flow.component.button.Button button)
      Adds a button to the header using the given button PMO.
      void addHeaderComponent​(com.vaadin.flow.component.Component component)
      Adds a component to the header.
      void addRightHeaderComponent​(com.vaadin.flow.component.Component component)
      Adds a component to the header.
      void close()
      Closes the section.
      String getCaption()  
      com.vaadin.flow.component.html.Div getContentWrapper()
      Returns the section's content.
      List<com.vaadin.flow.component.Component> getHeaderComponents()
      Returns all components in the header, not including the caption.
      protected com.vaadin.flow.component.Component getSectionContent()
      Deprecated.
      use getContentWrapper() instead.
      boolean isClosed()
      Returns true if the section is closed.
      boolean isOpen()
      Returns true if the section is open.
      void open()
      Opens the section.
      void setCaption​(String caption)
      Updates the caption of this section.
      protected void switchOpenStatus()  
      • 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, scrollIntoView, set, setElement, setId, setVisible
      • Methods inherited from interface com.vaadin.flow.component.AttachNotifier

        addAttachListener
      • 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
    • Field Detail

      • CLASS_SECTION_STYLE_CARD

        public static final String CLASS_SECTION_STYLE_CARD
        CSS class that can be applied to arbitrary layout to make all contained sections card-like.
        See Also:
        Constant Field Values
      • CLASS_SECTION_SECONDARY_CAPTION

        public static final String CLASS_SECTION_SECONDARY_CAPTION
        CSS class that can be applied to arbitrary component to make all contained sections captions less prominent.
        See Also:
        Constant Field Values
    • Constructor Detail

      • LinkkiSection

        public LinkkiSection​(@CheckForNull
                             String caption)
        Creates a new section with the given caption that cannot be closed. If caption is null or empty, no caption will be shown.
        Parameters:
        caption - the caption to display for this section
      • LinkkiSection

        public LinkkiSection​(@CheckForNull
                             String caption,
                             boolean closeable,
                             int columns)
        Creates a new section with the given caption. If caption is null or empty, no caption will be shown.
        Parameters:
        caption - the caption to display for this section
        closeable - true if the section can be closed and opened.
        columns - number of columns in which the content components are displayed
    • Method Detail

      • setCaption

        public void setCaption​(@CheckForNull
                               String caption)
        Updates the caption of this section. If there is no caption, a new one will be added. If the new caption is null or empty, any existing caption label will be removed.
        Specified by:
        setCaption in interface HasCaption
        Parameters:
        caption - the caption text
      • addHeaderButton

        public void addHeaderButton​(com.vaadin.flow.component.button.Button button)
        Adds a button to the header using the given button PMO. The new button is added on the left, in front of the components added earlier. However, the caption text will always be the leftmost item, if it is present.
      • addHeaderComponent

        public void addHeaderComponent​(com.vaadin.flow.component.Component component)
        Adds a component to the header. The new component is added on the right, after the components added earlier. However, the hide/expand arrow will always be the rightmost item, if it is present.
      • addRightHeaderComponent

        public void addRightHeaderComponent​(com.vaadin.flow.component.Component component)
        Adds a component to the header. The new component is added on the right end.
      • getHeaderComponents

        public List<com.vaadin.flow.component.Component> getHeaderComponents()
        Returns all components in the header, not including the caption.
        Since:
        2.0.0
      • isOpen

        public boolean isOpen()
        Returns true if the section is open.
      • isClosed

        public boolean isClosed()
        Returns true if the section is closed.
      • open

        public void open()
        Opens the section.
      • close

        public void close()
        Closes the section.
      • switchOpenStatus

        protected void switchOpenStatus()
      • getSectionContent

        @Deprecated(since="2.0.0")
        protected com.vaadin.flow.component.Component getSectionContent()
        Deprecated.
        use getContentWrapper() instead.
        Returns:
        the content of this section
        Implementation Requirements:
        Implementations of this method have to return the section's content, which is the Component added to the section. The section's header is not part of the content and has to be excluded.
      • getContentWrapper

        public com.vaadin.flow.component.html.Div getContentWrapper()
        Returns the section's content. The section's header is not part of the content.
        Returns:
        the content of this section
        Since:
        2.0.0