com.vaadin.client.renderers
Class ClickableRenderer<T,W extends Widget>

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<T,W>
Type Parameters:
T - the presentation (column) type
W - the widget type
All Implemented Interfaces:
Renderer<T>
Direct Known Subclasses:
ButtonRenderer, ImageRenderer, MultiSelectionRenderer

public abstract class ClickableRenderer<T,W extends Widget>
extends WidgetRenderer<T,W>

An abstract superclass for renderers that render clickable widgets. Click handlers can be added to a renderer to listen to click events emitted by all widgets rendered by the renderer.

Since:
7.4
Author:
Vaadin Ltd

Nested Class Summary
static class ClickableRenderer.RendererClickEvent<R>
          An event fired when a widget rendered by a ClickableWidgetRenderer subclass is clicked.
static interface ClickableRenderer.RendererClickHandler<R>
          A handler for renderer click events.
 
Constructor Summary
ClickableRenderer()
           
 
Method Summary
 com.google.web.bindery.event.shared.HandlerRegistration addClickHandler(ClickableRenderer.RendererClickHandler<?> handler)
          Adds a click handler to this button renderer.
abstract  W createWidget()
          Creates a widget to attach to a cell.
 void onClick(ClickEvent event)
           
 
Methods inherited from class com.vaadin.client.renderers.WidgetRenderer
getWidget, getWidget, init, render, render
 
Methods inherited from class com.vaadin.client.renderers.ComplexRenderer
destroy, destroy, getConsumedEvents, onActivate, onBrowserEvent, setContentVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClickableRenderer

public ClickableRenderer()
Method Detail

createWidget

public abstract W createWidget()
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 WidgetRenderer<T,W extends Widget>
Returns:
widget to attach to a cell. All returned instances should be new widget instances without a parent.

addClickHandler

public com.google.web.bindery.event.shared.HandlerRegistration addClickHandler(ClickableRenderer.RendererClickHandler<?> handler)
Adds a click handler to this button renderer. The handler is invoked every time one of the widgets rendered by this renderer is clicked.

Note that the row type of the click handler must match the row type of the containing Grid.

Parameters:
handler - the click handler to be added

onClick

public void onClick(ClickEvent event)


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