Class LinkkiSection
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.flow.component.HtmlComponent
-
- org.linkki.core.vaadin.component.section.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 HasCaptionA 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
-
-
Field Summary
Fields Modifier and Type Field Description static StringCLASS_SECTION_SECONDARY_CAPTIONCSS class that can be applied to arbitrary component to make all contained sections captions less prominent.static StringCLASS_SECTION_STYLE_CARDCSS class that can be applied to arbitrary layout to make all contained sections card-like.static StringTHEME_VARIANT_FORMstatic StringTHEME_VARIANT_HORIZONTAL
-
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 voidaddHeaderButton(com.vaadin.flow.component.button.Button button)Adds a button to the header using the given button PMO.voidaddHeaderComponent(com.vaadin.flow.component.Component component)Adds a component to the header.voidaddRightHeaderComponent(com.vaadin.flow.component.Component component)Adds a component to the header.voidclose()Closes the section.StringgetCaption()com.vaadin.flow.component.html.DivgetContentWrapper()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.ComponentgetSectionContent()Deprecated.usegetContentWrapper()instead.booleanisClosed()Returnstrueif the section is closed.booleanisOpen()Returnstrueif the section is open.voidopen()Opens the section.voidsetCaption(String caption)Updates the caption of this section.protected voidswitchOpenStatus()-
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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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
-
-
-
-
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
-
THEME_VARIANT_HORIZONTAL
public static final String THEME_VARIANT_HORIZONTAL
- See Also:
- Constant Field Values
-
THEME_VARIANT_FORM
public static final String THEME_VARIANT_FORM
- 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. Ifcaptionisnullor 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. Ifcaptionisnullor empty, no caption will be shown.- Parameters:
caption- the caption to display for this sectioncloseable-trueif 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 isnullor empty, any existing caption label will be removed.- Specified by:
setCaptionin interfaceHasCaption- Parameters:
caption- the caption text
-
getCaption
public String getCaption()
- Specified by:
getCaptionin interfaceHasCaption
-
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()
Returnstrueif the section is open.
-
isClosed
public boolean isClosed()
Returnstrueif 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.usegetContentWrapper()instead.- Returns:
- the content of this section
- Implementation Requirements:
- Implementations of this method have to return the section's content, which is the
Componentadded 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
-
-