aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-05-11 02:29:40 +0200
committerRobert Jaros <rjaros@finn.pl>2019-05-11 02:29:40 +0200
commit825445b7041e2b07622801b0bbbf779b70f03f23 (patch)
treedb87b654f88f1b3656840c76bfc0b86e549d765f /src/main/kotlin/pl
parent857afb0fa7e8bdf435e2bb7cb5d951ba29449362 (diff)
downloadkvision-825445b7041e2b07622801b0bbbf779b70f03f23.tar.gz
kvision-825445b7041e2b07622801b0bbbf779b70f03f23.tar.bz2
kvision-825445b7041e2b07622801b0bbbf779b70f03f23.zip
Refactor focus and blur methods in FormControl interface.
Diffstat (limited to 'src/main/kotlin/pl')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/FormControl.kt10
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt4
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroupInput.kt4
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt4
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()
}