diff --git a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/model/PluginModel.kt b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/model/PluginModel.kt index 9402a435d..763201b07 100644 --- a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/model/PluginModel.kt +++ b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/model/PluginModel.kt @@ -2,6 +2,7 @@ package net.mamoe.mirai.console.graphical.model import com.jfoenix.controls.datamodels.treetable.RecursiveTreeObject import javafx.beans.property.SimpleBooleanProperty +import javafx.beans.property.SimpleStringProperty import net.mamoe.mirai.console.plugins.PluginDescription import tornadofx.getValue import tornadofx.setValue @@ -14,6 +15,11 @@ class PluginModel( ) : RecursiveTreeObject() { constructor(plugin: PluginDescription) : this(plugin.name, plugin.version, plugin.author, plugin.info) + val nameProperty = SimpleStringProperty(this, "nameProperty", name) + val versionProperty = SimpleStringProperty(this, "versionProperty", version) + val authorProperty = SimpleStringProperty(this, "authorProperty", author) + val descriptionProperty = SimpleStringProperty(this, "descriptionProperty", description) + val enabledProperty = SimpleBooleanProperty(this, "enabledProperty") var enabled by enabledProperty } \ No newline at end of file diff --git a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PluginsView.kt b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PluginsView.kt index 7351b2480..b05cf3f6b 100644 --- a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PluginsView.kt +++ b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PluginsView.kt @@ -12,21 +12,48 @@ class PluginsView : View() { val plugins = controller.pluginList override val root = jfxTreeTableView(plugins) { + isShowRoot = false columns.addAll( JFXTreeTableColumn("插件名").apply { prefWidthProperty().bind(this@jfxTreeTableView.widthProperty().multiply(0.1)) + + setCellValueFactory { + return@setCellValueFactory it.value.value.nameProperty + } }, JFXTreeTableColumn("版本").apply { prefWidthProperty().bind(this@jfxTreeTableView.widthProperty().multiply(0.1)) + + setCellValueFactory { + return@setCellValueFactory it.value.value.versionProperty + } }, JFXTreeTableColumn("作者").apply { prefWidthProperty().bind(this@jfxTreeTableView.widthProperty().multiply(0.1)) + + setCellValueFactory { + return@setCellValueFactory it.value.value.authorProperty + } }, JFXTreeTableColumn("介绍").apply { prefWidthProperty().bind(this@jfxTreeTableView.widthProperty().multiply(0.6)) + + setCellValueFactory { + return@setCellValueFactory it.value.value.descriptionProperty + } }, - JFXTreeTableColumn("操作").apply { + JFXTreeTableColumn("操作").apply { prefWidthProperty().bind(this@jfxTreeTableView.widthProperty().multiply(0.08)) + +// setCellValueFactory { return@setCellValueFactory it.value.valueProperty() } +// +// setCellFactory { +// return@setCellFactory object : TreeTableCell() { +// override fun updateItem(item: PluginModel?, empty: Boolean) { +// +// } +// } +// } } ) }