Package com.vaadin.client.renderers
Class ImageRenderer
- java.lang.Object
-
- com.vaadin.client.renderers.ComplexRenderer<T>
-
- com.vaadin.client.renderers.WidgetRenderer<T,W>
-
- com.vaadin.client.renderers.ClickableRenderer<String,com.google.gwt.user.client.ui.Image>
-
- com.vaadin.client.renderers.ImageRenderer
-
- All Implemented Interfaces:
com.google.gwt.event.dom.client.ClickHandler
,com.google.gwt.event.shared.EventHandler
,Renderer<String>
public class ImageRenderer extends ClickableRenderer<String,com.google.gwt.user.client.ui.Image>
A renderer that renders an image into a cell. Click handlers can be added to the renderer, invoked every time any of the images rendered by that rendered is clicked.- 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>
-
-
Field Summary
Fields Modifier and Type Field Description static String
TRANSPARENT_GIF_1PX
-
Constructor Summary
Constructors Constructor Description ImageRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.gwt.user.client.ui.Image
createWidget()
Creates a widget to attach to a cell.void
render(RendererCellReference cell, String url, com.google.gwt.user.client.ui.Image image)
Renders a cell with a widget.-
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, destroy, getConsumedEvents, onActivate, onBrowserEvent, setContentVisible
-
-
-
-
Field Detail
-
TRANSPARENT_GIF_1PX
public static final String TRANSPARENT_GIF_1PX
- See Also:
- Constant Field Values
-
-
Method Detail
-
createWidget
public com.google.gwt.user.client.ui.Image 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 viaaddClickHandler
.- Specified by:
createWidget
in classClickableRenderer<String,com.google.gwt.user.client.ui.Image>
- Returns:
- widget to attach to a cell. All returned instances should be new widget instances without a parent.
-
render
public void render(RendererCellReference cell, String url, com.google.gwt.user.client.ui.Image image)
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 classWidgetRenderer<String,com.google.gwt.user.client.ui.Image>
- 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.url
- the data of the cellimage
- the widget embedded in the cell
-
-