@Tag(value="vaadin-horizontal-layout") @NpmPackage(value="@vaadin/vaadin-ordered-layout", version="1.4.0") @JsModule(value="@vaadin/vaadin-ordered-layout/src/vaadin-horizontal-layout.js") @HtmlImport(value="frontend://bower_components/vaadin-ordered-layout/src/vaadin-horizontal-layout.html") public class HorizontalLayout extends Component implements ThemableLayout, FlexComponent<HorizontalLayout>, ClickNotifier<HorizontalLayout>
FlexComponent.Alignment, FlexComponent.JustifyContentMode
Constructor and Description |
---|
HorizontalLayout()
Constructs an empty layout with spacing on by default.
|
HorizontalLayout(Component... children)
Convenience constructor to create a layout with the children already
inside it.
|
Modifier and Type | Method and Description |
---|---|
void |
addAndExpand(Component... components)
Adds the given components to this layout and sets them as expanded.
|
FlexComponent.Alignment |
getAlignItems()
This is the same as
getDefaultVerticalComponentAlignment() . |
FlexComponent.Alignment |
getAlignSelf(HasElement container)
This is the same as
getVerticalComponentAlignment(Component) . |
FlexComponent.Alignment |
getDefaultVerticalComponentAlignment()
Gets the default vertical alignment used by all components without
individual alignments inside the layout.
|
FlexComponent.Alignment |
getVerticalComponentAlignment(Component component)
Gets the individual vertical alignment of a given component.
|
void |
setAlignItems(FlexComponent.Alignment alignment)
This is the same as
#setDefaultVerticalComponentAlignment(Alignment) . |
void |
setAlignSelf(FlexComponent.Alignment alignment,
HasElement... elementContainers)
This is the same as
#setVerticalComponentAlignment(Alignment, Component...) . |
void |
setDefaultVerticalComponentAlignment(FlexComponent.Alignment alignment)
Sets the default vertical alignment to be used by all components without
individual alignments inside the layout.
|
void |
setSpacing(boolean spacing)
Toggles
spacing theme setting for the element. |
void |
setVerticalComponentAlignment(FlexComponent.Alignment alignment,
Component... componentsToAlign)
Sets a vertical alignment for individual components inside the layout.
|
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisible
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBoxSizing, getThemeList, isMargin, isPadding, isSpacing, setBoxSizing, setMargin, setPadding
expand, getFlexGrow, getJustifyContentMode, replace, setFlexGrow, setJustifyContentMode
getChildren, getComponentAt, getComponentCount, indexOf
add, add, addComponentAsFirst, addComponentAtIndex, remove, removeAll
isEnabled, setEnabled
getElement
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
getCssSize, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
addClickListener, addClickShortcut
addAttachListener
addDetachListener
public HorizontalLayout()
public HorizontalLayout(Component... children)
children
- the items to add to this layoutHasComponents.add(Component...)
public void setSpacing(boolean spacing)
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 ThemableLayout.getThemeList()
. List of options
possible:
Spacing is enabled by default for horizontal layout.
setSpacing
in interface ThemableLayout
spacing
- adds spacing
theme setting if true
or removes
it if false
public void setVerticalComponentAlignment(FlexComponent.Alignment alignment, Component... componentsToAlign)
#setDefaultVerticalComponentAlignment(Alignment)
.
It effectively sets the "alignSelf"
style value.
The default alignment for individual components is
Alignment#AUTO
.
It's the same as the FlexComponent.setAlignSelf(Alignment, HasElement...)
method
alignment
- the individual alignment for the children components. Setting
null
will reset the alignment to its defaultcomponentsToAlign
- The components to which the individual alignment should be setFlexComponent.setAlignSelf(Alignment, HasElement...)
public FlexComponent.Alignment getVerticalComponentAlignment(Component component)
The default alignment for individual components is
Alignment#AUTO
.
It's the same as the getAlignSelf(HasElement)
method.
component
- The component which individual layout should be readnull
getAlignSelf(HasElement)
public void setDefaultVerticalComponentAlignment(FlexComponent.Alignment alignment)
#setVerticalComponentAlignment(Alignment, Component...)
method.
It effectively sets the "alignItems"
style value.
The default alignment is Alignment#STRETCH
.
It's the same as the FlexComponent.setAlignItems(Alignment)
method.
alignment
- the alignment to apply to the components. Setting
null
will reset the alignment to its defaultFlexComponent.setAlignItems(Alignment)
public FlexComponent.Alignment getDefaultVerticalComponentAlignment()
The default alignment is Alignment#STRETCH
.
This is the same as the getAlignItems()
method.
null
public void setAlignItems(FlexComponent.Alignment alignment)
#setDefaultVerticalComponentAlignment(Alignment)
.setAlignItems
in interface FlexComponent<HorizontalLayout>
alignment
- the alignment to apply to the components. Setting
null
will reset the alignment to its default#setDefaultVerticalComponentAlignment(Alignment)
public FlexComponent.Alignment getAlignItems()
getDefaultVerticalComponentAlignment()
.getAlignItems
in interface FlexComponent<HorizontalLayout>
null
public void setAlignSelf(FlexComponent.Alignment alignment, HasElement... elementContainers)
#setVerticalComponentAlignment(Alignment, Component...)
.setAlignSelf
in interface FlexComponent<HorizontalLayout>
alignment
- the individual alignment for the children components. Setting
null
will reset the alignment to its defaultelementContainers
- The element containers (components) to which the individual
alignment should be set#setVerticalComponentAlignment(Alignment, Component...)
public FlexComponent.Alignment getAlignSelf(HasElement container)
getVerticalComponentAlignment(Component)
.getAlignSelf
in interface FlexComponent<HorizontalLayout>
container
- The element container (component) which individual layout
should be readnull
getVerticalComponentAlignment(Component)
public void addAndExpand(Component... components)
components
- the components to set, not null
Copyright © 2022. All rights reserved.