Class RowPadding

java.lang.Object
org.vaadin.miki.superfields.itemgrid.RowPadding

public final class RowPadding extends Object
Contains data about how to pad a given row.
Since:
2020-12-15
Author:
miki
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final RowPadding
    Constant for no padding.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RowPadding(int beginning, int end)
    Creates information about padding a row.
  • Method Summary

    Modifier and Type
    Method
    Description
    static RowPadding
    centred(int cells, int columns, boolean whenOddPutMoreToBeginning)
    Creates RowPadding where given number of cells are centred in given number of columns (optionally putting one odd cell to the beginning).
    boolean
     
    int
    Returns the number of empty cells at the beginning of the row.
    int
    Returns the number of empty cells at the end of the row.
    int
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NONE

      public static final RowPadding NONE
      Constant for no padding.
  • Constructor Details

    • RowPadding

      public RowPadding(int beginning, int end)
      Creates information about padding a row.
      Parameters:
      beginning - Number of empty cells at the beginning of the row. Must not be a negative number,
      end - Number of empty cells at the end of the row. Must not be a negative number.
      Throws:
      IllegalArgumentException - When either beginning or end are negative.
  • Method Details

    • centred

      public static RowPadding centred(int cells, int columns, boolean whenOddPutMoreToBeginning)
      Creates RowPadding where given number of cells are centred in given number of columns (optionally putting one odd cell to the beginning).
      Parameters:
      cells - Number of cells to split. If not less than columns, NONE will be returned.
      columns - Number of columns to fill. Must be a positive number.
      whenOddPutMoreToBeginning - When there is odd number of empty cells to distribute and this parameter is true, extra empty cell will be added to the beginning. Otherwise, it will be added to the end if needed.
      Returns:
      Row padding data.
    • getBeginning

      public int getBeginning()
      Returns the number of empty cells at the beginning of the row.
      Returns:
      Non-negative number of empty cells at the beginning of the row.
    • getEnd

      public int getEnd()
      Returns the number of empty cells at the end of the row.
      Returns:
      Non-negative number of empty cells at the beginning of the row.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object