aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/form/spinner
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-02-25 01:04:24 +0100
committerRobert Jaros <rjaros@finn.pl>2018-02-25 01:04:24 +0100
commit9a1effcf29b27cc2e60b927c2d737b6cad0289b7 (patch)
treecd47309106493f869a7d7d5e9a43dcc99969dd4c /src/main/kotlin/pl/treksoft/kvision/form/spinner
parentc64b2c4b1f0c4e0e0d94d202715db4aaa47d9c65 (diff)
downloadkvision-9a1effcf29b27cc2e60b927c2d737b6cad0289b7.tar.gz
kvision-9a1effcf29b27cc2e60b927c2d737b6cad0289b7.tar.bz2
kvision-9a1effcf29b27cc2e60b927c2d737b6cad0289b7.zip
Change enum classes names for better readability.
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/form/spinner')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt22
2 files changed, 15 insertions, 15 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt b/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt
index 3cd50473..7a6a535d 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt
@@ -46,8 +46,8 @@ import pl.treksoft.kvision.utils.SnOn
*/
open class Spinner(
value: Number? = null, min: Int = 0, max: Int = DEFAULT_MAX, step: Double = DEFAULT_STEP,
- decimals: Int = 0, buttonsType: BUTTONSTYPE = BUTTONSTYPE.VERTICAL,
- forceType: FORCETYPE = FORCETYPE.NONE, label: String? = null,
+ decimals: Int = 0, buttonsType: ButtonsType = ButtonsType.VERTICAL,
+ forceType: ForceType = ForceType.NONE, label: String? = null,
rich: Boolean = false
) : SimplePanel(setOf("form-group")), NumberFormControl {
@@ -246,8 +246,8 @@ open class Spinner(
*/
fun Container.spinner(
value: Number? = null, min: Int = 0, max: Int = DEFAULT_MAX, step: Double = DEFAULT_STEP,
- decimals: Int = 0, buttonsType: BUTTONSTYPE = BUTTONSTYPE.VERTICAL,
- forceType: FORCETYPE = FORCETYPE.NONE, label: String? = null,
+ decimals: Int = 0, buttonsType: ButtonsType = ButtonsType.VERTICAL,
+ forceType: ForceType = ForceType.NONE, label: String? = null,
rich: Boolean = false, init: (Spinner.() -> Unit)? = null
): Spinner {
val spinner = Spinner(value, min, max, step, decimals, buttonsType, forceType, label, rich).apply {
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
index 23c48a80..a0da7999 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
@@ -27,13 +27,13 @@ import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.core.StringBoolPair
import pl.treksoft.kvision.core.StringPair
import pl.treksoft.kvision.core.Widget
-import pl.treksoft.kvision.form.INPUTSIZE
+import pl.treksoft.kvision.form.InputSize
import pl.treksoft.kvision.utils.obj
/**
* Spinner buttons layout types.
*/
-enum class BUTTONSTYPE {
+enum class ButtonsType {
NONE,
HORIZONTAL,
VERTICAL
@@ -42,7 +42,7 @@ enum class BUTTONSTYPE {
/**
* Spinner force rounding types.
*/
-enum class FORCETYPE(internal val value: String) {
+enum class ForceType(internal val value: String) {
NONE("none"),
ROUND("round"),
FLOOR("floor"),
@@ -68,19 +68,19 @@ internal const val DEFAULT_MAX = 100
@Suppress("TooManyFunctions")
open class SpinnerInput(
value: Number? = null, min: Int = 0, max: Int = DEFAULT_MAX, step: Double = DEFAULT_STEP,
- decimals: Int = 0, buttonsType: BUTTONSTYPE = BUTTONSTYPE.VERTICAL,
- forceType: FORCETYPE = FORCETYPE.NONE,
+ decimals: Int = 0, buttonsType: ButtonsType = ButtonsType.VERTICAL,
+ forceType: ForceType = ForceType.NONE,
classes: Set<String> = setOf()
) : Widget(classes + "form-control") {
init {
this.addSurroundingCssClass("input-group")
- if (buttonsType == BUTTONSTYPE.NONE) {
+ if (buttonsType == ButtonsType.NONE) {
this.addSurroundingCssClass("kv-spinner-btn-none")
} else {
this.removeSurroundingCssClass("kv-spinner-btn-none")
}
- if (buttonsType == BUTTONSTYPE.VERTICAL) {
+ if (buttonsType == ButtonsType.VERTICAL) {
this.addSurroundingCssClass("kv-spinner-btn-vertical")
} else {
this.removeSurroundingCssClass("kv-spinner-btn-vertical")
@@ -152,7 +152,7 @@ open class SpinnerInput(
/**
* The size of the input.
*/
- var size: INPUTSIZE? by refreshOnUpdate()
+ var size: InputSize? by refreshOnUpdate()
private var siblings: JQuery? = null
@@ -270,7 +270,7 @@ open class SpinnerInput(
}
private fun getSettingsObj(): dynamic {
- val verticalbuttons = buttonsType == BUTTONSTYPE.VERTICAL || buttonsType == BUTTONSTYPE.NONE
+ val verticalbuttons = buttonsType == ButtonsType.VERTICAL || buttonsType == ButtonsType.NONE
return obj {
this.min = min
this.max = max
@@ -291,8 +291,8 @@ open class SpinnerInput(
*/
fun Container.spinnerInput(
value: Number? = null, min: Int = 0, max: Int = DEFAULT_MAX, step: Double = DEFAULT_STEP,
- decimals: Int = 0, buttonsType: BUTTONSTYPE = BUTTONSTYPE.VERTICAL,
- forceType: FORCETYPE = FORCETYPE.NONE, classes: Set<String> = setOf(),
+ decimals: Int = 0, buttonsType: ButtonsType = ButtonsType.VERTICAL,
+ forceType: ForceType = ForceType.NONE, classes: Set<String> = setOf(),
init: (SpinnerInput.() -> Unit)? = null
): SpinnerInput {
val spinnerInput = SpinnerInput(value, min, max, step, decimals, buttonsType, forceType, classes).apply {