Package com.storedobject.vaadin
Class DetailComponent
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<com.vaadin.flow.component.html.Div>
com.storedobject.vaadin.DetailComponent
- All Implemented Interfaces:
HasSize,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
@Tag("div")
public class DetailComponent
extends com.vaadin.flow.component.Composite<com.vaadin.flow.component.html.Div>
implements HasSize
A component with a "header" and a "detail" part. The "detail" part is normally hidden and only the "header" part is
visible. The visibility of the "detail" part can be toggled by clicking on the "header" part.
- Author:
- Syam (Initial version was written by Anand Jeypal)
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classClass that represents the "toggled event".static interfaceInterface for the toggle listener. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor with blank header.DetailComponent(com.vaadin.flow.component.Component header, com.vaadin.flow.component.Component... content) Constructor.DetailComponent(String header, com.vaadin.flow.component.Component... content) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddContent(com.vaadin.flow.component.Component... components) Add components to the content section.com.vaadin.flow.shared.RegistrationaddToggleListener(DetailComponent.ToggleListener toggleListener) Add content toggle listener.voidClear the content section.voidcollapse()Collapse the content section.protected com.vaadin.flow.component.HasComponentscreateHeader(String headerText) Create the header portion.voidexpand()Expand the content section.com.vaadin.flow.component.html.DivGet the content layout.protected final com.vaadin.flow.component.html.DivvoidsetContent(com.vaadin.flow.component.Component... components) Set components to the content section.voidsetHeader(com.vaadin.flow.component.Component header) Set the header.voidSet the header.voidtoggle()Toggle the content section.Methods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElementMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, 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.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, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Constructor Details
-
DetailComponent
public DetailComponent()Constructor with blank header. -
DetailComponent
Constructor.- Parameters:
header- Header textcontent- Content
-
DetailComponent
public DetailComponent(com.vaadin.flow.component.Component header, com.vaadin.flow.component.Component... content) Constructor.- Parameters:
header- Header componentcontent- Content
-
-
Method Details
-
initContent
protected final com.vaadin.flow.component.html.Div initContent()- Overrides:
initContentin classcom.vaadin.flow.component.Composite<com.vaadin.flow.component.html.Div>
-
setHeader
public void setHeader(com.vaadin.flow.component.Component header) Set the header.- Parameters:
header- Header
-
setHeader
-
getContentLayout
public com.vaadin.flow.component.html.Div getContentLayout()Get the content layout.- Returns:
- The content section.
-
addContent
public void addContent(com.vaadin.flow.component.Component... components) Add components to the content section.- Parameters:
components- Component to add
-
setContent
public void setContent(com.vaadin.flow.component.Component... components) Set components to the content section.- Parameters:
components- Components to set
-
clearContent
public void clearContent()Clear the content section. -
createHeader
Create the header portion. By default it creates anH3.- Parameters:
headerText- Header text to be set- Returns:
- Header component to set.
-
collapse
public void collapse()Collapse the content section. -
expand
public void expand()Expand the content section. -
toggle
public void toggle()Toggle the content section. -
addToggleListener
public com.vaadin.flow.shared.Registration addToggleListener(DetailComponent.ToggleListener toggleListener) Add content toggle listener.- Parameters:
toggleListener- Listener- Returns:
Registration.
-