Package com.storedobject.ui
Class Card
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.Card
- 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:
ObjectCard
public class Card
extends com.vaadin.flow.component.html.Div
Represents a styled container with configurable layout and styling options.
The Card class extends Div and provides a pre-defined style for creating card-like components.
It supports alignment, justification, and grid span configuration.
- Author:
- Syam
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a flex container that manages its child components with a customizable layout.static classRepresents a column-based layout container that arranges its child components vertically with an optional gap between them.static classThe Line class represents a styled horizontal line component with customizable properties.static classRepresents a container component designed to arrange child components in a horizontal row layout with customizable gap spacing.Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText
com.vaadin.flow.component.HasText.WhiteSpace -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAligns the component content to the bottom of the container.voidAligns the content of the component to the center by setting the `align-items` style property to "center".voidalignTop()Aligns the content of the card to the top of the container.voidAligns the content of the component to the center horizontally within its container.voidAdjusts the horizontal alignment of items within the card to the left.voidAdjusts the alignment of the item's content within its grid cell to the right.voidsetColumnSpan(int span) Sets the column span for the grid layout of the component.voidsetRowSpan(int span) Sets the number of rows that the component should span in a CSS Grid layout.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
-
Card
public Card()Default constructor for the Card component. It initializes the card with a predefined set of styles for appearance and layout.The following styles are applied by default: - Border radius set to 12px for rounded corners. - Padding set to 16px for internal spacing. - Background color set to white. - Box shadow set to create a subtle shadow effect. - Flex display for layout management. - Column-based flex-direction for stacking elements vertically. - No margin. - Alignment set to stretch to occupy available space. - Gap set to 8px between child elements.
-
-
Method Details
-
alignTop
public void alignTop()Aligns the content of the card to the top of the container. Sets the "align-items" style property to "start". -
alignBottom
public void alignBottom()Aligns the component content to the bottom of the container. This method sets the CSS style property "align-items" to "end", effectively positioning child elements at the bottom within a flex container. -
alignCenter
public void alignCenter()Aligns the content of the component to the center by setting the `align-items` style property to "center". This method applies a CSS style to center the alignment of child elements vertically within the component's layout. It is typically used in flexbox or grid layouts where centering content is needed. -
justifyLeft
public void justifyLeft()Adjusts the horizontal alignment of items within the card to the left. This method sets the CSS `justify-items` property to `start`, ensuring that the content aligns along the left side of the container. -
justifyRight
public void justifyRight()Adjusts the alignment of the item's content within its grid cell to the right. This method sets the "justify-items" CSS property to "end", ensuring the content is aligned to the end (right) of the grid cell it resides in. -
justifyCenter
public void justifyCenter()Aligns the content of the component to the center horizontally within its container. This method sets the `justify-items` CSS property to `center`. -
setColumnSpan
public void setColumnSpan(int span) Sets the column span for the grid layout of the component. The span determines how many columns the component will occupy.- Parameters:
span- The number of columns to span must be a positive integer.
-
setRowSpan
public void setRowSpan(int span) Sets the number of rows that the component should span in a CSS Grid layout.- Parameters:
span- the number of rows the component should span
-