Should forField attempt to auto add the tooltip/title?
This is tricky because forField accepts HasValue but Component.tooltip is an extension on Component.
Here is an example of how I am currently solving it:
fun Component.tooltip(property: KProperty1<*, *>): Component = tooltip(property.name)
fun Component.tooltip(column: Grid.Column<*>): Component = tooltip(column.key)
private fun Component.tooltip(key: String): Component {
tooltip = SharedUtil.camelCaseToHumanFriendly(key)
return this
}
/**
* Create a [TextField] with a [TextField.valueChangeTimeout] of 600.
*/
fun <BEAN : Any, FILTER : Filter<BEAN>> FilterBar<BEAN, FILTER>.textField(column: Grid.Column<BEAN>): FilterBar.Binding.Builder<BEAN, String, FILTER> {
val component = TextField().apply {
// increase filter timeout from default 400 to 600
// 400 seems a little fast for when someone is typing in a value (in case they pause)
valueChangeTimeout = 600
addThemeVariants(TextFieldVariant.LUMO_SMALL)
tooltip(column)
}
return forField(component, column)
}
Should
forFieldattempt to auto add the tooltip/title?This is tricky because
forFieldacceptsHasValuebutComponent.tooltipis an extension onComponent.Here is an example of how I am currently solving it: