beepdog
09/26/2018, 4:03 PMcssprop
function is private 😞beepdog
09/26/2018, 4:05 PMRuckus
09/26/2018, 4:28 PMcssproperty
, not cssprop
Ruckus
09/26/2018, 4:34 PMclass Styles {
companion object {
val myText by cssproperty<String>("-text-value") { it.toUpperCase() }
}
init {
label {
myText.value = "Test" // Notice the use of `.value`
}
}
}
results in
.label {
-text-value: TEST;
}
beepdog
09/26/2018, 6:26 PMbeepdog
09/26/2018, 6:44 PMbeepdog
09/26/2018, 6:44 PMicon.style {
Styles.iconColor.value = c("red")
}
beepdog
09/26/2018, 6:44 PMbeepdog
09/26/2018, 6:45 PMCaused by: java.lang.NullPointerException
at tornadofx.PropertyHolder$CssProperty.setValue(CSS.kt:867)
at is.kow.deskscreen.jira.JiraErrorView$root$1$3$1$1.invoke(JiraView.kt:111)
at is.kow.deskscreen.jira.JiraErrorView$root$1$3$1$1.invoke(JiraView.kt:92)
at tornadofx.CSSKt.style(CSS.kt:1116)
at tornadofx.CSSKt.style$default(CSS.kt:1108)
Ruckus
09/26/2018, 6:46 PMvalue
isn't actually a value. It's just a function that forwards the new value into the current context.beepdog
09/26/2018, 6:46 PMbeepdog
09/26/2018, 6:47 PMbeepdog
09/26/2018, 6:47 PMRuckus
09/26/2018, 6:49 PMredIcons {
iconColor.value = c("red")
}
greenIcons {
iconColor.value = c("green")
}
The value is just forwarded on to the current internal property holder (there's one created for each selector). Otherwise the property could only be set to a single global value, and would be useless.beepdog
09/26/2018, 6:49 PMbeepdog
09/26/2018, 6:49 PMbeepdog
09/26/2018, 6:51 PMbeepdog
09/26/2018, 6:52 PMbeepdog
09/26/2018, 6:52 PMclass Styles : Stylesheet() {
companion object {
val darkness by cssclass()
val redIcon by cssclass()
// Define our styles
val iconColor by cssproperty<Paint>("-fx-icon-color")
// Define our colors
val bg = c("#000000")
}
init {
darkness {
star {
backgroundColor += bg
textFill = c("white")
//By default, we want our icon styles to be white
iconColor.value = c("white")
}
}
redIcon {
iconColor.value = c("red")
}
}
}
beepdog
09/26/2018, 6:52 PMbeepdog
09/26/2018, 6:53 PMbeepdog
09/26/2018, 6:54 PMikonli-font-icon and redIcon
to make it pick?beepdog
09/26/2018, 6:55 PMbeepdog
09/26/2018, 6:56 PMbeepdog
09/26/2018, 6:57 PM*
like I'd expect CSS to work?beepdog
09/26/2018, 6:58 PM.*
to be the lowest priority CSS, but it seems to be the highest prioritybeepdog
09/26/2018, 6:58 PMbeepdog
09/26/2018, 6:59 PMbeepdog
09/26/2018, 6:59 PMStyles.redIcon.name
or put in a proper name in the by cssclass()
beepdog
09/26/2018, 7:00 PM