''' package Views import Controller.Store import ...
# tornadofx
c
''' package Views import Controller.Store import javafx.scene.paint.Color import javafx.scene.text.Font import javafx.scene.text.FontWeight import tornadofx.* class BookView : View() { val store: Store by inject() var chapterNum = 1 override val root = vbox { useMaxWidth = true prefHeight = 525.0 prefWidth = 525.0 scrollpane { vbox { text(store.book.title) { font = Font.font("sans-serif", FontWeight.EXTRA_BOLD, 18.0) fill = Color.RED stroke = Color.BLACK strokeWidth = 0.75 } val sb = StringBuilder() for (chap in store.book.chapters) { if (store.getChapterNumber(chap.title) == chapterNum) { text(chap.title) { font = Font.font("sans-serif", FontWeight.EXTRA_BOLD, 18.0) stroke = Color.RED fill = Color.BLACK strokeWidth = 0.75 } for (v in chap.verses) { sb.append(v.text) } continue } } text(sb.toString()) } } hbox { button("<<<Prev").setOnAction { selectChapter("prev") } button(chapterNum.toString()) button(">>>Next").setOnAction { selectChapter("nxt") } } } private fun selectChapter(string: String): Int { if (string == "prev") { if (chapterNum > 1) chapterNum -= 1 else chapterNum = 1 } else if (string == "nxt") { if (chapterNum < store.book.chapters.size) chapterNum += 1 else chapterNum = 1 } println(chapterNum) return chapterNum } } '''