Package com.vaadin.flow.data.renderer
Class NativeButtonRenderer<SOURCE>
java.lang.Object
com.vaadin.flow.data.renderer.Renderer<SOURCE>
com.vaadin.flow.data.renderer.LitRenderer<SOURCE>
com.vaadin.flow.data.renderer.ComponentRenderer<Component,SOURCE>
com.vaadin.flow.data.renderer.BasicRenderer<SOURCE,String>
com.vaadin.flow.data.renderer.NativeButtonRenderer<SOURCE>
- Type Parameters:
SOURCE- the type of the item to be received in the click listeners
- All Implemented Interfaces:
ClickableRenderer<SOURCE>,Serializable
public class NativeButtonRenderer<SOURCE>
extends BasicRenderer<SOURCE,String>
implements ClickableRenderer<SOURCE>
A renderer to create a clickable button.
ClickableRenderer.ItemClickListeners 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 aClickableRenderer.ItemClickListenerto 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 aClickableRenderer.ItemClickListenerto 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 StringReturns the Lit template expression used to render items.Methods inherited from class com.vaadin.flow.data.renderer.BasicRenderer
getFormattedValue, getValueProviderMethods inherited from class com.vaadin.flow.data.renderer.ComponentRenderer
render, updateComponentMethods inherited from class com.vaadin.flow.data.renderer.LitRenderer
getValueProviders, of, withFunction, withFunction, withPropertyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 aClickableRenderer.ItemClickListenerto 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, notnullclickListener- 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 aClickableRenderer.ItemClickListenerto receive events.More click listeners can be added via
addItemClickListener(ItemClickListener).- Parameters:
labelProvider- the provider for the labels of the rendered buttons, notnullclickListener- a listener to receive click events
-
-
Method Details
-
addItemClickListener
Description copied from interface:ClickableRendererAdds a click listener to the renderer. Events are fired when items are clicked or tapped (for touch devices).- Specified by:
addItemClickListenerin 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:ClickableRendererGets all registered listeners.- Specified by:
getItemClickListenersin interfaceClickableRenderer<SOURCE>- Returns:
- an unmodifiable list of registered listeners, not
null
-
createComponent
Description copied from class:ComponentRendererCreates a component for a given object model item. Subclasses can override this method to provide specific behavior.- Overrides:
createComponentin classBasicRenderer<SOURCE,String> - Parameters:
item- the model item, possiblynull- Returns:
- a component instance representing the provided item
-
getTemplateExpression
Description copied from class:LitRendererReturns the Lit template expression used to render items.- Overrides:
getTemplateExpressionin classBasicRenderer<SOURCE,String> - Returns:
- the template expression
-