com.vaadin.client.renderers.
Class HierarchyRenderer
- java.lang.Object
-
- com.vaadin.client.renderers.ComplexRenderer<T>
-
- com.vaadin.client.renderers.WidgetRenderer<T,W>
-
- com.vaadin.client.renderers.ClickableRenderer<Object,com.google.gwt.user.client.ui.Widget>
-
- com.vaadin.client.renderers.HierarchyRenderer
-
All Implemented Interfaces:
com.google.gwt.event.dom.client.ClickHandler
,com.google.gwt.event.shared.EventHandler
,Renderer<Object>
public class HierarchyRenderer extends ClickableRenderer<Object,com.google.gwt.user.client.ui.Widget>
A renderer for displaying hierarchical columns in TreeGrid.
Since:
8.1
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 HierarchyRenderer(BiConsumer<Integer,Boolean> collapseCallback, String styleName)
Constructs a HierarchyRenderer with given collapse callback.
-
Method Summary
All Methods Modifier and Type Method Description com.google.gwt.user.client.ui.Widget
createWidget()
Creates a widget to attach to a cell.
Renderer
getInnerRenderer()
Returns the wrapped renderer.
static boolean
isElementInHierarchyWidget(com.google.gwt.dom.client.Element element)
Decides whether the element was rendered by
HierarchyRenderer
.void
render(RendererCellReference cell, Object data, com.google.gwt.user.client.ui.Widget widget)
Renders a cell with a widget.
void
setInnerRenderer(Renderer innerRenderer)
Sets the renderer to be wrapped.
void
setStyleNames(String styleName)
Set the style name prefix for the node, expander and cell-content elements.
-
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
-
-
-
-
Constructor Detail
-
HierarchyRenderer
public HierarchyRenderer(BiConsumer<Integer,Boolean> collapseCallback, String styleName)
Constructs a HierarchyRenderer with given collapse callback. Callback is called when user clicks on the expander of a row. Callback is given the row index and the target collapsed state.
Parameters:
collapseCallback
- the callback for collapsing nodes with row indexstyleName
- the style name of the widget this renderer is used in
-
-
Method Detail
-
setStyleNames
public void setStyleNames(String styleName)
Set the style name prefix for the node, expander and cell-content elements.
Parameters:
styleName
- the style name to set
-
createWidget
public com.google.gwt.user.client.ui.Widget 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<Object,com.google.gwt.user.client.ui.Widget>
Returns:
widget to attach to a cell. All returned instances should be new widget instances without a parent.
-
render
public void render(RendererCellReference cell, Object data, com.google.gwt.user.client.ui.Widget widget)
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<Object,com.google.gwt.user.client.ui.Widget>
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 cellwidget
- the widget embedded in the cell
-
setInnerRenderer
public void setInnerRenderer(Renderer innerRenderer)
Sets the renderer to be wrapped. This is the original renderer before hierarchy is applied.
Parameters:
innerRenderer
- Renderer to be wrapped.
-
getInnerRenderer
public Renderer getInnerRenderer()
Returns the wrapped renderer.
Returns:
Wrapped renderer.
-
isElementInHierarchyWidget
public static boolean isElementInHierarchyWidget(com.google.gwt.dom.client.Element element)
Decides whether the element was rendered by
HierarchyRenderer
.Parameters:
element
- the element to checkReturns:
true
if the element was rendered by a HierarchyRenderer,false
otherwise.
-
-