Package com.storedobject.ui
Class ScrollingContent
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.HtmlComponent
com.vaadin.flow.component.HtmlContainer
com.vaadin.flow.component.html.Div
com.storedobject.ui.ScrollingContent
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.ClickNotifier<com.vaadin.flow.component.html.Div>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasComponents,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasOrderedComponents,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasText,Serializable
- Direct Known Subclasses:
CardDashboard
public class ScrollingContent
extends com.vaadin.flow.component.html.Div
Represents a container component that manages a scrolling content area
along with an optional header. It is designed to handle both the header
and content sections flexibly, where the content area supports scrolling
and the header has a fixed height.
This class extends
Div and provides a customizable structure for
laying out a header and a scrollable content area. It is styled and
configured by default to support these features but also allows further
customization.- Author:
- Syam
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText
com.vaadin.flow.component.HasText.WhiteSpace -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for the ScrollingContent class.ScrollingContent(com.vaadin.flow.component.Component content) Constructs aScrollingContentinstance with a scrollable content area and an optional header component.ScrollingContent(com.vaadin.flow.component.Component header, com.vaadin.flow.component.Component content) A UI component that organizes content with a scrollable area and a header. -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.component.ComponentRetrieves the content component of the container.com.vaadin.flow.component.ComponentRetrieves the first component from the header container if it exists.intRetrieves the margin value.voidsetContent(com.vaadin.flow.component.Component content) Updates the content of the container by removing all existing components and adding the specified component as the new content.voidsetHeader(com.vaadin.flow.component.Component header) Sets the header component of the container.voidsetHeaderHeight(int headerHeight) Sets the height of the header section in the container.voidsetMargin(int margin) Sets the margin size for the container and header container.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.HasComponents
add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAllMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasOrderedComponents
getChildren, getComponentAt, getComponentCount, indexOf, replaceMethods 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, setClassNameMethods inherited from interface com.vaadin.flow.component.HasText
getText, getWhiteSpace, setText, setWhiteSpace
-
Constructor Details
-
ScrollingContent
public ScrollingContent()Default constructor for the ScrollingContent class. This constructor initializes an instance of ScrollingContent without any pre-defined header or content. By default, it configures the internal layout and styles for the scrollable content area and header section, ensuring a consistent appearance and behavior. -
ScrollingContent
public ScrollingContent(com.vaadin.flow.component.Component content) Constructs aScrollingContentinstance with a scrollable content area and an optional header component.- Parameters:
content- the scrollable content. Ifnull, no content is set initially.
-
ScrollingContent
public ScrollingContent(com.vaadin.flow.component.Component header, com.vaadin.flow.component.Component content) A UI component that organizes content with a scrollable area and a header.- Parameters:
header- the header component to be displayed at the top of the scrolling areacontent- the main content component to be displayed inside the scrollable container
-
-
Method Details
-
getContent
public com.vaadin.flow.component.Component getContent()Retrieves the content component of the container. If the container does not contain any components, this method returnsnull.- Returns:
- the first component in the container, or
nullif the container is empty
-
setContent
public void setContent(com.vaadin.flow.component.Component content) Updates the content of the container by removing all existing components and adding the specified component as the new content. If the provided content is null, the container will be cleared and left empty.- Parameters:
content- The new content to be set in the container. If null, the container is cleared and no content is added.
-
getHeader
public com.vaadin.flow.component.Component getHeader()Retrieves the first component from the header container if it exists.- Returns:
- the first component in the header container if available, otherwise null
-
setHeader
public void setHeader(com.vaadin.flow.component.Component header) Sets the header component of the container. This method removes all existing components from the header container and adds the specified header component if it is not null.- Parameters:
header- the component to set as the header; if null, the header container will remain empty
-
setHeaderHeight
public void setHeaderHeight(int headerHeight) Sets the height of the header section in the container. This method updates the CSS flex property to ensure the header occupies the specified height and maintains a fixed size within the layout.- Parameters:
headerHeight- the height of the header, in pixels; must be a non-negative integer
-
getMargin
public int getMargin()Retrieves the margin value.- Returns:
- the margin value as an integer
-
setMargin
public void setMargin(int margin) Sets the margin size for the container and header container.- Parameters:
margin- the desired margin size in pixels. If the provided value is negative, it will be adjusted to 0.
-