Skip to content

Commit

Permalink
Vis-gui: improve UI
Browse files Browse the repository at this point in the history
  • Loading branch information
ksmirenko committed Apr 24, 2018
1 parent bbf7306 commit 140850d
Showing 1 changed file with 35 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import tornadofx.*
class MainWindow : View("Code anomaly visualizer GUI") {
override val root = VBox()

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

root += selectDatasetButton.root
// root += selectDatasetButton.root
root += anomalyCategoryLabel.root
root += anomalyIdLabel.root
root += anomalyContentView.root
Expand All @@ -29,31 +29,37 @@ class MainWindow : View("Code anomaly visualizer GUI") {
}
}

class SelectDatasetButton : View() {
override val root = button("CHANGE DATASET") {
vboxConstraints {
marginTopBottom(R.MARGIN_SMALL)
marginLeftRight(R.MARGIN_SMALL)
}
action {
val repoRootDirectory = chooseDirectory("Select root folder of the dataset")
if (repoRootDirectory != null) {
Model.openDataset(repoRootDirectory)
//class SelectDatasetButton : View() {
// override val root =
//}

class AnomalyCategoryLabel : View() {
override val root = borderpane {
left = label {
borderpaneConstraints {
marginTopBottom(R.MARGIN_SMALL)
marginLeftRight(R.MARGIN_LEFT)
}
addClass("card-title")
bind(Model.categoryProperty)
}
isFocusTraversable = false
addClass("button")
}
}

class AnomalyCategoryLabel : View() {
override val root = label {
vboxConstraints {
marginLeftRight(R.MARGIN_LEFT)
right = button("Change dataset") {
borderpaneConstraints {
marginTopBottom(R.MARGIN_SMALL)
marginLeftRight(R.MARGIN_LEFT)
}
action {
val repoRootDirectory = chooseDirectory("Select root folder of the dataset")
if (repoRootDirectory != null) {
Model.openDataset(repoRootDirectory)
}
}
isFocusTraversable = false
addClass("button-raised")
}
addClass("card-title")
bind(Model.categoryProperty)
}

}

class AnomalyIdLabel : View() {
Expand All @@ -68,20 +74,23 @@ class AnomalyIdLabel : View() {

class LabelButtonRow : View() {
override val root = hbox {
vboxConstraints { marginTopBottom(R.MARGIN_SMALL) }
button("WANT MORE") {
vboxConstraints {
marginTopBottom(R.MARGIN_SMALL)
marginLeft = R.MARGIN_SMALL
}
button("Want more") {
hboxConstraints { marginLeftRight(R.MARGIN_SMALL) }
action { Model.processUserResponse(UserResponse.WANT_MORE) }
isFocusTraversable = false
addClass("button-raised")
}
button("ENOUGH") {
button("Enough, next class") {
hboxConstraints { marginLeftRight(R.MARGIN_SMALL) }
action { Model.processUserResponse(UserResponse.ENOUGH) }
isFocusTraversable = false
addClass("button-raised")
}
button("USELESS") {
button("Useless, next class") {
hboxConstraints { marginLeftRight(R.MARGIN_SMALL) }
action { Model.processUserResponse(UserResponse.USELESS) }
isFocusTraversable = false
Expand Down

0 comments on commit 140850d

Please sign in to comment.