Empty bot list view

This commit is contained in:
ryoii 2020-03-28 22:49:01 +08:00
parent 27cb975c62
commit 92d9e27b04
3 changed files with 35 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package net.mamoe.mirai.console.graphical.stylesheet
import javafx.scene.Cursor
import javafx.scene.paint.Color
import javafx.scene.text.FontWeight
import tornadofx.*
@ -46,6 +47,24 @@ class PrimaryStyleSheet : BaseStyleSheet() {
jfxListView {
// placeholder
vBox {
spacing = 15.px
label {
textFill = c(fontColor)
fontWeight = FontWeight.BOLD
}
button {
textFill = c(fontColor)
fontWeight = FontWeight.BOLD
backgroundColor += c(secondaryColor, 0.8)
padding = box(2.px, 10.px)
cursor = Cursor.HAND
}
}
jfxListCell {
backgroundColor += c(100, 100, 100, 0.4)
backgroundRadius += box(5.px)

View File

@ -14,7 +14,7 @@ import tornadofx.bind
internal fun EventTarget.jfxTabPane(op: JFXTabPane.() -> Unit = {}) = JFXTabPane().attachTo(this, op)
internal fun EventTarget.jfxButton(text: String = "", graphic: Node? = null, op: Button.() -> Unit = {}) =
internal fun EventTarget.jfxButton(text: String = "", graphic: Node? = null, op: JFXButton.() -> Unit = {}) =
JFXButton(text).attachTo(this, op) {
if (graphic != null) it.graphic = graphic
it.buttonType = JFXButton.ButtonType.RAISED

View File

@ -1,5 +1,6 @@
package net.mamoe.mirai.console.graphical.view
import com.jfoenix.controls.JFXButton
import com.jfoenix.controls.JFXListCell
import javafx.collections.ObservableList
import javafx.geometry.Insets
@ -39,6 +40,20 @@ class PrimaryView : View() {
jfxListView(controller.botList) {
fitToParentHeight()
placeholder = vbox {
alignment = Pos.CENTER
label("Bot列表为空请登录一个Bot")
jfxButton("登录") {
buttonType = JFXButton.ButtonType.FLAT
}.action {
// select login pane
mainTabPane.selectionModel.select(3)
}
}
setCellFactory {
object : JFXListCell<BotModel>() {
var tab: Tab? = null