Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
8985c20c
Commit
8985c20c
authored
Feb 17, 2020
by
ryoii
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
f*ck JFoenix
parent
24eaa15c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
28 deletions
+82
-28
mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/util/JFoenixAdaptor.kt
.../net/mamoe/mirai/console/graphical/util/JFoenixAdaptor.kt
+28
-0
mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PrimaryView.kt
...lin/net/mamoe/mirai/console/graphical/view/PrimaryView.kt
+54
-28
No files found.
mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/util/JFoenixAdaptor.kt
0 → 100644
View file @
8985c20c
package
net.mamoe.mirai.console.graphical.util
import
com.jfoenix.controls.JFXButton
import
com.jfoenix.controls.JFXListView
import
com.jfoenix.controls.JFXTabPane
import
javafx.collections.ObservableList
import
javafx.event.EventTarget
import
javafx.scene.Node
import
javafx.scene.control.Button
import
javafx.scene.control.ListView
import
javafx.scene.control.TabPane
import
tornadofx.SortedFilteredList
import
tornadofx.attachTo
internal
fun
EventTarget
.
jfxTabPane
(
op
:
TabPane
.()
->
Unit
=
{})
=
JFXTabPane
().
attachTo
(
this
,
op
)
internal
fun
EventTarget
.
jfxButton
(
text
:
String
=
""
,
graphic
:
Node
?
=
null
,
op
:
Button
.()
->
Unit
=
{})
=
JFXButton
(
text
).
attachTo
(
this
,
op
)
{
if
(
graphic
!=
null
)
it
.
graphic
=
graphic
}
internal
fun
<
T
>
EventTarget
.
jfxListView
(
values
:
ObservableList
<
T
>?
=
null
,
op
:
ListView
<
T
>.()
->
Unit
=
{})
=
JFXListView
<
T
>().
attachTo
(
this
,
op
)
{
if
(
values
!=
null
)
{
if
(
values
is
SortedFilteredList
<
T
>)
values
.
bindTo
(
it
)
else
it
.
items
=
values
}
}
mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PrimaryView.kt
View file @
8985c20c
package
net.mamoe.mirai.console.graphical.view
package
net.mamoe.mirai.console.graphical.view
import
com.jfoenix.controls.JFXListCell
import
javafx.scene.control.TabPane
import
javafx.scene.control.TabPane
import
javafx.s
tage.Modality
import
javafx.s
cene.image.Image
import
net.mamoe.mirai.console.graphical.controller.MiraiGraphicalUIController
import
net.mamoe.mirai.console.graphical.controller.MiraiGraphicalUIController
import
net.mamoe.mirai.console.graphical.model.BotModel
import
net.mamoe.mirai.console.graphical.util.jfxButton
import
net.mamoe.mirai.console.graphical.util.jfxListView
import
net.mamoe.mirai.console.graphical.util.jfxTabPane
import
tornadofx.*
import
tornadofx.*
import
java.io.FileInputStream
class
PrimaryView
:
View
()
{
class
PrimaryView
:
View
()
{
...
@@ -11,45 +17,65 @@ class PrimaryView : View() {
...
@@ -11,45 +17,65 @@ class PrimaryView : View() {
override
val
root
=
borderpane
{
override
val
root
=
borderpane
{
top
=
menubar
{
prefWidth
=
1000.0
menu
(
"机器人"
)
{
prefHeight
=
650.0
item
(
"登录"
).
action
{
find
<
LoginFragment
>().
openModal
(
modality
=
Modality
.
APPLICATION_MODAL
,
resizable
=
false
)
}
}
}
left
=
listview
(
controller
.
botList
)
{
left
=
vbox
{
fitToParentHeight
()
cellFormat
{
imageview
(
Image
(
FileInputStream
(
"logo.png"
)))
graphic
=
vbox
{
// bot list
label
(
it
.
uin
.
toString
())
jfxListView
(
controller
.
botList
)
{
// label(stringBinding(it.botProperty) { if (value != null) value.nick else "登陆中" })
fitToParentSize
()
}
// prefHeight = 100.0
setCellFactory
{
onDoubleClick
{
object
:
JFXListCell
<
BotModel
>()
{
(
center
as
TabPane
).
tab
(
it
.
uin
.
toString
())
{
init
{
listview
(
it
.
logHistory
)
onDoubleClick
{
(
center
as
TabPane
).
tab
(
item
.
uin
.
toString
())
{
listview
(
item
.
logHistory
)
select
()
onDoubleClick
{
close
()
}
}
}
}
isClosable
=
true
override
fun
updateItem
(
item
:
BotModel
?,
empty
:
Boolean
)
{
select
()
super
.
updateItem
(
item
,
empty
)
if
(
item
!=
null
&&
!
empty
)
{
graphic
=
null
text
=
item
.
uin
.
toString
()
}
else
{
graphic
=
null
text
=
""
}
}
}
}
}
}
}
}
gridpane
{
row
{
jfxButton
(
"登录"
)
jfxButton
(
"插件"
)
jfxButton
(
"设置"
)
}
}
}
}
center
=
tabp
ane
{
center
=
jfxTabP
ane
{
tab
(
"Main"
)
{
tab
(
"Main"
)
{
listview
(
controller
.
mainLog
)
listview
(
controller
.
mainLog
)
{
isClosable
=
false
fitToParentSize
()
cellFormat
{
graphic
=
label
(
it
)
{
maxWidthProperty
().
bind
(
this
@
listview
.
widthProperty
())
isWrapText
=
true
}
}
}
}
}
}
}
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment