Class GridLayout

java.lang.Object
com.vaadin.featurepack.desktop.layouts.AbstractLayout
com.vaadin.featurepack.desktop.layouts.GridLayout
All Implemented Interfaces:
Serializable

public class GridLayout extends AbstractLayout
Grid layout arranges components in a grid of equal-sized rectangles.
Author:
Vaadin Ltd
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new GridLayout with a default of a single row.
    GridLayout(int rows, int columns)
    Constructs a new GridLayout with the specified number of rows and columns.
    GridLayout(int rows, int columns, int hgap, int vgap)
    Constructs a new GridLayout with the specified number of rows and columns, using specified horizontal and vertical gaps between components.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addComponent(com.vaadin.flow.component.Component component)
     
    getConstraints(com.vaadin.flow.component.Component component)
     
    int
    Returns the horizontal gap between components.
    int
    Returns the vertical gap between components.
    protected void
    onContainerAttach(com.vaadin.flow.component.AttachEvent event)
     
    void
    removeComponent(com.vaadin.flow.component.Component component)
     
    void
    setConstraints(com.vaadin.flow.component.Component component, Object constraints)
     
    void
    setContainer(com.vaadin.flow.component.Component container)
     
    void
    setHgap(int hgap)
    Sets the horizontal gap between components.
    void
    setVgap(int vgap)
    Sets the vertical gap between components.

    Methods inherited from class com.vaadin.featurepack.desktop.layouts.AbstractLayout

    getComponents, getContainer, onContainerDetach

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GridLayout

      public GridLayout()
      Constructs a new GridLayout with a default of a single row.
    • GridLayout

      public GridLayout(int rows, int columns)
      Constructs a new GridLayout with the specified number of rows and columns. One, but not both, of rows and columns can be set to zero, which means that any number of objects can be placed in a row or in a column. When both rows and columns are specified, the rows value 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 new GridLayout with 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 rows
      columns - the number of columns, with the value zero meaning any number of columns
      hgap - the horizontal gap
      vgap - the vertical gap
      Throws:
      IllegalArgumentException - if the value of both rows and columns is set to zero
  • Method Details

    • onContainerAttach

      protected void onContainerAttach(com.vaadin.flow.component.AttachEvent event)
      Overrides:
      onContainerAttach in class AbstractLayout
    • setContainer

      public void setContainer(com.vaadin.flow.component.Component container)
      Overrides:
      setContainer in class AbstractLayout
    • addComponent

      public void addComponent(com.vaadin.flow.component.Component component)
      Overrides:
      addComponent in class AbstractLayout
    • removeComponent

      public void removeComponent(com.vaadin.flow.component.Component component)
      Overrides:
      removeComponent in class AbstractLayout
    • 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

      public void setConstraints(com.vaadin.flow.component.Component component, Object constraints)
      Specified by:
      setConstraints in class AbstractLayout
      Throws:
      UnsupportedOperationException - GridLayout does not support constraints
    • getConstraints

      public Object getConstraints(com.vaadin.flow.component.Component component)
      Specified by:
      getConstraints in class AbstractLayout
      Throws:
      UnsupportedOperationException - GridLayout does not support constraints