Class ButtonRenderer<T>

  • All Implemented Interfaces:
    MethodEventSource, ClientConnector, Extension, com.vaadin.shared.Connector, Renderer<java.lang.String>, java.io.Serializable

    public class ButtonRenderer<T>
    extends ClickableRenderer<T,​java.lang.String>
    A Renderer that displays a button with a textual caption. The value of the corresponding property is used as the caption. Click listeners can be added to the renderer, invoked when any of the rendered buttons is clicked.
    Since:
    7.4
    Author:
    Vaadin Ltd
    See Also:
    Serialized Form
    • Constructor Detail

      • ButtonRenderer

        public ButtonRenderer​(java.lang.String nullRepresentation)
        Creates a new button renderer.
        Parameters:
        nullRepresentation - the textual representation of null value
      • ButtonRenderer

        public ButtonRenderer​(ClickableRenderer.RendererClickListener<T> listener,
                              java.lang.String nullRepresentation)
        Creates a new button renderer and adds the given click listener to it.
        Parameters:
        listener - the click listener to register
        nullRepresentation - the textual representation of null value
      • ButtonRenderer

        public ButtonRenderer()
        Creates a new button renderer.
      • ButtonRenderer

        public ButtonRenderer​(ClickableRenderer.RendererClickListener<T> listener)
        Creates a new button renderer and adds the given click listener to it.
        Parameters:
        listener - the click listener to register
    • Method Detail

      • getNullRepresentation

        public java.lang.String getNullRepresentation()
        Description copied from class: AbstractRenderer
        Null representation for the renderer.
        Overrides:
        getNullRepresentation in class AbstractRenderer<T,​java.lang.String>
        Returns:
        a textual representation of null
      • getState

        protected com.vaadin.shared.ui.grid.renderers.ButtonRendererState getState()
        Description copied from class: AbstractClientConnector
        Returns the shared state for this connector. The shared state object is shared between the server connector and the client connector. Changes are only communicated from the server to the client and not in the other direction.

        As a side effect, marks the connector dirty so any changes done to the state will be sent to the client. Use getState(false) to avoid marking the connector as dirty.

        Overrides:
        getState in class ClickableRenderer<T,​java.lang.String>
        Returns:
        The shared state for this connector. Never null.
      • getState

        protected com.vaadin.shared.ui.grid.renderers.ButtonRendererState getState​(boolean markAsDirty)
        Description copied from class: AbstractClientConnector
        Returns the shared state for this connector.
        Overrides:
        getState in class ClickableRenderer<T,​java.lang.String>
        Parameters:
        markAsDirty - true if the connector should automatically be marked dirty, false otherwise
        Returns:
        The shared state for this connector. Never null.
        See Also:
        AbstractClientConnector.getState()
      • setHtmlContentAllowed

        public void setHtmlContentAllowed​(boolean htmlContentAllowed)
        Sets whether the data should be rendered as HTML (instead of text).

        By default everything is rendered as text.

        Parameters:
        htmlContentAllowed - true to render as HTML, false to render as text
        Since:
        8.0.3
      • isHtmlContentAllowed

        public boolean isHtmlContentAllowed()
        Gets whether the data should be rendered as HTML (instead of text).

        By default everything is rendered as text.

        Returns:
        true if the renderer renders a HTML, false if the content is rendered as text
        Since:
        8.0.3