Interface FlexComponent

    • Method Detail

      • setAlignItems

        default void setAlignItems​(FlexComponent.Alignment alignment)
        Sets the default alignment to be used by all components without individual alignments inside the layout. Individual components can be aligned by using the setAlignSelf(Alignment, HasElement...) method.

        It effectively sets the "alignItems" style value.

        The default alignment is FlexComponent.Alignment.STRETCH.

        Parameters:
        alignment - the alignment to apply to the components. Setting null will reset the alignment to its default
      • getAlignItems

        default FlexComponent.Alignment getAlignItems()
        Gets the default alignment used by all components without individual alignments inside the layout.

        The default alignment is FlexComponent.Alignment.STRETCH.

        Returns:
        the general alignment used by the layout, never null
      • setAlignSelf

        default void setAlignSelf​(FlexComponent.Alignment alignment,
                                  HasElement... elementContainers)
        Sets an alignment for individual element container inside the layout. This individual alignment for the element container overrides any alignment set at the setAlignItems(Alignment).

        It effectively sets the "alignSelf" style value.

        The default alignment for individual components is FlexComponent.Alignment.AUTO.

        Parameters:
        alignment - the individual alignment for the children components. Setting null will reset the alignment to its default
        elementContainers - The element containers (components) to which the individual alignment should be set
      • getAlignSelf

        default FlexComponent.Alignment getAlignSelf​(HasElement container)
        Gets the individual alignment of a given element container.

        The default alignment for individual element containers is FlexComponent.Alignment.AUTO.

        Parameters:
        container - The element container (component) which individual layout should be read
        Returns:
        the alignment of the container, never null
      • setFlexGrow

        default void setFlexGrow​(double flexGrow,
                                 HasElement... elementContainers)
        Sets the flex grow property of the components inside the layout. The flex grow property specifies what amount of the available space inside the layout the component should take up, proportionally to the other components.

        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.

        Parameters:
        flexGrow - the proportion of the available space the element container should take up
        elementContainers - the containers (components) to apply the flex grow property
      • getFlexGrow

        default double getFlexGrow​(HasElement elementContainer)
        Gets the flex grow property of a given element container.
        Parameters:
        elementContainer - the element container to read the flex grow property from
        Returns:
        the flex grow property, or 0 if none was set
      • expand

        default void expand​(Component... componentsToExpand)
        Expands the given components.

        It effectively sets 1 as a flex grow property value for each component.

        Parameters:
        componentsToExpand - components to expand
      • replace

        default void replace​(Component oldComponent,
                             Component newComponent)
        Description copied from interface: HasOrderedComponents
        Replaces the component in the container with another one without changing position. This method replaces component with another one is such way that the new component overtakes the position of the old component. If the old component is not in the container, the new component is added to the container. If the both component are already in the container, their positions are swapped. Component attach and detach events should be taken care as with add and remove.
        Specified by:
        replace in interface HasOrderedComponents
        Parameters:
        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 other
        newComponent - the new component to be replaced. Can be null, which will make the oldComponent to be removed from the layout without adding any other