Class RowPadding
java.lang.Object
org.vaadin.miki.superfields.itemgrid.RowPadding
Contains data about how to pad a given row.
- Since:
- 2020-12-15
- Author:
- miki
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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).booleanintReturns 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 Details
-
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 eitherbeginningorendare negative.
-
-
Method Details
-
centred
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.
-
equals
-
hashCode
public int hashCode()
-