ysny.karibu-tools.karibu-tools.0.21.source-code.RadioButtons.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of karibu-tools Show documentation
Show all versions of karibu-tools Show documentation
Karibu-Tools: The Vaadin Missing Utilities
The newest version!
package com.github.mvysny.kaributools
import com.vaadin.flow.component.ItemLabelGenerator
import com.vaadin.flow.component.radiobutton.RadioButtonGroup
import com.vaadin.flow.data.renderer.TextRenderer
/**
* Sets the item label [generator] that is used to produce the strings shown
* in the combo box for each item. By default,
* `String.valueOf()` is used.
*
* Setting [RadioButtonGroup.setRenderer] removes any generator set via this function.
*/
public fun RadioButtonGroup.setItemLabelGenerator(generator: ItemLabelGenerator) {
// workaround for https://github.com/vaadin/flow-components/issues/1681
setRenderer(TextRenderer(generator))
}