com.vaadin.flow.component.formlayout.
Class FormLayout
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.flow.component.formlayout.GeneratedVaadinFormLayout<FormLayout>
-
- com.vaadin.flow.component.formlayout.FormLayout
-
All Implemented Interfaces:
AttachNotifier, ClickNotifier<FormLayout>, DetachNotifier, HasComponents, HasElement, HasEnabled, HasSize, HasStyle, Serializable
public class FormLayout extends GeneratedVaadinFormLayout<FormLayout> implements HasSize, HasComponents, ClickNotifier<FormLayout>
Server-side component for the
<vaadin-form-layout>
element.Author:
Vaadin Ltd
See Also:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
FormLayout.FormItem
Server-side component for the
<vaadin-form-item>
element.static class
FormLayout.ResponsiveStep
A class used in describing the responsive layouting behavior of a
FormLayout
.
-
Constructor Summary
Constructors Constructor and Description FormLayout()
Constructs an empty layout.
FormLayout(Component... components)
Constructs a FormLayout with the given initial components.
-
Method Summary
All Methods Modifier and Type Method and Description void
add(Component component, int colspan)
Adds a component with the desired colspan.
FormLayout.FormItem
addFormItem(Component field, Component label)
Convenience method for creating and adding a new FormItem to this layout that wraps the given field with a component as its label.
FormLayout.FormItem
addFormItem(Component field, String label)
Convenience method for creating and adding a new FormItem to this layout that wraps the given field with a label.
int
getColspan(Component component)
Gets the colspan of the given component.
List<FormLayout.ResponsiveStep>
getResponsiveSteps()
Get the list of
FormLayout.ResponsiveStep
s used to configure this layout.void
setColspan(Component component, int colspan)
Sets the colspan of the given component's element.
void
setResponsiveSteps(FormLayout.ResponsiveStep... steps)
Configure the responsive steps used in this layout.
void
setResponsiveSteps(List<FormLayout.ResponsiveStep> steps)
Configure the responsive steps used in this layout.
-
Methods inherited from class com.vaadin.flow.component.formlayout.GeneratedVaadinFormLayout
getResponsiveStepsJsonObject, setResponsiveSteps, updateStyles
-
Methods inherited from class com.vaadin.flow.component.Component
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.flow.component.HasSize
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
-
Methods inherited from interface com.vaadin.flow.component.HasComponents
add, add, addComponentAsFirst, addComponentAtIndex, remove, removeAll
-
Methods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabled
-
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
-
Methods inherited from interface com.vaadin.flow.component.ClickNotifier
addClickListener, addClickShortcut
-
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
-
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
-
-
-
-
Constructor Detail
-
FormLayout
public FormLayout()
Constructs an empty layout. Components can be added with
HasComponents.add(Component...)
.
-
FormLayout
public FormLayout(Component... components)
Constructs a FormLayout with the given initial components. Additional components can be added after construction with
HasComponents.add(Component...)
.Parameters:
components
- the components to addSee Also:
-
-
Method Detail
-
setColspan
public void setColspan(Component component, int colspan)
Sets the colspan of the given component's element. Will default to 1 if an integer lower than 1 is supplied. You can directly add components with the wanted colspan with
add(Component, int)
.Parameters:
component
- the component to set the colspan for, notnull
colspan
- the desired colspan for the component
-
add
public void add(Component component, int colspan)
Adds a component with the desired colspan. This method is a shorthand for calling
#add(Component)
andsetColspan(Component, int)
Parameters:
component
- the component to addcolspan
- the desired colspan for the component
-
getColspan
public int getColspan(Component component)
Gets the colspan of the given component. If none is set, returns 1.
Parameters:
component
- the component whose colspan is retrieved
-
getResponsiveSteps
public List<FormLayout.ResponsiveStep> getResponsiveSteps()
Get the list of
FormLayout.ResponsiveStep
s used to configure this layout.Returns:
the list of
FormLayout.ResponsiveStep
s used to configure this layoutSee Also:
-
setResponsiveSteps
public void setResponsiveSteps(List<FormLayout.ResponsiveStep> steps)
Configure the responsive steps used in this layout.
Parameters:
steps
- list ofFormLayout.ResponsiveStep
s to setSee Also:
-
setResponsiveSteps
public void setResponsiveSteps(FormLayout.ResponsiveStep... steps)
Configure the responsive steps used in this layout.
Parameters:
steps
- theFormLayout.ResponsiveStep
s to setSee Also:
-
addFormItem
public FormLayout.FormItem addFormItem(Component field, String label)
Convenience method for creating and adding a new FormItem to this layout that wraps the given field with a label. Shorthand for
addFormItem(field, new Label(label))
.Parameters:
field
- the field component to wraplabel
- the label text to setReturns:
the created form item
See Also:
-
addFormItem
public FormLayout.FormItem addFormItem(Component field, Component label)
Convenience method for creating and adding a new FormItem to this layout that wraps the given field with a component as its label.
Parameters:
field
- the field component to wraplabel
- the label component to setReturns:
the created form item
-
-