com.vaadin.flow.component.orderedlayout.

Interface ThemableLayout

All Superinterfaces:

HasElement, Serializable

All Known Implementing Classes:

HorizontalLayout, VerticalLayout

public interface ThemableLayout extends HasElement

Common logic for VerticalLayout and HorizontalLayout related to dynamic theme adjustment.

Note: Dynamic adjustment have effect only if the corresponding component theme supports it.

Author:

Vaadin Ltd.

  • Method Summary

    Modifier and Type
    Method
    Description
    default BoxSizing

    Gets the box-sizing defined for the layout, or BoxSizing.UNDEFINED if none was defined on the server-side.

    default ThemeList

    Gets the set of the theme names applied to the corresponding element in theme attribute.

    default boolean

    Shows if margin theme setting is applied to the component.

    default boolean

    Shows if padding theme setting is applied to the component.

    default boolean

    Shows if spacing theme setting is applied to the component.

    default boolean

    Gets whether items will wrap to new lines/columns when they exceed the layout's boundaries.

    default void

    Sets the box-sizing CSS property of the layout.

    default void
    setMargin(boolean margin)

    Toggles margin theme setting for the element.

    default void
    setPadding(boolean padding)

    Toggles padding theme setting for the element.

    default void
    setSpacing(boolean spacing)

    Toggles spacing theme setting for the element.

    default void
    setWrap(boolean wrap)

    Sets whether items should wrap to new lines/columns when they exceed the layout's boundaries.

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement
  • Method Details

    • setMargin

      default void setMargin(boolean margin)

      Toggles margin theme setting for the element. If a theme supports this attribute, it will apply or remove margin to the element.

      Parameters:

      margin - adds margin theme setting if true or removes it if false

    • isMargin

      default boolean isMargin()

      Shows if margin theme setting is applied to the component.

      Returns:

      true if theme setting is applied, false otherwise

    • setPadding

      default void setPadding(boolean padding)

      Toggles padding theme setting for the element. If a theme supports this attribute, it will apply or remove padding to the element.

      Parameters:

      padding - adds padding theme setting if true or removes it if false

    • isPadding

      default boolean isPadding()

      Shows if padding theme setting is applied to the component.

      Returns:

      true if theme setting is applied, false otherwise

    • setSpacing

      default void setSpacing(boolean spacing)

      Toggles spacing theme setting for the element. If a theme supports this attribute, it will apply or remove spacing to the element.

      This method adds medium spacing to the component theme, to set other options, use getThemeList(). List of options possible:

      • spacing-xs
      • spacing-s
      • spacing
      • spacing-l
      • spacing-xl

      Parameters:

      spacing - adds spacing theme setting if true or removes it if false

    • isSpacing

      default boolean isSpacing()

      Shows if spacing theme setting is applied to the component.

      Returns:

      true if theme setting is applied, false otherwise

    • setWrap

      default void setWrap(boolean wrap)

      Sets whether items should wrap to new lines/columns when they exceed the layout's boundaries. When enabled, items maintain their size and create new rows or columns as needed, depending on the layout's orientation.

      When disabled, items will be compressed to fit within a single row/column.

      Parameters:

      wrap - true to enable wrapping, false to force items into a single row/column

    • isWrap

      default boolean isWrap()

      Gets whether items will wrap to new lines/columns when they exceed the layout's boundaries.

      When wrapping is enabled, items maintain their defined dimensions by creating new rows or columns as needed. When disabled, items may be compressed to fit within the available space.

      Returns:

      true if wrapping is enabled, false if items are forced into a single row/column

      See Also:

    • getThemeList

      default ThemeList getThemeList()

      Gets the set of the theme names applied to the corresponding element in theme attribute. The set returned can be modified to add or remove the theme names, changes to the set will be reflected in the attribute value.

      Despite the name implying a list being returned, the return type is actually a Set since the in-browser return value behaves like a Set in Java.

      Returns:

      a list of theme names, never null

    • setBoxSizing

      default void setBoxSizing(BoxSizing boxSizing)

      Sets the box-sizing CSS property of the layout.

      Parameters:

      boxSizing - the box-sizing of the layout. null is interpreted as BoxSizing.UNDEFINED

      See Also:

    • getBoxSizing

      default BoxSizing getBoxSizing()

      Gets the box-sizing defined for the layout, or BoxSizing.UNDEFINED if none was defined on the server-side.

      Returns:

      the box-sizing, never null

      See Also: