Class FlexLayout

    • Constructor Detail

      • FlexLayout

        public FlexLayout()
        Default constructor. Creates an empty layout.
      • FlexLayout

        public FlexLayout​(Component... children)
        Convenience constructor to create a layout with the children already inside it.
        Parameters:
        children - the items to add to this layout
        See Also:
        HasComponents.add(Component...)
    • Method Detail

      • setFlexBasis

        public void setFlexBasis​(String width,
                                 HasElement... elementContainers)
        Sets the flex basis property of the components inside the layout. The flex basis property specifies the initial main size of a component.
        Parameters:
        width - the width for the components. Setting null will remove the flex basis property
        elementContainers - the containers (components) to apply the flex basis property
      • getFlexBasis

        public String getFlexBasis​(HasElement elementContainer)
        Gets the flex basis property of a given element container.
        Parameters:
        elementContainer - the element container to read the flex basis property from
        Returns:
        the flex grow property
      • setFlexDirection

        public void setFlexDirection​(FlexLayout.FlexDirection flexDirection)
        Sets the flex direction property of the layout. The flex direction property specifies how components are placed in the layout defining the main axis and the direction (normal or reversed). The default direction is FlexLayout.FlexDirection.ROW.
        Parameters:
        flexDirection - the direction for the components. Setting null will remove the flex direction property
      • getFlexDirection

        public FlexLayout.FlexDirection getFlexDirection​(HasElement elementContainer)
        Gets the flex direction property of a given element container.
        Parameters:
        elementContainer - the element container to read the flex direction property from
        Returns:
        the flex direction property, or FlexLayout.FlexDirection.ROW if none was set
      • setFlexShrink

        public void setFlexShrink​(double flexShrink,
                                  HasElement... elementContainers)
        Sets the flex shrink property of the components inside the layout. The flex shrink property specifies how the item will shrink relative to the rest of the components inside the same layout. Negative values are not allowed. The default value is 1.
        Parameters:
        flexShrink - how much the component will shrink relative to the rest of the components
        elementContainers - the containers (components) to apply the flex shrink property
      • getFlexShrink

        public double getFlexShrink​(HasElement elementContainer)
        Gets the flex shrink property of a given element container.
        Parameters:
        elementContainer - the element container to read the flex shrink property from
        Returns:
        the flex shrink property, or 1 if none was set
      • setOrder

        public void setOrder​(int order,
                             HasElement elementContainer)
        Sets the order property of the component inside the layout. The order property specifies the order of a component relative to the rest of the components inside the same layout. The default value is 0, and setting 0 can be used to remove an existing order for a component.
        Parameters:
        order - the order for the component
        elementContainer - the container (component) to apply the order property
      • getOrder

        public int getOrder​(HasElement elementContainer)
        Gets the order property of a given element container.
        Parameters:
        elementContainer - the element container to read the order property from
        Returns:
        the order property, or 0 if none was set