aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/dropdown
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-01-17 19:29:30 +0100
committerRobert Jaros <rjaros@finn.pl>2018-01-17 19:29:30 +0100
commit31c9d3c4121107974a8419752aa7face5c96f821 (patch)
tree77aaac10c5a120b028c14f53ab74eb5491f4a443 /src/main/kotlin/pl/treksoft/kvision/dropdown
parent646e82e383850447fd4d10f71ecc0aeab11623e0 (diff)
downloadkvision-31c9d3c4121107974a8419752aa7face5c96f821.tar.gz
kvision-31c9d3c4121107974a8419752aa7face5c96f821.tar.bz2
kvision-31c9d3c4121107974a8419752aa7face5c96f821.zip
Code formatting (Kotlin Style Guide)
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/dropdown')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt b/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
index 880cb436..53d722b1 100644
--- a/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
@@ -21,9 +21,11 @@ enum class DD(val type: String) {
SEPARATOR("DD#SEPARATOR")
}
-open class DropDown(text: String, elements: List<StringPair>? = null, icon: String? = null,
- style: BUTTONSTYLE = BUTTONSTYLE.DEFAULT, disabled: Boolean = false,
- classes: Set<String> = setOf()) : SimplePanel(classes) {
+open class DropDown(
+ text: String, elements: List<StringPair>? = null, icon: String? = null,
+ style: BUTTONSTYLE = BUTTONSTYLE.DEFAULT, disabled: Boolean = false,
+ classes: Set<String> = setOf()
+) : SimplePanel(classes) {
var text
get() = button.text
set(value) {
@@ -71,8 +73,10 @@ open class DropDown(text: String, elements: List<StringPair>? = null, icon: Stri
}
private val idc = "kv_dropdown_" + counter
- internal val button: DropDownButton = DropDownButton(idc, text, icon, style,
- disabled, setOf("dropdown"))
+ internal val button: DropDownButton = DropDownButton(
+ idc, text, icon, style,
+ disabled, setOf("dropdown")
+ )
internal val list: DropDownListTag = DropDownListTag(idc, setOf("dropdown-menu"))
init {
@@ -172,22 +176,28 @@ open class DropDown(text: String, elements: List<StringPair>? = null, icon: Stri
}
}
-open class DropDownButton(id: String, text: String, icon: String? = null, style: BUTTONSTYLE = BUTTONSTYLE.DEFAULT,
- disabled: Boolean = false, classes: Set<String> = setOf()) :
- Button(text, icon, style, disabled, classes) {
+open class DropDownButton(
+ id: String, text: String, icon: String? = null, style: BUTTONSTYLE = BUTTONSTYLE.DEFAULT,
+ disabled: Boolean = false, classes: Set<String> = setOf()
+) :
+ Button(text, icon, style, disabled, classes) {
init {
this.id = id
}
override fun getSnAttrs(): List<StringPair> {
- return super.getSnAttrs() + listOf("data-toggle" to "dropdown", "aria-haspopup" to "true",
- "aria-expanded" to "false")
+ return super.getSnAttrs() + listOf(
+ "data-toggle" to "dropdown", "aria-haspopup" to "true",
+ "aria-expanded" to "false"
+ )
}
}
-open class DropDownListTag(private val ariaId: String, classes: Set<String> = setOf()) : ListTag(LIST.UL, null,
- false, classes) {
+open class DropDownListTag(private val ariaId: String, classes: Set<String> = setOf()) : ListTag(
+ LIST.UL, null,
+ false, classes
+) {
override fun getSnAttrs(): List<StringPair> {
return super.getSnAttrs() + listOf("aria-labelledby" to ariaId)