diff options
author | Robert Jaros <rjaros@finn.pl> | 2019-05-11 02:29:40 +0200 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2019-05-11 02:29:40 +0200 |
commit | 825445b7041e2b07622801b0bbbf779b70f03f23 (patch) | |
tree | db87b654f88f1b3656840c76bfc0b86e549d765f /src/main/kotlin | |
parent | 857afb0fa7e8bdf435e2bb7cb5d951ba29449362 (diff) | |
download | kvision-825445b7041e2b07622801b0bbbf779b70f03f23.tar.gz kvision-825445b7041e2b07622801b0bbbf779b70f03f23.tar.bz2 kvision-825445b7041e2b07622801b0bbbf779b70f03f23.zip |
Refactor focus and blur methods in FormControl interface.
Diffstat (limited to 'src/main/kotlin')
4 files changed, 16 insertions, 6 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/FormControl.kt b/src/main/kotlin/pl/treksoft/kvision/form/FormControl.kt index 57ce88eb..3019fb6f 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/FormControl.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/FormControl.kt @@ -47,6 +47,16 @@ interface FormInput : Component { * The name attribute of the generated HTML input element. */ var name: String? + + /** + * Makes the input element focused. + */ + fun focus() + + /** + * Makes the input element blur. + */ + fun blur() } /** diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt index 6973efe9..07b86b4c 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt @@ -152,14 +152,14 @@ abstract class CheckInput( /** * Makes the input element focused. */ - open fun focus() { + override fun focus() { getElementJQuery()?.focus() } /** * Makes the input element blur. */ - open fun blur() { + override fun blur() { getElementJQuery()?.blur() } diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroupInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroupInput.kt index 98839982..fca681f6 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroupInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroupInput.kt @@ -150,11 +150,11 @@ open class RadioGroupInput( } } - fun focus() { + override fun focus() { getChildren().filterIsInstance<Radio>().firstOrNull()?.focus() } - fun blur() { + override fun blur() { getChildren().filterIsInstance<Radio>().firstOrNull()?.blur() } diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt index c9ea2dba..393ae63f 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt @@ -157,14 +157,14 @@ abstract class AbstractTextInput( /** * Makes the input element focused. */ - open fun focus() { + override fun focus() { getElementJQuery()?.focus() } /** * Makes the input element blur. */ - open fun blur() { + override fun blur() { getElementJQuery()?.blur() } |