Skip to content

Commit 140850d

Browse files
committed
Vis-gui: improve UI
1 parent bbf7306 commit 140850d

File tree

1 file changed

+35
-26
lines changed
  • visualizer-gui/src/main/kotlin/io/github/ksmirenko/kotlin/visualizerGui/view

1 file changed

+35
-26
lines changed

visualizer-gui/src/main/kotlin/io/github/ksmirenko/kotlin/visualizerGui/view/MainWindow.kt

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import tornadofx.*
88
class MainWindow : View("Code anomaly visualizer GUI") {
99
override val root = VBox()
1010

11-
private val selectDatasetButton: SelectDatasetButton by inject()
11+
// private val selectDatasetButton: SelectDatasetButton by inject()
1212
private val anomalyCategoryLabel: AnomalyCategoryLabel by inject()
1313
private val anomalyIdLabel: AnomalyIdLabel by inject()
1414
private val anomalyContentView: AnomalySourceView by inject()
@@ -17,7 +17,7 @@ class MainWindow : View("Code anomaly visualizer GUI") {
1717
init {
1818
root.prefWidth = 800.0
1919

20-
root += selectDatasetButton.root
20+
// root += selectDatasetButton.root
2121
root += anomalyCategoryLabel.root
2222
root += anomalyIdLabel.root
2323
root += anomalyContentView.root
@@ -29,31 +29,37 @@ class MainWindow : View("Code anomaly visualizer GUI") {
2929
}
3030
}
3131

32-
class SelectDatasetButton : View() {
33-
override val root = button("CHANGE DATASET") {
34-
vboxConstraints {
35-
marginTopBottom(R.MARGIN_SMALL)
36-
marginLeftRight(R.MARGIN_SMALL)
37-
}
38-
action {
39-
val repoRootDirectory = chooseDirectory("Select root folder of the dataset")
40-
if (repoRootDirectory != null) {
41-
Model.openDataset(repoRootDirectory)
32+
//class SelectDatasetButton : View() {
33+
// override val root =
34+
//}
35+
36+
class AnomalyCategoryLabel : View() {
37+
override val root = borderpane {
38+
left = label {
39+
borderpaneConstraints {
40+
marginTopBottom(R.MARGIN_SMALL)
41+
marginLeftRight(R.MARGIN_LEFT)
4242
}
43+
addClass("card-title")
44+
bind(Model.categoryProperty)
4345
}
44-
isFocusTraversable = false
45-
addClass("button")
46-
}
47-
}
4846

49-
class AnomalyCategoryLabel : View() {
50-
override val root = label {
51-
vboxConstraints {
52-
marginLeftRight(R.MARGIN_LEFT)
47+
right = button("Change dataset") {
48+
borderpaneConstraints {
49+
marginTopBottom(R.MARGIN_SMALL)
50+
marginLeftRight(R.MARGIN_LEFT)
51+
}
52+
action {
53+
val repoRootDirectory = chooseDirectory("Select root folder of the dataset")
54+
if (repoRootDirectory != null) {
55+
Model.openDataset(repoRootDirectory)
56+
}
57+
}
58+
isFocusTraversable = false
59+
addClass("button-raised")
5360
}
54-
addClass("card-title")
55-
bind(Model.categoryProperty)
5661
}
62+
5763
}
5864

5965
class AnomalyIdLabel : View() {
@@ -68,20 +74,23 @@ class AnomalyIdLabel : View() {
6874

6975
class LabelButtonRow : View() {
7076
override val root = hbox {
71-
vboxConstraints { marginTopBottom(R.MARGIN_SMALL) }
72-
button("WANT MORE") {
77+
vboxConstraints {
78+
marginTopBottom(R.MARGIN_SMALL)
79+
marginLeft = R.MARGIN_SMALL
80+
}
81+
button("Want more") {
7382
hboxConstraints { marginLeftRight(R.MARGIN_SMALL) }
7483
action { Model.processUserResponse(UserResponse.WANT_MORE) }
7584
isFocusTraversable = false
7685
addClass("button-raised")
7786
}
78-
button("ENOUGH") {
87+
button("Enough, next class") {
7988
hboxConstraints { marginLeftRight(R.MARGIN_SMALL) }
8089
action { Model.processUserResponse(UserResponse.ENOUGH) }
8190
isFocusTraversable = false
8291
addClass("button-raised")
8392
}
84-
button("USELESS") {
93+
button("Useless, next class") {
8594
hboxConstraints { marginLeftRight(R.MARGIN_SMALL) }
8695
action { Model.processUserResponse(UserResponse.USELESS) }
8796
isFocusTraversable = false

0 commit comments

Comments
 (0)