Class Grid.SelectionColumn
- java.lang.Object
-
- com.vaadin.client.widgets.Grid.Column<Boolean,T>
-
- com.vaadin.client.widgets.Grid.SelectionColumn
-
- All Implemented Interfaces:
com.google.gwt.event.shared.EventHandler,GridEnabledHandler,GridSelectionAllowedHandler
public final class Grid.SelectionColumn extends Grid.Column<Boolean,T> implements GridEnabledHandler, GridSelectionAllowedHandler
A column that contains CheckBoxes for representing Grid's row selection. By default only used with MultiSelectionModel.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoSetSelectAllCheckBoxVisible()Sets the select all checkbox visible or hidden.intgetExpandRatio()Gets the expand ratio for this column.doublegetMaximumWidth()Gets the maximum width for this column.doublegetMinimumWidth()Gets the minimum width for this column.Optional<com.google.gwt.user.client.ui.CheckBox>getSelectAllCheckBox()Returns the select all checkbox, which is present in the default header if the used selection model is of typeSelectionModelWithSelectionColumn.BooleangetValue(T row)Returns the data that should be rendered into the cell.booleanisSelectAllCheckBoxVisible()Returns whether the select all checkbox is visible or not.voidonEnabled(boolean enabled)Called when Grid is enabled or disabled.voidonSelectionAllowed(GridSelectionAllowedEvent event)Called when Grid selection is allowed value changes.protected voidsetDefaultHeaderContent(Grid.HeaderCell selectionCell)Resets the default header cell contents to column header captions.Grid.Column<Boolean,T>setEditable(boolean editable)Sets whether the values in this column should be editable by the user when the row editor is active.Grid.Column<Boolean,T>setExpandRatio(int ratio)Sets the ratio with which the column expands.Grid.Column<Boolean,T>setMaximumWidth(double pixels)Sets the maximum width for this column.Grid.Column<Boolean,T>setMinimumWidth(double pixels)Sets the minimum width for this column.voidsetSelectAllCheckBoxVisible(boolean selectAllCheckBoxVisible)Sets the select all checkbox visible in the default header row for selection column.Grid.Column<Boolean,T>setWidth(double pixels)Sets the pixel width of the column.-
Methods inherited from class com.vaadin.client.widgets.Grid.Column
clearExpandRatio, getAssistiveCaption, getHeaderCaption, getHidingToggleCaption, getRenderer, getWidth, getWidthActual, isEditable, isHandleWidgetEvents, isHidable, isHidden, isMinimumWidthFromContent, isResizable, isSortable, setAssistiveCaption, setHandleWidgetEvents, setHeaderCaption, setHidable, setHidden, setHidingToggleCaption, setMinimumWidthFromContent, setRenderer, setResizable, setSortable, toString
-
-
-
-
Method Detail
-
setDefaultHeaderContent
protected void setDefaultHeaderContent(Grid.HeaderCell selectionCell)
Description copied from class:Grid.ColumnResets the default header cell contents to column header captions.- Overrides:
setDefaultHeaderContentin classGrid.Column<Boolean,T>- Parameters:
selectionCell- default header cell for this column
-
setWidth
public Grid.Column<Boolean,T> setWidth(double pixels)
Description copied from class:Grid.ColumnSets the pixel width of the column. Use a negative value for the grid to autosize column based on content and available space.This action is done "finally", once the current execution loop returns. This is done to reduce overhead of unintentionally always recalculate all columns, when modifying several columns at once.
If the column is currently
hidden, then this set width has effect only once the column has been made visible again.- Overrides:
setWidthin classGrid.Column<Boolean,T>- Parameters:
pixels- the width in pixels or negative for auto sizing- Returns:
- this column
-
getValue
public Boolean getValue(T row)
Description copied from class:Grid.ColumnReturns the data that should be rendered into the cell. By default returning Strings and Widgets are supported. If the return type is a String then it will be treated as preformatted text.To support other types you will need to pass a custom renderer to the column via the column constructor.
- Specified by:
getValuein classGrid.Column<Boolean,T>- Parameters:
row- The row object that provides the cell content.- Returns:
- The cell content
-
setExpandRatio
public Grid.Column<Boolean,T> setExpandRatio(int ratio)
Description copied from class:Grid.ColumnSets the ratio with which the column expands.By default, all columns expand equally (treated as if all of them had an expand ratio of 1). Once at least one column gets a defined expand ratio, the implicit expand ratio is removed, and only the defined expand ratios are taken into account.
If a column has a defined width (
Grid.Column.setWidth(double)), it overrides this method's effects.Example: A grid with three columns, with expand ratios 0, 1 and 2, respectively. The column with a ratio of 0 is exactly as wide as its contents requires. The column with a ratio of 1 is as wide as it needs, plus a third of any excess space, bceause we have 3 parts total, and this column reservs only one of those. The column with a ratio of 2, is as wide as it needs to be, plus two thirds of the excess width.
This action is done "finally", once the current execution loop returns. This is done to reduce overhead of unintentionally always recalculate all columns, when modifying several columns at once.
- Overrides:
setExpandRatioin classGrid.Column<Boolean,T>- Parameters:
ratio- the expand ratio of this column.0to not have it expand at all. A negative number to clear the expand value.- Returns:
- this column
-
getExpandRatio
public int getExpandRatio()
Description copied from class:Grid.ColumnGets the expand ratio for this column.- Overrides:
getExpandRatioin classGrid.Column<Boolean,T>- Returns:
- the expand ratio for this column
- See Also:
Grid.Column.setExpandRatio(int)
-
setMaximumWidth
public Grid.Column<Boolean,T> setMaximumWidth(double pixels)
Description copied from class:Grid.ColumnSets the maximum width for this column.This defines the maximum allowed pixel width of the column when it is set to expand.
This action is done "finally", once the current execution loop returns. This is done to reduce overhead of unintentionally always recalculate all columns, when modifying several columns at once.
- Overrides:
setMaximumWidthin classGrid.Column<Boolean,T>- Parameters:
pixels- the maximum width- Returns:
- this column
-
getMaximumWidth
public double getMaximumWidth()
Description copied from class:Grid.ColumnGets the maximum width for this column.- Overrides:
getMaximumWidthin classGrid.Column<Boolean,T>- Returns:
- the maximum width for this column
- See Also:
Grid.Column.setMaximumWidth(double)
-
setMinimumWidth
public Grid.Column<Boolean,T> setMinimumWidth(double pixels)
Description copied from class:Grid.ColumnSets the minimum width for this column.This defines the minimum guaranteed pixel width of the column when it is set to expand.
This action is done "finally", once the current execution loop returns. This is done to reduce overhead of unintentionally always recalculate all columns, when modifying several columns at once.
- Overrides:
setMinimumWidthin classGrid.Column<Boolean,T>- Parameters:
pixels- the minimum width- Returns:
- this column
-
getMinimumWidth
public double getMinimumWidth()
Description copied from class:Grid.ColumnGets the minimum width for this column.- Overrides:
getMinimumWidthin classGrid.Column<Boolean,T>- Returns:
- the minimum width for this column
- See Also:
Grid.Column.setMinimumWidth(double)
-
setEditable
public Grid.Column<Boolean,T> setEditable(boolean editable)
Description copied from class:Grid.ColumnSets whether the values in this column should be editable by the user when the row editor is active. By default columns are editable.- Overrides:
setEditablein classGrid.Column<Boolean,T>- Parameters:
editable-trueto set this column editable,falseotherwise- Returns:
- this column
- See Also:
Grid.editRow(int),Grid.isEditorActive()
-
onEnabled
public void onEnabled(boolean enabled)
Description copied from interface:GridEnabledHandlerCalled when Grid is enabled or disabled.- Specified by:
onEnabledin interfaceGridEnabledHandler- Parameters:
enabled- true if status changes from disabled to enabled, otherwise false.
-
setSelectAllCheckBoxVisible
public void setSelectAllCheckBoxVisible(boolean selectAllCheckBoxVisible)
Sets the select all checkbox visible in the default header row for selection column.- Parameters:
selectAllCheckBoxVisible-truefor visible,falsefor not
-
isSelectAllCheckBoxVisible
public boolean isSelectAllCheckBoxVisible()
Returns whether the select all checkbox is visible or not.- Returns:
truefor visible,falsefor not
-
getSelectAllCheckBox
public Optional<com.google.gwt.user.client.ui.CheckBox> getSelectAllCheckBox()
Returns the select all checkbox, which is present in the default header if the used selection model is of typeSelectionModelWithSelectionColumn. To handle select all, addSelectAllHandlerthe grid withGrid.addSelectAllHandler(SelectAllHandler).- Returns:
- the select all checkbox, or an empty optional if not in use
-
doSetSelectAllCheckBoxVisible
protected void doSetSelectAllCheckBoxVisible()
Sets the select all checkbox visible or hidden.
-
onSelectionAllowed
public void onSelectionAllowed(GridSelectionAllowedEvent event)
Description copied from interface:GridSelectionAllowedHandlerCalled when Grid selection is allowed value changes.- Specified by:
onSelectionAllowedin interfaceGridSelectionAllowedHandler- Parameters:
event- theGridSelectionAllowedEventthat was fired
-
-