public interface FlexComponent extends HasOrderedComponents, HasStyle, HasSize
Modifier and Type | Interface and Description |
---|---|
static class |
FlexComponent.Alignment
Enum with the possible values for the component alignment inside the
layout.
|
static class |
FlexComponent.JustifyContentMode
Enum with the possible values for the way the extra space inside the
layout is distributed among the components.
|
Modifier and Type | Method and Description |
---|---|
default void |
expand(Component... componentsToExpand)
Expands the given components.
|
default FlexComponent.Alignment |
getAlignItems()
Gets the default alignment used by all components without individual
alignments inside the layout.
|
default FlexComponent.Alignment |
getAlignSelf(HasElement container)
Gets the individual alignment of a given element container.
|
default double |
getFlexGrow(HasElement elementContainer)
Gets the flex grow property of a given element container.
|
default FlexComponent.JustifyContentMode |
getJustifyContentMode()
Gets the current justify content mode of the layout.
|
default void |
replace(Component oldComponent,
Component newComponent)
Replaces the component in the container with another one without changing
position.
|
default void |
setAlignItems(FlexComponent.Alignment alignment)
Sets the default alignment to be used by all components without
individual alignments inside the layout.
|
default void |
setAlignSelf(FlexComponent.Alignment alignment,
HasElement... elementContainers)
Sets an alignment for individual element container inside the layout.
|
default void |
setFlexGrow(double flexGrow,
HasElement... elementContainers)
Sets the flex grow property of the components inside the layout.
|
default void |
setJustifyContentMode(FlexComponent.JustifyContentMode justifyContentMode)
Sets the
FlexComponent.JustifyContentMode used by this layout. |
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
default void setAlignItems(FlexComponent.Alignment alignment)
setAlignSelf(Alignment, HasElement...)
method.
It effectively sets the "alignItems"
style value.
The default alignment is FlexComponent.Alignment.STRETCH
.
alignment
- the alignment to apply to the components. Setting
null
will reset the alignment to its defaultdefault FlexComponent.Alignment getAlignItems()
The default alignment is FlexComponent.Alignment.STRETCH
.
null
default void setAlignSelf(FlexComponent.Alignment alignment, HasElement... elementContainers)
setAlignItems(Alignment)
.
It effectively sets the "alignSelf"
style value.
The default alignment for individual components is
FlexComponent.Alignment.AUTO
.
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 setdefault FlexComponent.Alignment getAlignSelf(HasElement container)
The default alignment for individual element containers is
FlexComponent.Alignment.AUTO
.
container
- The element container (component) which individual layout
should be readnull
default void setFlexGrow(double flexGrow, HasElement... elementContainers)
For example, if all components have a flex grow property value set to 1, the remaining space in the layout will be distributed equally to all components inside the layout. If you set a flex grow property of one component to 2, that component will take twice the available space as the other components, and so on.
Setting to flex grow property value 0 disables the expansion of the element container. Negative values are not allowed.
flexGrow
- the proportion of the available space the element container
should take upelementContainers
- the containers (components) to apply the flex grow propertydefault double getFlexGrow(HasElement elementContainer)
elementContainer
- the element container to read the flex grow property fromdefault void setJustifyContentMode(FlexComponent.JustifyContentMode justifyContentMode)
FlexComponent.JustifyContentMode
used by this layout.
The default justify content mode is FlexComponent.JustifyContentMode.START
.
justifyContentMode
- the justify content mode of the layout, never
null
default FlexComponent.JustifyContentMode getJustifyContentMode()
The default justify content mode is FlexComponent.JustifyContentMode.START
.
null
default void expand(Component... componentsToExpand)
It effectively sets 1
as a flex grow property value for each
component.
componentsToExpand
- components to expanddefault void replace(Component oldComponent, Component newComponent)
HasOrderedComponents
replace
in interface HasOrderedComponents
oldComponent
- the old component that will be replaced. Can be
null
, which will make the newComponent to be
added to the layout without replacing any othernewComponent
- the new component to be replaced. Can be null
,
which will make the oldComponent to be removed from the layout
without adding any otherCopyright © 2022. All rights reserved.