Class FormLayout

All Implemented Interfaces:
LayoutEvents.LayoutClickNotifier, ClientConnector, Sizeable, ComponentContainer, HasComponents, HasComponents.ComponentAttachDetachNotifier, Layout.AlignmentHandler, Layout.MarginHandler, com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasLabel, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.shared.HasTooltip, Serializable, Iterable<com.vaadin.flow.component.Component>

@Tag("div") @CssImport("./ordered-layout.css") @CssImport("./margin.css") @JsModule("./form-layout-styles.js") public class FormLayout extends AbstractOrderedLayout

Legacy version of FormLayout that resembles Vaadin 7/8's FormLayout API as closely as possible in order to facilitate migration to newer versions of Vaadin.

FormLayout is used to layout fields. FormLayout is a close relative of VerticalLayout, but in FormLayout captions are rendered to the left of their respective components.

See Also:
  • Field Details

  • Constructor Details

    • FormLayout

      public FormLayout()
      Creates a new a FormLayout.
    • FormLayout

      public FormLayout(com.vaadin.flow.component.Component... children)
      Constructs a FormLayout and adds the given components to it.
      Parameters:
      children - Components to add to the FormLayout
  • Method Details

    • getExpandRatio

      @Deprecated public float getExpandRatio(com.vaadin.flow.component.Component component)
      Deprecated.
      This method currently has no effect as expand ratios are not implemented in FormLayout.
      Overrides:
      getExpandRatio in class AbstractOrderedLayout
      Parameters:
      component - which expand ratios is requested
      Returns:
      expand ratio of given component, 0.0f by default.
    • setExpandRatio

      public void setExpandRatio(com.vaadin.flow.component.Component component, float ratio)
      This method currently has no effect as expand ratios are not implemented in FormLayout.
      Overrides:
      setExpandRatio in class AbstractOrderedLayout
      Parameters:
      component - the component in this layout which expand ratio is to be set
      ratio - new expand ratio (greater or equal to 0)
    • addComponent

      public void addComponent(com.vaadin.flow.component.Component component)
      Description copied from interface: ComponentContainer
      Adds the component into this container.
      Specified by:
      addComponent in interface ComponentContainer
      Overrides:
      addComponent in class AbstractOrderedLayout
      Parameters:
      component - the component to be added.
    • removeComponent

      public void removeComponent(com.vaadin.flow.component.Component component)
      Description copied from interface: ComponentContainer
      Removes the component from this container.
      Specified by:
      removeComponent in interface ComponentContainer
      Overrides:
      removeComponent in class AbstractOrderedLayout
      Parameters:
      component - the component to be removed.
    • getComponentIndex

      public int getComponentIndex(com.vaadin.flow.component.Component component)
      Description copied from class: AbstractOrderedLayout
      Returns the index of the given component.
      Overrides:
      getComponentIndex in class AbstractOrderedLayout
      Parameters:
      component - The component to look up.
      Returns:
      The index of the component or -1 if the component is not a child.
    • getComponent

      public com.vaadin.flow.component.Component getComponent(int index) throws IndexOutOfBoundsException
      Description copied from class: AbstractOrderedLayout
      Returns the component at the given position.
      Overrides:
      getComponent in class AbstractOrderedLayout
      Parameters:
      index - The position of the component.
      Returns:
      The component at the given index.
      Throws:
      IndexOutOfBoundsException - If the index is out of range.
    • addComponent

      public void addComponent(com.vaadin.flow.component.Component component, int index) throws IndexOutOfBoundsException
      Description copied from class: AbstractOrderedLayout
      Adds a component into indexed position in this container.
      Overrides:
      addComponent in class AbstractOrderedLayout
      Parameters:
      component - the component to be added.
      index - the index of the component position. The components currently in and after the position are shifted forwards.
      Throws:
      IndexOutOfBoundsException
    • setSlotClasses

      protected void setSlotClasses()
      This method currently has no effect since the FormLayout has the table as its only child.
      Overrides:
      setSlotClasses in class AbstractOrderedLayout
    • getChildren

      public Stream<com.vaadin.flow.component.Component> getChildren()
      Overrides:
      getChildren in class AbstractOrderedLayout