Class GridLayout
java.lang.Object
com.vaadin.featurepack.desktop.layouts.AbstractLayout
com.vaadin.featurepack.desktop.layouts.GridLayout
- All Implemented Interfaces:
Serializable
Grid layout arranges components in a grid of equal-sized rectangles.
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newGridLayoutwith a default of a single row.GridLayout(int rows, int columns) Constructs a newGridLayoutwith the specified number of rows and columns.GridLayout(int rows, int columns, int hgap, int vgap) Constructs a newGridLayoutwith the specified number of rows and columns, using specified horizontal and vertical gaps between components. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComponent(com.vaadin.flow.component.Component component) getConstraints(com.vaadin.flow.component.Component component) intgetHgap()Returns the horizontal gap between components.intgetVgap()Returns the vertical gap between components.protected voidonContainerAttach(com.vaadin.flow.component.AttachEvent event) voidremoveComponent(com.vaadin.flow.component.Component component) voidsetConstraints(com.vaadin.flow.component.Component component, Object constraints) voidsetContainer(com.vaadin.flow.component.Component container) voidsetHgap(int hgap) Sets the horizontal gap between components.voidsetVgap(int vgap) Sets the vertical gap between components.Methods inherited from class com.vaadin.featurepack.desktop.layouts.AbstractLayout
getComponents, getContainer, onContainerDetach
-
Constructor Details
-
GridLayout
public GridLayout()Constructs a newGridLayoutwith a default of a single row. -
GridLayout
public GridLayout(int rows, int columns) Constructs a newGridLayoutwith the specified number of rows and columns. One, but not both, ofrowsandcolumnscan be set to zero, which means that any number of objects can be placed in a row or in a column. When bothrowsandcolumnsare specified, therowsvalue takes precedence and the count of columns is calculated.- Parameters:
rows- the number of rows, with the value zero meaning any number of rows.columns- the number of columns, with the value zero meaning any number of columns.
-
GridLayout
public GridLayout(int rows, int columns, int hgap, int vgap) Constructs a newGridLayoutwith the specified number of rows and columns, using specified horizontal and vertical gaps between components.- Parameters:
rows- the number of rows, with the value zero meaning any number of rowscolumns- the number of columns, with the value zero meaning any number of columnshgap- the horizontal gapvgap- the vertical gap- Throws:
IllegalArgumentException- if the value of bothrowsandcolumnsis set to zero
-
-
Method Details
-
onContainerAttach
protected void onContainerAttach(com.vaadin.flow.component.AttachEvent event) - Overrides:
onContainerAttachin classAbstractLayout
-
setContainer
public void setContainer(com.vaadin.flow.component.Component container) - Overrides:
setContainerin classAbstractLayout
-
addComponent
public void addComponent(com.vaadin.flow.component.Component component) - Overrides:
addComponentin classAbstractLayout
-
removeComponent
public void removeComponent(com.vaadin.flow.component.Component component) - Overrides:
removeComponentin classAbstractLayout
-
getHgap
public int getHgap()Returns the horizontal gap between components.- Returns:
- the horizontal gap between components
-
setHgap
public void setHgap(int hgap) Sets the horizontal gap between components.- Parameters:
hgap- the horizontal gap between components
-
getVgap
public int getVgap()Returns the vertical gap between components.- Returns:
- the vertical gap between components
-
setVgap
public void setVgap(int vgap) Sets the vertical gap between components.- Parameters:
vgap- the vertical gap between components
-
setConstraints
- Specified by:
setConstraintsin classAbstractLayout- Throws:
UnsupportedOperationException- GridLayout does not support constraints
-
getConstraints
- Specified by:
getConstraintsin classAbstractLayout- Throws:
UnsupportedOperationException- GridLayout does not support constraints
-