com.vaadin.flow.data.renderer.
Class NativeButtonRenderer<SOURCE>
Type Parameters:
SOURCE
- the type of the item to be received in the click listeners
All Implemented Interfaces:
ClickableRenderer<SOURCE>
, Serializable
A renderer to create a clickable button.
ClickableRenderer.ItemClickListener
s are notified when the rendered buttons are either
clicked or tapped (in touch devices).
Author:
Vaadin Ltd
See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.flow.data.renderer.ClickableRenderer
ClickableRenderer.ItemClickListener<SOURCE>
-
Constructor Summary
ConstructorsConstructorDescriptionNativeButtonRenderer
(ValueProvider<SOURCE, String> labelProvider) Creates a new button renderer with a dynamic label.
NativeButtonRenderer
(ValueProvider<SOURCE, String> labelProvider, ClickableRenderer.ItemClickListener<SOURCE> clickListener) Creates a new button renderer with a dynamic label and registers a
ClickableRenderer.ItemClickListener
to receive events.NativeButtonRenderer
(String label) Creates a new button renderer with the specified label.
NativeButtonRenderer
(String label, ClickableRenderer.ItemClickListener<SOURCE> clickListener) Creates a new button renderer with the specified label and registers a
ClickableRenderer.ItemClickListener
to receive events. -
Method Summary
Modifier and TypeMethodDescriptionAdds a click listener to the renderer.
createComponent
(SOURCE item) Creates a component for a given object model item.
Gets all registered listeners.
protected String
Returns the Lit template expression used to render items.
Methods inherited from class com.vaadin.flow.data.renderer.BasicRenderer
getFormattedValue, getValueProvider
Methods inherited from class com.vaadin.flow.data.renderer.ComponentRenderer
render, updateComponent
Methods inherited from class com.vaadin.flow.data.renderer.LitRenderer
getValueProviders, of, withFunction, withFunction, withProperty
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.flow.data.renderer.ClickableRenderer
onClick
-
Constructor Details
-
NativeButtonRenderer
Creates a new button renderer with the specified label. The label is the same for all the items.
Item click listeners can be added via
addItemClickListener(ItemClickListener)
.Parameters:
label
- the label of the rendered button, notnull
-
NativeButtonRenderer
public NativeButtonRenderer(String label, ClickableRenderer.ItemClickListener<SOURCE> clickListener) Creates a new button renderer with the specified label and registers a
ClickableRenderer.ItemClickListener
to receive events. The label is the same for all the items.More click listeners can be added via
addItemClickListener(ItemClickListener)
.Parameters:
label
- the label for the rendered button, notnull
clickListener
- a listener to receive click events -
NativeButtonRenderer
Creates a new button renderer with a dynamic label.
Item click listeners can be added via
addItemClickListener(ItemClickListener)
.Parameters:
labelProvider
- the provider for the labels of the rendered buttons, notnull
-
NativeButtonRenderer
public NativeButtonRenderer(ValueProvider<SOURCE, String> labelProvider, ClickableRenderer.ItemClickListener<SOURCE> clickListener) Creates a new button renderer with a dynamic label and registers a
ClickableRenderer.ItemClickListener
to receive events.More click listeners can be added via
addItemClickListener(ItemClickListener)
.Parameters:
labelProvider
- the provider for the labels of the rendered buttons, notnull
clickListener
- a listener to receive click events
-
-
Method Details
-
addItemClickListener
Description copied from interface:
ClickableRenderer
Adds a click listener to the renderer. Events are fired when items are clicked or tapped (for touch devices).
Specified by:
addItemClickListener
in interfaceClickableRenderer<SOURCE>
Parameters:
listener
- the listener to receive click events, notnull
Returns:
a registration that can be used to remove the listener from this renderer
-
getItemClickListeners
Description copied from interface:
ClickableRenderer
Gets all registered listeners.
Specified by:
getItemClickListeners
in interfaceClickableRenderer<SOURCE>
Returns:
an unmodifiable list of registered listeners, not
null
-
createComponent
Description copied from class:
ComponentRenderer
Creates a component for a given object model item. Subclasses can override this method to provide specific behavior.
Overrides:
createComponent
in classBasicRenderer<SOURCE,
String> Parameters:
item
- the model item, possiblynull
Returns:
a component instance representing the provided item
-
getTemplateExpression
Description copied from class:
LitRenderer
Returns the Lit template expression used to render items.
Overrides:
getTemplateExpression
in classBasicRenderer<SOURCE,
String> Returns:
the template expression
-