aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/tabs
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2017-10-01 03:12:58 +0200
committerRobert Jaros <rjaros@finn.pl>2017-10-01 03:12:58 +0200
commitd732f672bfbfa565c6ec4fc037381554de251ad3 (patch)
treeb0a8388de30e568d2ca5b6d33c330ccdedfebe09 /src/main/kotlin/pl/treksoft/kvision/tabs
parent69826202db3424beb47923f80d86bf1412053941 (diff)
downloadkvision-d732f672bfbfa565c6ec4fc037381554de251ad3.tar.gz
kvision-d732f672bfbfa565c6ec4fc037381554de251ad3.tar.bz2
kvision-d732f672bfbfa565c6ec4fc037381554de251ad3.zip
GridPanel, HPanel and VPanel
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/tabs')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/tabs/Tabs.kt56
1 files changed, 0 insertions, 56 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/tabs/Tabs.kt b/src/main/kotlin/pl/treksoft/kvision/tabs/Tabs.kt
deleted file mode 100644
index 773f341a..00000000
--- a/src/main/kotlin/pl/treksoft/kvision/tabs/Tabs.kt
+++ /dev/null
@@ -1,56 +0,0 @@
-package pl.treksoft.kvision.tabs
-
-import pl.treksoft.kvision.core.Container
-import pl.treksoft.kvision.core.ResString
-import pl.treksoft.kvision.core.Widget
-import pl.treksoft.kvision.html.Link
-import pl.treksoft.kvision.html.TAG
-import pl.treksoft.kvision.html.Tag
-import pl.treksoft.kvision.panel.StackPanel
-
-open class Tabs : Container(setOf()) {
- private var nav = Tag(TAG.UL, classes = setOf("nav", "nav-tabs"))
- private var content = StackPanel(false)
- var activeIndex
- get() = content.activeIndex
- set(value) {
- content.activeIndex = value
- nav.children.forEach { it.removeCssClass("active") }
- if (content.activeIndex >= 0 && content.activeIndex <= nav.children.size) {
- nav.children[content.activeIndex].addCssClass("active")
- }
- }
-
- init {
- this.add(nav)
- this.add(content)
- }
-
- open fun addTab(title: String, panel: Widget, icon: String? = null,
- image: ResString? = null): Tabs {
- val tag = Tag(TAG.LI)
- tag.role = "presentation"
- tag.add(Link(title, "#", icon, image))
- val index = nav.children.size
- tag.setEventListener {
- click = { e ->
- activeIndex = index
- e.preventDefault()
- }
- }
- nav.add(tag)
- if (nav.children.size == 1) {
- tag.addCssClass("active")
- activeIndex = 0
- }
- content.add(panel)
- return this
- }
-
- open fun removeTab(index: Int): Tabs {
- nav.removeAt(index)
- content.removeAt(index)
- activeIndex = content.activeIndex
- return this
- }
-}