Package-level declarations

Types

Link copied to clipboard

Always appends the indicator.

Link copied to clipboard

Configuration used to customize slider controls.

Link copied to clipboard

Configuration used to customize circularSlider controls.

Link copied to clipboard
class FieldInfo<T>
Link copied to clipboard
interface FieldVisualizer<T>

Defines the visualization of a Field within a Form.

Link copied to clipboard
class Form : View

A visual component that serves as a strongly-typed constructor of some arbitrary type. Forms are very similar to constructors in that they have typed parameter lists (fields), and can only "create" instances when all their inputs are valid. Like any constructor, a Form can have optional fields, default values, and arbitrary types for its fields.

Link copied to clipboard
Link copied to clipboard

Config for labeled controls.

Link copied to clipboard

Config for labeled controls.

Link copied to clipboard

Configuration for radio and check lists.

Link copied to clipboard

Configuration used to customize rangeSlider controls.

Link copied to clipboard

Defines style of indicator to use when showing labeled fields as required.

Link copied to clipboard

Config for scrolling controls.

Link copied to clipboard

Configuration used to customize slider controls.

Link copied to clipboard

Configuration for textField controls.

Link copied to clipboard

Only appends the indicator after a field is initially (or becomes) invalid.

Link copied to clipboard
class WhenInvalidFocusLost(text: StyledText, focusTarget: View? = null) : RequiredIndicatorStyle

Only appends the indicator after a field is initially (or becomes) invalid and it loses focus.

Link copied to clipboard

Only appends the indicator if explicitly requested. and it loses focus.

Functions

Link copied to clipboard

Creates a CheckBox control that is bound to a Field (of type Boolean).

Link copied to clipboard
fun <T> checkList(first: T, vararg rest: T, config: OptionListConfig<T>.() -> Unit = {}): FieldVisualizer<List<T>>

Creates a list of CheckBoxs that is bound to a Field. This controls lets a user select multiple options from a list. This control lets a user ignore selection entirely, which would result in an empty list.

Link copied to clipboard
inline fun <T : Number, Comparable<T>> circularRangeSlider(range: ClosedRange<T>, noinline config: CircularRangeSliderConfig<T>.() -> Unit = {}): FieldVisualizer<ClosedRange<T>>

Creates a CircularRangeSlider control that is bound to a Field. This control lets the user select a value within a range.

Link copied to clipboard
inline fun <T : Number, Comparable<T>> circularSlider(model: ConfinedValueModel<T>, noinline config: CircularSliderConfig<T>.() -> Unit = {}): FieldVisualizer<T>
inline fun <T : Number, Comparable<T>> circularSlider(range: ClosedRange<T>, noinline config: CircularSliderConfig<T>.() -> Unit = {}): FieldVisualizer<T>

Creates a CircularSlider control that is bound to a Field. This control lets the user select a value within a range.

Link copied to clipboard
fun <T, M : ListModel<T>> dropDown(model: M, boxItemVisualizer: ItemVisualizer<T, IndexedItem>, listItemVisualizer: ItemVisualizer<T, IndexedItem> = boxItemVisualizer, config: (Dropdown<T, *>) -> Unit = {}): FieldVisualizer<T>
fun <T> dropDown(first: T, vararg rest: T, label: (T) -> String = { "$it" }, config: (Dropdown<T, *>) -> Unit = {}): FieldVisualizer<T>
fun <T> dropDown(first: T, vararg rest: T, boxItemVisualizer: ItemVisualizer<T, IndexedItem>, listItemVisualizer: ItemVisualizer<T, IndexedItem> = boxItemVisualizer, config: (Dropdown<T, *>) -> Unit = {}): FieldVisualizer<T>

Creates a Dropdown control that is bound to a Field. This control lets a user select a single item within a list. It is similar to radioList, except it DOES set a default value and its field is therefore ALWAYS Valid.

fun <T : Any> dropDown(first: T, vararg rest: T, label: (T) -> String = { "$it" }, unselectedLabel: String, config: (Dropdown<T?, *>) -> Unit = {}): FieldVisualizer<T>
fun <T : Any> dropDown(first: T, vararg rest: T, boxItemVisualizer: ItemVisualizer<T, IndexedItem>, listItemVisualizer: ItemVisualizer<T, IndexedItem> = boxItemVisualizer, unselectedBoxItemVisualizer: ItemVisualizer<Unit, IndexedItem>, unselectedListItemVisualizer: ItemVisualizer<Unit, IndexedItem> = unselectedBoxItemVisualizer, config: (Dropdown<T?, *>) -> Unit = {}): FieldVisualizer<T>

Creates a Dropdown control that is bound to a Field. This control lets a user select a single item within a list. It is similar to radioList, in that it DOES NOT set a default value and its field is Invalid if no initial value is bound to it. The control actually has an "unselected" state when it is invalid.

Link copied to clipboard
fun <T> field(block: FieldInfo<T>.() -> View): FieldVisualizer<T>

Helper for creating a FieldVisualizer from a lambda.

Link copied to clipboard
fun file(acceptedTypes: Set<MimeType<*>> = emptySet()): FieldVisualizer<LocalFile>

Creates a FileSelector control that is bound to a Field (of type LocalFile).

Link copied to clipboard
fun files(acceptedTypes: Set<MimeType<*>> = emptySet()): FieldVisualizer<List<LocalFile>>

Creates a FileSelector control that is bound to a Field (of type List of LocalFile).

Link copied to clipboard
inline fun <R, T> Form.FieldState<T>.fold(onValid: (value: T) -> R, default: R): R
inline fun <R, T> Form.Field<T>.fold(onValid: (value: T) -> R, default: R): R

Returns the result of onValid if this instance is valid or default if it is invalid.

Link copied to clipboard

Creates a Form component that is bound to a Field. This control allows nesting of forms using a DSL like that used for top-level forms.

Link copied to clipboard

Creates a Container with the result of visualizer as its only child, that is bound to a Field. This control simply wraps an existing one with a configurable container.

Link copied to clipboard
inline fun <T> Form.FieldState<T>.ifInvalid(onInvalid: () -> Unit)

Does the action of onInvalid if this instance is invalid.

Link copied to clipboard
inline fun <T> Form.FieldState<T>.ifValid(onValid: (value: T) -> Unit)
inline fun <T> Form.Field<T>.ifValid(onValid: (value: T) -> Unit)

Does the action of onValid if this instance is valid.

Link copied to clipboard
fun <T> labeled(name: StyledText, showRequired: RequiredIndicatorStyle? = WhenInvalid(), visualizer: NamedConfig.() -> FieldVisualizer<T>): FieldVisualizer<T>
fun <T> labeled(name: String, showRequired: RequiredIndicatorStyle? = WhenInvalid(), visualizer: NamedConfig.() -> FieldVisualizer<T>): FieldVisualizer<T>

Creates a component with a Label and the result of visualizer that is bound to a Field. This control simply wraps an existing one with a configurable text label.

fun <T> labeled(name: StyledText, help: StyledText, showRequired: RequiredIndicatorStyle? = WhenInvalid(), visualizer: LabeledConfig.() -> FieldVisualizer<T>): FieldVisualizer<T>
fun <T> labeled(name: String, help: String, showRequired: RequiredIndicatorStyle? = WhenInvalid(), visualizer: LabeledConfig.() -> FieldVisualizer<T>): FieldVisualizer<T>

Creates a component with a name Label, the result of visualizer and a helper Label that is bound to a Field. This control simply wraps an existing one with configurable text labels.

Link copied to clipboard
fun <T, M : ListModel<T>> list(model: M, itemVisualizer: ItemVisualizer<T, IndexedItem> = toString(StringVisualizer()), fitContents: Set<Dimension> = setOf(Height), config: (List<T, M>) -> Unit = {}): FieldVisualizer<List<T>>
fun list(progression: IntProgression, itemVisualizer: ItemVisualizer<Int, IndexedItem> = toString(StringVisualizer()), fitContents: Set<Dimension> = setOf(Height), config: (List<Int, *>) -> Unit = {}): FieldVisualizer<List<Int>>
fun <T> list(first: T, vararg rest: T, itemVisualizer: ItemVisualizer<T, IndexedItem> = toString(StringVisualizer()), fitContents: Set<Dimension> = setOf(Height), config: (List<T, *>) -> Unit = {}): FieldVisualizer<List<T>>

Creates a List control that is bound to a Field. This controls lets a user select multiple options from a list. This control lets a user ignore selection entirely, which would result in an empty list. It is similar to a checkList.

Link copied to clipboard
inline fun <T, R> Form.FieldState<T>.map(onValid: (value: T) -> R): Form.FieldState<R>

Returns a valid state from the result of onValid if this instance is valid or invalid otherwise.

Link copied to clipboard
inline fun <T, R> Form.Field<T>.mapValue(onValid: (value: T) -> R): Form.FieldState<R>

Returns a valid state from the result of onValid if this instance is valid or invalid otherwise.

Link copied to clipboard
fun <T : Any> optionalDropDown(first: T, vararg rest: T, label: (T) -> String = { "$it" }, unselectedLabel: String, config: (Dropdown<T?, *>) -> Unit = {}): FieldVisualizer<T?>
fun <T : Any, M : ListModel<T>> optionalDropDown(model: M, boxItemVisualizer: ItemVisualizer<T, IndexedItem>, listItemVisualizer: ItemVisualizer<T, IndexedItem> = boxItemVisualizer, unselectedBoxItemVisualizer: ItemVisualizer<Unit, IndexedItem>, unselectedListItemVisualizer: ItemVisualizer<Unit, IndexedItem> = unselectedBoxItemVisualizer, config: (Dropdown<T?, *>) -> Unit = {}): FieldVisualizer<T?>
fun <T : Any> optionalDropDown(first: T, vararg rest: T, boxItemVisualizer: ItemVisualizer<T, IndexedItem>, listItemVisualizer: ItemVisualizer<T, IndexedItem> = boxItemVisualizer, unselectedBoxItemVisualizer: ItemVisualizer<Unit, IndexedItem>, unselectedListItemVisualizer: ItemVisualizer<Unit, IndexedItem> = unselectedBoxItemVisualizer, config: (Dropdown<T?, *>) -> Unit = {}): FieldVisualizer<T?>

Creates a Dropdown control that is bound to a Field. This control lets a user select a single item within a list. It is similar to optionalRadioList. This control lets a user ignore selection entirely and therefore the resulting type is T?.

Link copied to clipboard
fun <T : Any> optionalRadioList(first: T, vararg rest: T, config: OptionListConfig<T>.() -> Unit = {}): FieldVisualizer<T?>

Creates a list of RadioButtons within a ButtonGroup that is bound to a Field. This controls lets a user select an option from a list. This control lets a user ignore selection entirely and therefore the resulting type is T?.

Link copied to clipboard
fun <T, M : ListModel<T>> optionalSingleChoiceList(model: M, itemVisualizer: ItemVisualizer<T, IndexedItem> = toString(StringVisualizer()), fitContents: Set<Dimension> = setOf(Height), config: (List<T, M>) -> Unit = {}): FieldVisualizer<T?>
fun optionalSingleChoiceList(progression: IntProgression, itemVisualizer: ItemVisualizer<Int, IndexedItem> = toString(StringVisualizer()), fitContents: Set<Dimension> = setOf(Height), config: (List<Int, *>) -> Unit = {}): FieldVisualizer<Int?>
fun <T> optionalSingleChoiceList(first: T, vararg rest: T, itemVisualizer: ItemVisualizer<T, IndexedItem> = toString(StringVisualizer()), fitContents: Set<Dimension> = setOf(Height), config: (List<T, *>) -> Unit = {}): FieldVisualizer<T?>

Creates a List control that is bound to a Field. This controls lets a user select a single option from a list. This control lets a user ignore selection entirely, which would result in a null value. This is behaves like optionalRadioList.

Link copied to clipboard
fun <T> radioList(first: T, vararg rest: T, config: OptionListConfig<T>.() -> Unit = {}): FieldVisualizer<T>

Creates a list of RadioButtons within a ButtonGroup that is bound to a Field. This controls lets a user select an option from a list.

Link copied to clipboard
inline fun <T : Number, Comparable<T>> rangeSlider(model: ConfinedRangeModel<T>, orientation: Orientation = Horizontal, noinline config: RangeSliderConfig<T>.() -> Unit = {}): FieldVisualizer<ClosedRange<T>>
inline fun <T : Number, Comparable<T>> rangeSlider(range: ClosedRange<T>, orientation: Orientation = Horizontal, noinline config: RangeSliderConfig<T>.() -> Unit = {}): FieldVisualizer<ClosedRange<T>>

Creates a RangeSlider control that is bound to a Field. This control lets the user select a value within a range.

fun <T : Number, Comparable<T>> rangeSlider(model: ConfinedRangeModel<T>, orientation: Orientation = Horizontal, config: RangeSliderConfig<T>.() -> Unit = {}, type: KClass<T>): FieldVisualizer<ClosedRange<T>>
Link copied to clipboard

Creates a ScrollPanel with the result of visualizer as its content, that is bound to a Field. This control simply wraps an existing one with a configurable scroll panel.

Link copied to clipboard
fun singleChoiceList(progression: IntProgression, itemVisualizer: ItemVisualizer<Int, IndexedItem> = toString(StringVisualizer()), fitContents: Set<Dimension> = setOf(Height), config: (List<Int, *>) -> Unit = {}): FieldVisualizer<Int>

Creates a List control that is bound to a Field. This controls lets a user select a single option from a list.

fun <T, M : ListModel<T>> singleChoiceList(first: T, vararg rest: T, itemVisualizer: ItemVisualizer<T, IndexedItem> = toString(StringVisualizer()), fitContents: Set<Dimension> = setOf(Height), config: (List<T, *>) -> Unit = {}): FieldVisualizer<T>

Creates a List control that is bound to a Field. This controls lets a user select a single option from a list. This is behaves like radioList.

Link copied to clipboard
inline fun <T : Number, Comparable<T>> slider(model: ConfinedValueModel<T>, orientation: Orientation = Horizontal, noinline config: SliderConfig<T>.() -> Unit = {}): FieldVisualizer<T>
inline fun <T : Number, Comparable<T>> slider(range: ClosedRange<T>, orientation: Orientation = Horizontal, noinline config: SliderConfig<T>.() -> Unit = {}): FieldVisualizer<T>

Creates a Slider control that is bound to a Field. This control lets the user select a value within a range.

fun <T : Number, Comparable<T>> slider(model: ConfinedValueModel<T>, orientation: Orientation = Horizontal, config: SliderConfig<T>.() -> Unit = {}, type: KClass<T>): FieldVisualizer<T>
Link copied to clipboard
fun <T, M : SpinnerModel<T>> spinner(model: M, itemVisualizer: ItemVisualizer<T, Spinner<T, M>> = toString(StringVisualizer()), config: (Spinner<T, M>) -> Unit = {}): FieldVisualizer<T>
fun <T> spinner(first: T, vararg rest: T, itemVisualizer: ItemVisualizer<T, Spinner<T, *>>, config: (Spinner<T, *>) -> Unit = {}): FieldVisualizer<T>
fun <T> spinner(first: T, vararg rest: T, label: (T) -> String = { "$it" }, config: (Spinner<T, *>) -> Unit = {}): FieldVisualizer<T>

Creates a Spinner control that is bound to a Field. This control lets a user select a single item within a list. It is similar to radioList, except it DOES set a default value and its field is therefore ALWAYS Valid.

Link copied to clipboard

Creates a Switch control that is bound to a Field (of type Boolean).

Link copied to clipboard
fun <T> switchList(first: T, vararg rest: T, config: OptionListConfig<T>.() -> Unit = {}): FieldVisualizer<List<T>>

Creates a list of Switches that is bound to a Field. This controls lets a user select multiple options from a list. This control lets a user ignore selection entirely, which would result in an empty list.

Link copied to clipboard
fun textField(pattern: Regex = Regex(".*"), validator: (String) -> Boolean = { true }, config: TextFieldConfig<String>.() -> Unit = {}): FieldVisualizer<String>

Creates a TextField control that is bounded to a Field (of type String). The associated field will only be valid if the text field's input matches pattern.

fun <T> textField(pattern: Regex = Regex(".*"), encoder: Encoder<T, String>, validator: (T) -> Boolean = { true }, config: TextFieldConfig<T>.() -> Unit = {}): FieldVisualizer<T>

Creates a TextField control that is bounded to a Field. The associated field will only be valid if the text field's input matches pattern and encoder.decode produces a valid T from it.

Link copied to clipboard
fun verticalLayout(container: View, spacing: Double = 2.0, itemHeight: Double? = null): Layout