com.vaadin.client.widget.grid.selection
Class MultiSelectionRenderer<T>

java.lang.Object
  extended by com.vaadin.client.renderers.ComplexRenderer<T>
      extended by com.vaadin.client.renderers.WidgetRenderer<T,W>
          extended by com.vaadin.client.renderers.ClickableRenderer<java.lang.Boolean,CheckBox>
              extended by com.vaadin.client.widget.grid.selection.MultiSelectionRenderer<T>
Type Parameters:
T - the type of the associated grid
All Implemented Interfaces:
Renderer<java.lang.Boolean>

public class MultiSelectionRenderer<T>
extends ClickableRenderer<java.lang.Boolean,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
MultiSelectionRenderer(Grid<T> grid)
           
 
Method Summary
 CheckBox createWidget()
          Creates a widget to attach to a cell.
 void destroy()
          Called when the renderer is deemed to be destroyed and no longer used by the Grid.
 java.util.Collection<java.lang.String> getConsumedEvents()
          Returns the events that the renderer should consume.
protected  boolean isSelected(int logicalRow)
           
 boolean onBrowserEvent(CellReference<?> cell, NativeEvent event)
          Called whenever a registered event is triggered in the column the renderer renders.
 void render(RendererCellReference cell, java.lang.Boolean data, CheckBox checkBox)
          Renders a cell with a widget.
protected  void setSelected(int logicalRow, boolean select)
           
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiSelectionRenderer

public MultiSelectionRenderer(Grid<T> grid)
Method Detail

destroy

public void destroy()
Description copied from class: ComplexRenderer
Called when the renderer is deemed to be destroyed and no longer used by the Grid.

Overrides:
destroy in class ComplexRenderer<java.lang.Boolean>

createWidget

public CheckBox createWidget()
Description copied from class: ClickableRenderer
Creates 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 this as a click handler of the returned widget, or a widget nested therein, in order to make click events propagate properly to handlers registered via addClickHandler.

Specified by:
createWidget in class ClickableRenderer<java.lang.Boolean,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,
                   java.lang.Boolean data,
                   CheckBox checkBox)
Description copied from class: WidgetRenderer
Renders 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:
render in class WidgetRenderer<java.lang.Boolean,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 cell
checkBox - the widget embedded in the cell

getConsumedEvents

public java.util.Collection<java.lang.String> getConsumedEvents()
Description copied from class: ComplexRenderer
Returns 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:
getConsumedEvents in class ComplexRenderer<java.lang.Boolean>
Returns:
a list of consumed events
See Also:
com.google.gwt.dom.client.BrowserEvents

onBrowserEvent

public boolean onBrowserEvent(CellReference<?> cell,
                              NativeEvent event)
Description copied from class: ComplexRenderer
Called 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:
onBrowserEvent in class ComplexRenderer<java.lang.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)

setSelected

protected void setSelected(int logicalRow,
                           boolean select)


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.