ysny.karibu-tools.karibu-tools.0.21.source-code.ListBoxes.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.listbox.ListBoxBase
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 [ListBoxBase.setRenderer] removes any generator set via this function.
*/
public fun ListBoxBase<*, T, *>.setItemLabelGenerator(generator: ItemLabelGenerator) {
// workaround for https://github.com/vaadin/platform/issues/2601
setRenderer(TextRenderer(generator))
}