/** * Creates a new button renderer and adds the given click listener to it. * * @param listener * the click listener to register * @param nullRepresentation * the textual representation of {@code null} value */ public ButtonRenderer(RendererClickListener<T> listener, String nullRepresentation) { this(nullRepresentation); addClickListener(listener); }
/** * Gets whether the data should be rendered as HTML (instead of text). * <p> * By default everything is rendered as text. * * @return <code>true</code> if the renderer renders a HTML, * <code>false</code> if the content is rendered as text * * @since 8.0.3 */ public boolean isHtmlContentAllowed() { return getState(false).htmlContentAllowed; } }
@Override protected ButtonRenderer<T> createImplementation() { if (listener != null) { return new ButtonRenderer<>(createClickListenerWrapper(listener), getNullRepresentation()); } else { return new ButtonRenderer<>(getNullRepresentation()); } }
getColumn("delete").setRenderer(new ButtonRenderer(event -> { Object itemId = event.getItemId(); indexed.removeItem(itemId);
/** * Sets whether the data should be rendered as HTML (instead of text). * <p> * By default everything is rendered as text. * * @param htmlContentAllowed * <code>true</code> to render as HTML, <code>false</code> to * render as text * * @since 8.0.3 */ public void setHtmlContentAllowed(boolean htmlContentAllowed) { getState().htmlContentAllowed = htmlContentAllowed; }