Class MultiSelectionRenderer<T>
- java.lang.Object
-
- com.vaadin.client.renderers.ComplexRenderer<T>
-
- com.vaadin.client.renderers.WidgetRenderer<T,W>
-
- com.vaadin.client.renderers.ClickableRenderer<Boolean,com.google.gwt.user.client.ui.CheckBox>
-
- com.vaadin.client.widget.grid.selection.MultiSelectionRenderer<T>
-
- Type Parameters:
T- the type of the items in the associated Grid
- All Implemented Interfaces:
com.google.gwt.event.dom.client.ClickHandler,com.google.gwt.event.shared.EventHandler,Renderer<Boolean>
public class MultiSelectionRenderer<T> extends ClickableRenderer<Boolean,com.google.gwt.user.client.ui.CheckBox>
Renderer showing multi selection check boxes.- Since:
- 7.4
- Author:
- Vaadin Ltd
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.vaadin.client.renderers.ClickableRenderer
ClickableRenderer.RendererClickEvent<R>, ClickableRenderer.RendererClickHandler<R>
-
-
Constructor Summary
Constructors Constructor Description MultiSelectionRenderer(Grid<T> grid)Constructs a renderer for a selection column with multi-selection CheckBoxes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.gwt.user.client.ui.CheckBoxcreateWidget()Creates a widget to attach to a cell.voiddestroy()Called when the renderer is deemed to be destroyed and no longer used by the Grid.Collection<String>getConsumedEvents()Returns the events that the renderer should consume.protected booleanisSelected(int logicalRow)Checks whether the given row is selected.booleanonBrowserEvent(CellReference<?> cell, com.google.gwt.dom.client.NativeEvent event)Called whenever a registered event is triggered in the column the renderer renders.voidrender(RendererCellReference cell, Boolean data, com.google.gwt.user.client.ui.CheckBox checkBox)Renders a cell with a widget.protected voidsetSelected(int logicalRow, boolean select)Updates selection status for the given row.-
Methods inherited from class com.vaadin.client.renderers.ClickableRenderer
addClickHandler, onClick
-
Methods inherited from class com.vaadin.client.renderers.WidgetRenderer
getWidget, getWidget, init, render
-
Methods inherited from class com.vaadin.client.renderers.ComplexRenderer
destroy, onActivate, setContentVisible
-
-
-
-
Method Detail
-
destroy
public void destroy()
Description copied from class:ComplexRendererCalled when the renderer is deemed to be destroyed and no longer used by the Grid.- Overrides:
destroyin classComplexRenderer<Boolean>
-
createWidget
public com.google.gwt.user.client.ui.CheckBox createWidget()
Description copied from class:ClickableRendererCreates a widget to attach to a cell. The widgets will be attached to the cell after the cell element has been attached to DOM.Implementation note: It is the implementing method's responsibility to add
thisas a click handler of the returned widget, or a widget nested therein, in order to make click events propagate properly to handlers registered viaaddClickHandler.- Specified by:
createWidgetin classClickableRenderer<Boolean,com.google.gwt.user.client.ui.CheckBox>- Returns:
- widget to attach to a cell. All returned instances should be new widget instances without a parent.
-
render
public void render(RendererCellReference cell, Boolean data, com.google.gwt.user.client.ui.CheckBox checkBox)
Description copied from class:WidgetRendererRenders a cell with a widget. This provides a way to update any information in the widget that is cell specific. Do not detach the Widget here, it will be done automatically by the Grid when the widget is no longer needed.For optimal performance, work done in this method should be kept to a minimum since it will be called continuously while the user is scrolling. The renderer can use
Widget.setLayoutData(Object)to store cell data that might be needed in e.g. event listeners.- Specified by:
renderin classWidgetRenderer<Boolean,com.google.gwt.user.client.ui.CheckBox>- Parameters:
cell- The cell to render. Note that the cell is a flyweight and should not be stored and used outside of this method as its contents will change.data- the data of the cellcheckBox- the widget embedded in the cell
-
getConsumedEvents
public Collection<String> getConsumedEvents()
Description copied from class:ComplexRendererReturns the events that the renderer should consume. These are also the events that the Grid will pass to#onBrowserEvent(Cell, NativeEvent)when they occur.- Overrides:
getConsumedEventsin classComplexRenderer<Boolean>- Returns:
- a list of consumed events
- See Also:
BrowserEvents
-
onBrowserEvent
public boolean onBrowserEvent(CellReference<?> cell, com.google.gwt.dom.client.NativeEvent event)
Description copied from class:ComplexRendererCalled whenever a registered event is triggered in the column the renderer renders.The events that triggers this needs to be returned by the
ComplexRenderer.getConsumedEvents()method.Returns boolean telling if the event has been completely handled and should not cause any other actions.
- Overrides:
onBrowserEventin classComplexRenderer<Boolean>- Parameters:
cell- Object containing information about the cell the event was triggered on.event- The original DOM event- Returns:
- true if event should not be handled by grid
-
isSelected
protected boolean isSelected(int logicalRow)
Checks whether the given row is selected.- Parameters:
logicalRow- logical index of the row to check- Returns:
trueif the current selection model considers the row selected,falseotherwise
-
setSelected
protected void setSelected(int logicalRow, boolean select)Updates selection status for the given row.- Parameters:
logicalRow- logical index of the row to updateselect-trueif the row should be marked selected,falseotherwise
-
-