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 RowPaddingNONEConstant for no padding.
-
Constructor Summary
Constructors Constructor Description RowPadding(int beginning, int end)Creates information about padding a row.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RowPaddingcentred(int cells, int columns, boolean whenOddPutMoreToBeginning)CreatesRowPaddingwhere given number of cells are centred in given number of columns (optionally putting one odd cell to the beginning).booleanequals(Object o)intgetBeginning()Returns the number of empty cells at the beginning of the row.intgetEnd()Returns the number of empty cells at the end of the row.inthashCode()
-
-
-
Field Detail
-
NONE
public static final RowPadding NONE
Constant for no padding.
-
-
Constructor Detail
-
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 eitherbeginningorendare negative.
-
-
Method Detail
-
centred
public static RowPadding centred(int cells, int columns, boolean whenOddPutMoreToBeginning)
CreatesRowPaddingwhere 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,NONEwill 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 istrue, 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.
-
-