public abstract class ComplexRenderer<T> extends Object implements Renderer<T>
#init(FlyweightCell)
and #destroy(FlyweightCell)
and event handling (see #onBrowserEvent(Cell, NativeEvent)
,
getConsumedEvents()
and #onActivate()
.
Also provides a helper method for hiding the cell contents by overriding
#setContentVisible(FlyweightCell, boolean)
Constructor and Description |
---|
ComplexRenderer() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Called when the renderer is deemed to be destroyed and no longer used by
the Grid.
|
void |
destroy(RendererCellReference cell)
Called after the cell is deemed to be destroyed and no longer used by the
Grid.
|
Collection<String> |
getConsumedEvents()
Returns the events that the renderer should consume.
|
abstract void |
init(RendererCellReference cell)
Called at initialization stage.
|
boolean |
onActivate(CellReference<?> cell)
Called when the cell is activated by pressing
enter , double
clicking or performing a double tap on the cell. |
boolean |
onBrowserEvent(CellReference<?> cell,
com.google.gwt.dom.client.NativeEvent event)
Called whenever a registered event is triggered in the column the
renderer renders.
|
void |
setContentVisible(RendererCellReference cell,
boolean hasData)
Used by Grid to toggle whether to show actual data or just an empty
placeholder while data is loading.
|
public abstract void init(RendererCellReference cell)
cell
- The cell. Note that the cell is not to be stored outside of
the method as the cell instance will change. See
FlyweightCell
public void destroy(RendererCellReference cell)
The row object in the cell reference will be null
since the
row might no longer be present in the data source.
cell
- The cell. Note that the cell is not to be stored outside of
the method as the cell instance will change. See
FlyweightCell
public Collection<String> getConsumedEvents()
#onBrowserEvent(Cell, NativeEvent)
when they occur.BrowserEvents
public boolean onBrowserEvent(CellReference<?> cell, com.google.gwt.dom.client.NativeEvent event)
The events that triggers this needs to be returned by the
getConsumedEvents()
method.
Returns boolean telling if the event has been completely handled and should not cause any other actions.
cell
- Object containing information about the cell the event was
triggered on.event
- The original DOM eventpublic void setContentVisible(RendererCellReference cell, boolean hasData)
Default implementation hides content by setting visibility: hidden to all elements inside the cell. Text nodes are left as is - renderers that add such to the root element need to implement explicit support hiding them.
cell
- The cellhasData
- Has the cell content been loaded from the data sourcepublic boolean onActivate(CellReference<?> cell)
enter
, double
clicking or performing a double tap on the cell.cell
- the activated celltrue
if event was handled and should not be
interpreted as a generic gesture by Grid.public void destroy()
Copyright © 2023 Vaadin Ltd. All rights reserved.