Wizard: add descriptions for settings

This commit is contained in:
Ilya Kirillov
2020-08-27 14:06:51 +03:00
parent 09ed0c3e82
commit 37b869ebc5
16 changed files with 120 additions and 35 deletions
@@ -20,6 +20,7 @@ typealias AnySetting = Setting<*, *>
interface Setting<out V : Any, out T : SettingType<V>> : Entity, ActivityCheckerOwner, Validatable<V> {
val title: String
val description: String?
val defaultValue: SettingDefaultValue<V>?
val isRequired: Boolean
val isSavable: Boolean
@@ -31,6 +32,7 @@ interface Setting<out V : Any, out T : SettingType<V>> : Entity, ActivityChecker
data class InternalSetting<out V : Any, out T : SettingType<V>>(
override val path: String,
override val title: String,
override val description: String?,
override val defaultValue: SettingDefaultValue<V>?,
override val isAvailable: Checker,
override val isRequired: Boolean,
@@ -23,6 +23,7 @@ abstract class SettingBuilder<V : Any, T : SettingType<V>>(
var validateOnProjectCreation = true
var isSavable: Boolean = false
var isRequired: Boolean? = null
var description: String? = null
fun value(value: V) = SettingDefaultValue.Value(value)
fun dynamic(getter: Reader.(SettingReference<V, SettingType<V>>) -> V?) =
@@ -47,6 +48,7 @@ abstract class SettingBuilder<V : Any, T : SettingType<V>>(
fun buildInternal() = InternalSetting(
path = path,
title = title,
description = description,
defaultValue = defaultValue,
isAvailable = isAvailable,
isRequired = isRequired ?: (defaultValue == null),