Enum Class UniformGridLayout.OverflowGrowth
- All Implemented Interfaces:
Serializable,Comparable<UniformGridLayout.OverflowGrowth>,Constable
- Enclosing class:
UniformGridLayout
UniformGridLayout grows when a container holds more
components than the declared number of rows times the declared number of columns, so that
every component still gets a cell of its own.
A grid can overflow whenever its declared number of rows and its declared number of columns
are both greater than 0, in either UniformGridLayout.Mode: both modes then have a fixed number of cells
to run out of. A number of rows or columns of 0 means "as many as the components need", which
leaves that axis free to grow on its own, so such a grid never overflows and this setting
never changes it.
The UniformGridLayout.Mode shapes the grid up to that point and this setting shapes it from there on, so
two grids which differ only in their mode are laid out alike once both have overflowed. This is
how a grid declared with 2 rows and 5 columns, which has 10 cells, grows for 13 components, as
rows × columns: ADD_ROWS 3 × 5, ADD_COLUMNS 2 × 7 and
ADD_ROWS_AND_COLUMNS 3 × 6. The grid grows before the UniformGridLayout.CollapseEmpty setting
leaves out the rows and columns which no component occupies.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionColumns are added at the right until every component has a cell, and the grid keeps its declared number of rows.Rows are added at the bottom until every component has a cell, and the grid keeps its declared number of columns.Rows and columns are added one at a time, each time the one which keeps the ratio of rows to columns closest to the declared ratio, until every component has a cell. -
Method Summary
Modifier and TypeMethodDescriptionReturns the enum constant of this class with the specified name.static UniformGridLayout.OverflowGrowth[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ADD_ROWS
Rows are added at the bottom until every component has a cell, and the grid keeps its declared number of columns. A grid of 2 rows and 5 columns lays out 13 components in 3 rows of 5 columns, and 30 components in 6 rows of 5 columns. This is the default.In the mode
UniformGridLayout.Mode.WRAP_AFTER_COLUMNS, this is the only setting under which the component at indexistays in rowi / columnsand columni % columnshowever many components there are, so it is the only one under which adding a component never moves one of the components before it into another row or column. -
ADD_COLUMNS
Columns are added at the right until every component has a cell, and the grid keeps its declared number of rows. A grid of 2 rows and 5 columns lays out 13 components in 2 rows of 7 columns, and 30 components in 2 rows of 15 columns.This is the one policy which keeps making room the way a
GridLayoutmakes room, so it is the growth policy the modeUniformGridLayout.Mode.SPREAD_OVER_ROWSneeds, alongsideUniformGridLayout.CollapseEmpty.NONE, to lay out components exactly like one. The mode still decides the grid below the declared number of cells: withUniformGridLayout.Mode.WRAP_AFTER_COLUMNSa grid of 2 rows and 5 columns lays out 3 components in 5 columns, and withUniformGridLayout.Mode.SPREAD_OVER_ROWSit lays them out in 2. -
ADD_ROWS_AND_COLUMNS
Rows and columns are added one at a time, each time the one which keeps the ratio of rows to columns closest to the declared ratio, until every component has a cell. The grid therefore keeps its shape as closely as whole rows and columns allow, and so do its cells: the container does not change size while the grid grows, so a cell of a grid ofrrows andccolumns iswidth / cbyheight / rlarge, and holdingr / cat the declared ratio holds the shape of every cell as well.A grid of 2 rows and 5 columns lays out 13 components in 3 rows of 6 columns, and 30 components in 4 rows of 9 columns. When the declared numbers scale up evenly, the ratio is kept exactly and no cell is left over: a grid of 1 row and 4 columns lays out 400 components, 100 times its 4 cells, in exactly 10 rows of 40 columns.
Growing both numbers can leave more empty cells behind than
ADD_ROWSorADD_COLUMNSdo, because the last row of the grid is the one which absorbs the difference: 13 components in 3 rows of 6 columns leave 5 cells of the last row empty.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-