-
- All Implemented Interfaces:
-
kotlin.collections.Iterable
public class GridPane<T extends ComponentView> extends LayoutView<T> implements Iterable<GridIteratorElement<T>>
Defines a LayoutView that orders components in a grid structure.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
GridPane.Companion
-
Field Summary
-
Method Summary
Modifier and Type Method Description final Integer
getColumns()
final Integer
getRows()
final Double
getSpacing()
Current spacing. final Unit
setSpacing(Double spacing)
final ComponentView
getParent()
The parent of this ComponentView. final Unit
setParent(ComponentView parent)
final String
getName()
Name field only for debugging purposes. final Unit
setName(String name)
Name field only for debugging purposes. final DoubleProperty
getPosXProperty()
Property for the horizontal position of this ComponentView. final Double
getPosX()
final Unit
setPosX(Double posX)
final Double
getActualPosX()
final Unit
setActualPosX(Double actualPosX)
final DoubleProperty
getPosYProperty()
Property for the vertical position of this ComponentView. final Double
getPosY()
final Unit
setPosY(Double posY)
final Double
getActualPosY()
final Unit
setActualPosY(Double actualPosY)
final DoubleProperty
getWidthProperty()
Property for the width of this ComponentView. final Double
getWidth()
final Unit
setWidth(Double width)
final Double
getActualWidth()
final Unit
setActualWidth(Double actualWidth)
final DoubleProperty
getHeightProperty()
Property for the height of this ComponentView. final Double
getHeight()
final Unit
setHeight(Double height)
final Double
getActualHeight()
final Unit
setActualHeight(Double actualHeight)
final DoubleProperty
getScaleXProperty()
Property for the horizontal scale of this ComponentView. final Double
getScaleX()
final Unit
setScaleX(Double scaleX)
final DoubleProperty
getScaleYProperty()
Property for the vertical scale of this ComponentView. final Double
getScaleY()
final Unit
setScaleY(Double scaleY)
final Double
getScale()
final Unit
setScale(Double scale)
final CoordinatePlain
getLayoutBounds()
final Unit
setLayoutBounds(CoordinatePlain layoutBounds)
final DoubleProperty
getRotationProperty()
Property for the rotation of this ComponentView in degrees. final Double
getRotation()
final Unit
setRotation(Double rotation)
Visual
getVisual()
Unit
setVisual(Visual visual)
Sets a copy of the given Visual to this field and refreshes GUI. final LimitedDoubleProperty
getOpacityProperty()
Property for the opacity of this ComponentView. final Double
getOpacity()
final Unit
setOpacity(Double opacity)
final BooleanProperty
getIsVisibleProperty()
Property for the visibility of this ComponentView. final Boolean
getIsVisible()
final Unit
setIsVisible(Boolean isVisible)
final BooleanProperty
getIsDisabledProperty()
Property that controls if user input events cause input functions of this ComponentView to get invoked. final Boolean
getIsDisabled()
final Unit
setIsDisabled(Boolean isDisabled)
final BooleanProperty
getIsFocusableProperty()
Property that controls whether this ComponentView is focusable or not. final Boolean
getIsFocusable()
final Unit
setIsFocusable(Boolean isFocusable)
final Function1<MouseEvent, Unit>
getOnMouseEntered()
Gets invoked with a MouseEvent whenever the mouse enters this ComponentView. final Unit
setOnMouseEntered(Function1<MouseEvent, Unit> onMouseEntered)
Gets invoked with a MouseEvent whenever the mouse enters this ComponentView. final Function1<MouseEvent, Unit>
getOnMouseExited()
Gets invoked with a MouseEvent whenever the mouse leaves this ComponentView. final Unit
setOnMouseExited(Function1<MouseEvent, Unit> onMouseExited)
Gets invoked with a MouseEvent whenever the mouse leaves this ComponentView. final Function1<MouseEvent, Unit>
getOnMousePressed()
Gets invoked with a MouseEvent whenever the mouse is pressed inside this ComponentView. final Unit
setOnMousePressed(Function1<MouseEvent, Unit> onMousePressed)
Gets invoked with a MouseEvent whenever the mouse is pressed inside this ComponentView. final Function1<MouseEvent, Unit>
getOnMouseReleased()
Gets invoked with a MouseEvent whenever the mouse is released inside this ComponentView. final Unit
setOnMouseReleased(Function1<MouseEvent, Unit> onMouseReleased)
Gets invoked with a MouseEvent whenever the mouse is released inside this ComponentView. final Function1<MouseEvent, Unit>
getOnMouseClicked()
Gets invoked with a MouseEvent whenever the mouse is clicked inside this ComponentView. final Unit
setOnMouseClicked(Function1<MouseEvent, Unit> onMouseClicked)
Gets invoked with a MouseEvent whenever the mouse is clicked inside this ComponentView. final Function1<KeyEvent, Unit>
getOnKeyPressed()
Gets invoked with a KeyEvent whenever a key is pressed while this ComponentView has focus. final Unit
setOnKeyPressed(Function1<KeyEvent, Unit> onKeyPressed)
Gets invoked with a KeyEvent whenever a key is pressed while this ComponentView has focus. final Function1<KeyEvent, Unit>
getOnKeyReleased()
Gets invoked with a KeyEvent whenever a key is released while this ComponentView has focus. final Unit
setOnKeyReleased(Function1<KeyEvent, Unit> onKeyReleased)
Gets invoked with a KeyEvent whenever a key is released while this ComponentView has focus. final Function1<KeyEvent, Unit>
getOnKeyTyped()
Gets invoked with a KeyEvent whenever a key is typed while this ComponentView has focus. final Unit
setOnKeyTyped(Function1<KeyEvent, Unit> onKeyTyped)
Gets invoked with a KeyEvent whenever a key is typed while this ComponentView has focus. final Function1<DragEvent, Boolean>
getDropAcceptor()
Returns whether this ComponentView is a valid drop target for the dragged component in the given DragEvent or not. final Unit
setDropAcceptor(Function1<DragEvent, Boolean> dropAcceptor)
Returns whether this ComponentView is a valid drop target for the dragged component in the given DragEvent or not. final Function1<DragEvent, Unit>
getOnDragGestureEntered()
Gets invoked with a DragEvent whenever the mouse enters this ComponentView while performing a drag gesture. final Unit
setOnDragGestureEntered(Function1<DragEvent, Unit> onDragGestureEntered)
Gets invoked with a DragEvent whenever the mouse enters this ComponentView while performing a drag gesture. final Function1<DragEvent, Unit>
getOnDragGestureExited()
Gets invoked with a DragEvent whenever the mouse leaves this ComponentView while performing a drag gesture. final Unit
setOnDragGestureExited(Function1<DragEvent, Unit> onDragGestureExited)
Gets invoked with a DragEvent whenever the mouse leaves this ComponentView while performing a drag gesture. final Function1<DragEvent, Unit>
getOnDragDropped()
Gets invoked with a DragEvent whenever a drag and drop gesture finishes over this ComponentView and the dropAcceptor returns true
for the given DragEvent.final Unit
setOnDragDropped(Function1<DragEvent, Unit> onDragDropped)
Gets invoked with a DragEvent whenever a drag and drop gesture finishes over this ComponentView and the dropAcceptor returns true
for the given DragEvent.final T
get(Integer columnIndex, Integer rowIndex)
Returns ComponentView in specified cell. final Unit
set(Integer columnIndex, Integer rowIndex, T component)
Sets content of desired grid cell. final Alignment
getCellCenterMode(Integer columnIndex, Integer rowIndex)
Returns centering mode as an Alignment of the specified cell. final Unit
setCellCenterMode(Integer columnIndex, Integer rowIndex, Alignment value)
Sets centering mode of desired grid cell with given Alignment. final Unit
setColumnCenterMode(Integer columnIndex, Alignment value)
Sets centering mode of desired column in grid with given Alignment. final Unit
setRowCenterMode(Integer rowIndex, Alignment value)
Sets centering mode of desired row in grid with given Alignment. final Unit
setCenterMode(Alignment value)
Sets centering mode of all cells in the grid with given Alignment. final Double
getColumnWidth(Integer columnIndex)
Returns the set column width for the given column. final Unit
setColumnWidth(Integer columnIndex, Number columnWidth)
Manually set column width of one column. final Unit
setColumnWidths(DoubleArray columnWidths)
Manually set column width of all columns. final Unit
setAutoColumnWidth(Integer columnIndex)
Restores automatic resizing behavior for desired column. final Unit
setAutoColumnWidths()
Restores automatic resizing behavior for all columns. final Double
getRowHeight(Integer rowIndex)
Returns the set row height for the given row. final Unit
setRowHeight(Integer rowIndex, Number rowHeight)
Manually set row height of one row. final Unit
setRowHeights(DoubleArray rowHeights)
Manually set row height of all rows. final Unit
setAutoRowHeight(Integer rowIndex)
Restores automatic resizing behavior for desired row. final Unit
setAutoRowHeights()
Restores automatic resizing behavior for all rows. final Boolean
grow(Integer left, Integer right, Integer top, Integer bottom)
Grows grid by specified dimensions, filling new cells with null
values.final Boolean
trim()
Removes all empty outer rows and columns e.g. final Unit
addColumns(Integer columnIndex, Integer count)
Adds the desired amount of columns between column <b>columnIndex - 1</b> and <b>columnIndex</b>. final Unit
removeColumn(Integer columnIndex)
Removes the desired column in the grid. final Unit
removeEmptyColumns()
Removes all empty columns e.g. final Unit
addRows(Integer rowIndex, Integer count)
Adds the desired amount of rows between row <b>rowIndex</b> and <b>rowIndex + 1</b>. final Unit
removeRow(Integer rowIndex)
Removes the desired row in the grid. final Unit
removeEmptyRows()
Removes all empty rows e.g. Iterator<GridIteratorElement<T>>
iterator()
Returns an Iterator over the grid components. -
Methods inherited from class tools.aqua.bgw.components.StaticComponentView
offset, removeFromParent, reposition, resize, rotate, scale, scaleX, scaleY
-
Methods inherited from class tools.aqua.bgw.components.layoutviews.GridPane
forEach, spliterator
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
GridPane
GridPane(Number posX, Number posY, Integer columns, Integer rows, Number spacing, Boolean layoutFromCenter, Visual visual)
Creates a GridPane with given rows and columns.- Parameters:
posX
- Horizontal coordinate for this GridPane.posY
- Vertical coordinate for this GridPane.columns
- Initial column count.rows
- Initial row count.spacing
- Spacing between rows and columns.layoutFromCenter
- Whether the GridPane should anchor in the center (true
) or top-Left (false
).visual
- Initial visual for this GridPane.
-
-
Method Detail
-
getColumns
final Integer getColumns()
-
getSpacing
final Double getSpacing()
Current spacing.
-
setSpacing
final Unit setSpacing(Double spacing)
-
getParent
final ComponentView getParent()
The parent of this ComponentView.
null
if this ComponentView is not contained in a GameComponentContainer, LayoutView, or a Scene.If the component has been added directly to a Scene, parent is equal to the scene's RootComponent.
If the component is contained within a container, parent is equal to that container.
-
setParent
final Unit setParent(ComponentView parent)
-
setName
final Unit setName(String name)
Name field only for debugging purposes. Has no effect on rendering.
-
getPosXProperty
final DoubleProperty getPosXProperty()
Property for the horizontal position of this ComponentView.
-
getActualPosX
final Double getActualPosX()
-
setActualPosX
final Unit setActualPosX(Double actualPosX)
-
getPosYProperty
final DoubleProperty getPosYProperty()
Property for the vertical position of this ComponentView.
-
getActualPosY
final Double getActualPosY()
-
setActualPosY
final Unit setActualPosY(Double actualPosY)
-
getWidthProperty
final DoubleProperty getWidthProperty()
Property for the width of this ComponentView.
-
getActualWidth
final Double getActualWidth()
-
setActualWidth
final Unit setActualWidth(Double actualWidth)
-
getHeightProperty
final DoubleProperty getHeightProperty()
Property for the height of this ComponentView.
-
getActualHeight
final Double getActualHeight()
-
setActualHeight
final Unit setActualHeight(Double actualHeight)
-
getScaleXProperty
final DoubleProperty getScaleXProperty()
Property for the horizontal scale of this ComponentView.
-
getScaleYProperty
final DoubleProperty getScaleYProperty()
Property for the vertical scale of this ComponentView.
-
getLayoutBounds
final CoordinatePlain getLayoutBounds()
-
setLayoutBounds
final Unit setLayoutBounds(CoordinatePlain layoutBounds)
-
getRotationProperty
final DoubleProperty getRotationProperty()
Property for the rotation of this ComponentView in degrees.
Values not in [0,360) get mapped to values in [0,360) by modulo operation with 360.
example conversions: -10 -> 350 -370 -> 350 370 -> 10 730 -> 10
-
getRotation
final Double getRotation()
-
setRotation
final Unit setRotation(Double rotation)
-
setVisual
Unit setVisual(Visual visual)
Sets a copy of the given Visual to this field and refreshes GUI.
-
getOpacityProperty
final LimitedDoubleProperty getOpacityProperty()
Property for the opacity of this ComponentView.
Must be in range 0.0 to 1.0.
0.0 corresponds to 0% opacity, where 1.0 corresponds to 100% opacity.
Note that invisible objects (opacity == 0.0) still remain interactive.
-
getOpacity
final Double getOpacity()
-
setOpacity
final Unit setOpacity(Double opacity)
-
getIsVisibleProperty
final BooleanProperty getIsVisibleProperty()
Property for the visibility of this ComponentView.
Invisible ComponentViews are disabled. An object marked as visible may still be opaque due to opacity.
-
getIsVisible
final Boolean getIsVisible()
-
setIsVisible
final Unit setIsVisible(Boolean isVisible)
-
getIsDisabledProperty
final BooleanProperty getIsDisabledProperty()
Property that controls if user input events cause input functions of this ComponentView to get invoked.
true
means no invocation, wherefalse
means invocation.For a list of affected functions refer to the
See Also
section.
-
getIsDisabled
final Boolean getIsDisabled()
-
setIsDisabled
final Unit setIsDisabled(Boolean isDisabled)
-
getIsFocusableProperty
final BooleanProperty getIsFocusableProperty()
Property that controls whether this ComponentView is focusable or not.
-
getIsFocusable
final Boolean getIsFocusable()
-
setIsFocusable
final Unit setIsFocusable(Boolean isFocusable)
-
getOnMouseEntered
final Function1<MouseEvent, Unit> getOnMouseEntered()
Gets invoked with a MouseEvent whenever the mouse enters this ComponentView.
-
setOnMouseEntered
final Unit setOnMouseEntered(Function1<MouseEvent, Unit> onMouseEntered)
Gets invoked with a MouseEvent whenever the mouse enters this ComponentView.
-
getOnMouseExited
final Function1<MouseEvent, Unit> getOnMouseExited()
Gets invoked with a MouseEvent whenever the mouse leaves this ComponentView.
-
setOnMouseExited
final Unit setOnMouseExited(Function1<MouseEvent, Unit> onMouseExited)
Gets invoked with a MouseEvent whenever the mouse leaves this ComponentView.
-
getOnMousePressed
final Function1<MouseEvent, Unit> getOnMousePressed()
Gets invoked with a MouseEvent whenever the mouse is pressed inside this ComponentView.
-
setOnMousePressed
final Unit setOnMousePressed(Function1<MouseEvent, Unit> onMousePressed)
Gets invoked with a MouseEvent whenever the mouse is pressed inside this ComponentView.
-
getOnMouseReleased
final Function1<MouseEvent, Unit> getOnMouseReleased()
Gets invoked with a MouseEvent whenever the mouse is released inside this ComponentView.
-
setOnMouseReleased
final Unit setOnMouseReleased(Function1<MouseEvent, Unit> onMouseReleased)
Gets invoked with a MouseEvent whenever the mouse is released inside this ComponentView.
-
getOnMouseClicked
final Function1<MouseEvent, Unit> getOnMouseClicked()
Gets invoked with a MouseEvent whenever the mouse is clicked inside this ComponentView. Gets invoked after onMousePressed and onMouseReleased.
-
setOnMouseClicked
final Unit setOnMouseClicked(Function1<MouseEvent, Unit> onMouseClicked)
Gets invoked with a MouseEvent whenever the mouse is clicked inside this ComponentView. Gets invoked after onMousePressed and onMouseReleased.
-
getOnKeyPressed
final Function1<KeyEvent, Unit> getOnKeyPressed()
Gets invoked with a KeyEvent whenever a key is pressed while this ComponentView has focus.
-
setOnKeyPressed
final Unit setOnKeyPressed(Function1<KeyEvent, Unit> onKeyPressed)
Gets invoked with a KeyEvent whenever a key is pressed while this ComponentView has focus.
-
getOnKeyReleased
final Function1<KeyEvent, Unit> getOnKeyReleased()
Gets invoked with a KeyEvent whenever a key is released while this ComponentView has focus.
-
setOnKeyReleased
final Unit setOnKeyReleased(Function1<KeyEvent, Unit> onKeyReleased)
Gets invoked with a KeyEvent whenever a key is released while this ComponentView has focus.
-
getOnKeyTyped
final Function1<KeyEvent, Unit> getOnKeyTyped()
Gets invoked with a KeyEvent whenever a key is typed while this ComponentView has focus. Gets invoked after onKeyPressed.
-
setOnKeyTyped
final Unit setOnKeyTyped(Function1<KeyEvent, Unit> onKeyTyped)
Gets invoked with a KeyEvent whenever a key is typed while this ComponentView has focus. Gets invoked after onKeyPressed.
-
getDropAcceptor
final Function1<DragEvent, Boolean> getDropAcceptor()
Returns whether this ComponentView is a valid drop target for the dragged component in the given DragEvent or not.
Implement this function in such a way that it returns
true
if this ComponentView accepts the drop of the given DropEvent.draggedComponent orfalse
if a drop is not valid. The DropEvent.draggedComponent will snap back if all available drop targets returnfalse
.It is advised not to modify the Scene or its children in this function. A better suited function to modify the Scene or its children after a drag and drop gesture is onDragDropped.
Note: onDragDropped only gets invoked if the dropAcceptor returns
true
for the given DropEvent.
-
setDropAcceptor
final Unit setDropAcceptor(Function1<DragEvent, Boolean> dropAcceptor)
Returns whether this ComponentView is a valid drop target for the dragged component in the given DragEvent or not.
Implement this function in such a way that it returns
true
if this ComponentView accepts the drop of the given DropEvent.draggedComponent orfalse
if a drop is not valid. The DropEvent.draggedComponent will snap back if all available drop targets returnfalse
.It is advised not to modify the Scene or its children in this function. A better suited function to modify the Scene or its children after a drag and drop gesture is onDragDropped.
Note: onDragDropped only gets invoked if the dropAcceptor returns
true
for the given DropEvent.
-
getOnDragGestureEntered
final Function1<DragEvent, Unit> getOnDragGestureEntered()
Gets invoked with a DragEvent whenever the mouse enters this ComponentView while performing a drag gesture.
-
setOnDragGestureEntered
final Unit setOnDragGestureEntered(Function1<DragEvent, Unit> onDragGestureEntered)
Gets invoked with a DragEvent whenever the mouse enters this ComponentView while performing a drag gesture.
-
getOnDragGestureExited
final Function1<DragEvent, Unit> getOnDragGestureExited()
Gets invoked with a DragEvent whenever the mouse leaves this ComponentView while performing a drag gesture.
-
setOnDragGestureExited
final Unit setOnDragGestureExited(Function1<DragEvent, Unit> onDragGestureExited)
Gets invoked with a DragEvent whenever the mouse leaves this ComponentView while performing a drag gesture.
-
getOnDragDropped
final Function1<DragEvent, Unit> getOnDragDropped()
Gets invoked with a DragEvent whenever a drag and drop gesture finishes over this ComponentView and the dropAcceptor returns
true
for the given DragEvent.
-
setOnDragDropped
final Unit setOnDragDropped(Function1<DragEvent, Unit> onDragDropped)
Gets invoked with a DragEvent whenever a drag and drop gesture finishes over this ComponentView and the dropAcceptor returns
true
for the given DragEvent.
-
get
final T get(Integer columnIndex, Integer rowIndex)
Returns ComponentView in specified cell. Returns
null
if there was no component.- Parameters:
columnIndex
- Column index in grid.rowIndex
- Row index in grid.
-
set
final Unit set(Integer columnIndex, Integer rowIndex, T component)
Sets content of desired grid cell. Overrides existing component in this cell. Pass
null
to remove a component.- Parameters:
columnIndex
- Column index in grid.rowIndex
- Row index in grid.component
- ComponentView to be added to the specified cell.
-
getCellCenterMode
final Alignment getCellCenterMode(Integer columnIndex, Integer rowIndex)
Returns centering mode as an Alignment of the specified cell.
- Parameters:
columnIndex
- Column index in grid.rowIndex
- Row index in grid.
-
setCellCenterMode
final Unit setCellCenterMode(Integer columnIndex, Integer rowIndex, Alignment value)
Sets centering mode of desired grid cell with given Alignment. Overrides existing mode in this cell.
- Parameters:
columnIndex
- Column index in grid.rowIndex
- Row index in grid.value
- New centering mode to be set for the specified cell.
-
setColumnCenterMode
final Unit setColumnCenterMode(Integer columnIndex, Alignment value)
Sets centering mode of desired column in grid with given Alignment. Overrides existing mode in the whole column.
- Parameters:
columnIndex
- Column index in grid.value
- New centering mode to be set for the whole column.
-
setRowCenterMode
final Unit setRowCenterMode(Integer rowIndex, Alignment value)
Sets centering mode of desired row in grid with given Alignment. Overrides existing mode in the whole row.
- Parameters:
rowIndex
- Row index in grid.value
- New centering mode to be set for the whole row.
-
setCenterMode
final Unit setCenterMode(Alignment value)
Sets centering mode of all cells in the grid with given Alignment. Overrides existing modes of all cells.
- Parameters:
value
- New centering mode to be set for all cells.
-
getColumnWidth
final Double getColumnWidth(Integer columnIndex)
Returns the set column width for the given column.
- Parameters:
columnIndex
- Target column.
-
setColumnWidth
final Unit setColumnWidth(Integer columnIndex, Number columnWidth)
Manually set column width of one column. Overrides automatic resizing based on content from this column.
- Parameters:
columnIndex
- Target column.columnWidth
- New column width.
-
setColumnWidths
final Unit setColumnWidths(DoubleArray columnWidths)
Manually set column width of all columns. Overrides automatic resizing based on content from this column.
- Parameters:
columnWidths
- New column widths.
-
setAutoColumnWidth
final Unit setAutoColumnWidth(Integer columnIndex)
Restores automatic resizing behavior for desired column.
- Parameters:
columnIndex
- Target column.
-
setAutoColumnWidths
final Unit setAutoColumnWidths()
Restores automatic resizing behavior for all columns.
-
getRowHeight
final Double getRowHeight(Integer rowIndex)
Returns the set row height for the given row.
- Parameters:
rowIndex
- Target row.
-
setRowHeight
final Unit setRowHeight(Integer rowIndex, Number rowHeight)
Manually set row height of one row. Overrides automatic resizing based on content from this row.
- Parameters:
rowIndex
- Target row.rowHeight
- New row height.
-
setRowHeights
final Unit setRowHeights(DoubleArray rowHeights)
Manually set row height of all rows. Overrides automatic resizing based on content from this row.
- Parameters:
rowHeights
- New row heights.
-
setAutoRowHeight
final Unit setAutoRowHeight(Integer rowIndex)
Restores automatic resizing behavior for desired row.
- Parameters:
rowIndex
- Target row.
-
setAutoRowHeights
final Unit setAutoRowHeights()
Restores automatic resizing behavior for all rows.
-
grow
final Boolean grow(Integer left, Integer right, Integer top, Integer bottom)
Grows grid by specified dimensions, filling new cells with
null
values.New rows and columns get automatic resizing behaviour, specified as COLUMN_WIDTH_AUTO and ROW_HEIGHT_AUTO. Therefore, new empty rows and columns get rendered with height and width 0.0 e.g. invisible if not specified otherwise.
- Parameters:
left
- Column count to be added to the left.right
- Column count to be added to the right.top
- Row count to be added on the top.bottom
- Row count to be added on the bottom.
-
trim
final Boolean trim()
Removes all empty outer rows and columns e.g. all rows and columns counted from left, right, top and bottom that have no views in their cells.
That means after calling the first and last row as well as the first and last column have at least one component in their cells.
Attributes rows and columns get updated according to new dimensions.
If the grid was empty the grid gets trimmed to size 0x0.
-
addColumns
final Unit addColumns(Integer columnIndex, Integer count)
Adds the desired amount of columns between column <b>columnIndex - 1</b> and <b>columnIndex</b>. New columns get
null
-initialized.- Parameters:
columnIndex
- Index on which the new column should be addedcount
- Column count to be added.
-
removeColumn
final Unit removeColumn(Integer columnIndex)
Removes the desired column in the grid. Removes all, views in the column. If there is no column left in the grid, it gets trimmed to size 0x0.
- Parameters:
columnIndex
- Index of the column to be deleted.
-
removeEmptyColumns
final Unit removeEmptyColumns()
Removes all empty columns e.g. all rows that have no views in their cells.
That means after calling every column has at least one component in its cells.
Attribute columns get updated according to new dimension.
If the grid was empty the grid gets trimmed to size 0x0.
-
addRows
final Unit addRows(Integer rowIndex, Integer count)
Adds the desired amount of rows between row <b>rowIndex</b> and <b>rowIndex + 1</b>. New rows get
null
-initialized.- Parameters:
rowIndex
- Index after which the new row should be addedcount
- Count of rows to be added.
-
removeRow
final Unit removeRow(Integer rowIndex)
Removes the desired row in the grid. Removes all, views in the row.
If there is no row left in the grid, it gets trimmed to size 0x0.
- Parameters:
rowIndex
- Index of the row te be deleted.
-
removeEmptyRows
final Unit removeEmptyRows()
Removes all empty rows e.g. all rows that have no views in their cells.
That means after calling every row has at least one component in its cells.
Attribute rows gets updated according to new dimension.
If the grid was empty the grid gets trimmed to size 0x0.
-
iterator
Iterator<GridIteratorElement<T>> iterator()
Returns an Iterator over the grid components.
Iteration is columns-first which means that the iterator starts at cell 0,0 and then proceeds iterating through the first row from left to right. When reaching the end of a row it proceeds to the next one resetting the column pointer to 0.
Iterator.hasNext Returns
true
if at least one cell is left to iterate.Iterator.next Returns a data object GridIteratorElement that contains the current row and column as well as the component itself. Refer to the GridIteratorElement documentation for further information.
-
-
-
-