sreich
01/27/2017, 10:23 PMsreich
01/27/2017, 10:25 PMRuckus
01/27/2017, 10:34 PMRuckus
01/27/2017, 10:35 PMRuckus
01/27/2017, 10:36 PMhastebrot
01/28/2017, 8:43 AMSo you'd just wipe everything between tests, right?@edvin maybe, I have to take a look
hastebrot
01/28/2017, 8:56 AMApp::start()
are needed to init single `View`s. I see the val view = find(...)
we spoke about. But we also need the other statements (default uncaught exception handler, apply stylesheets, hook global shortcuts, bind title property, create primary scene, set default workspace), I guess.hastebrot
01/28/2017, 9:09 AM@BeforeEach
, @AfterEach
, and @Test
as part of the "test execution lifecycle" (http://junit.org/junit5/docs/current/user-guide/#extensions-lifecycle-callbacks).hastebrot
01/28/2017, 9:10 AMApp
lifecycle and View
lifecycle.hastebrot
01/28/2017, 9:25 AMhastebrot
01/28/2017, 9:29 AMhastebrot
01/28/2017, 10:01 AMDimension.AngularUnits
👍 Reminds me of the euclid
cargo package for the Rust programming language.permalmberg
01/28/2017, 10:05 AMhastebrot
01/28/2017, 10:17 AMpermalmberg
01/28/2017, 11:00 AMDouble
. I have a base class like this:
abstract class BaseProperty<T> internal constructor(val header: String, protected val key: String, protected val defaultValue: T, protected val comp: Component) : ViewModel() {
var value: T by property(defaultValue)
fun valueProperty() = getProperty(BaseProperty<T>::value)
abstract fun updateValue(v: T)
abstract fun readValue() : T
fun init()
{
value = readValue()
}
init {
valueProperty().onChange {
updateValue(value)
}
}
}
from which I inherit a more specified "property handler": class IntProperty(header: String, key: String, defaultValue: Int, c: Component) : BaseProperty<Int>(header, key, defaultValue, c) {
override fun readValue(): Int {
return comp.getProperty(key, defaultValue)
}
override fun updateValue(v: Int) {
comp.setProperty(key, v)
}
}
In my ViewBuilder
(part of the ViewModel-layer) I do this:
override fun show(property: IntProperty) {
property.init()
with(myForm) {
field(property.header) {
textfield {
bind(property.valueProperty())
}
}
}
}
i.e. I bind to a BaseProperty<Int>::value
. This is working fine as long as only numbers are entered. As soon as a .
or other non-numbers are entered an exception is thrown. That is in itself is expected and I need to use a converter for that (I also want to add a validator). This is where I run into problems. The examples in the TFX guide all says to use the format textfield(model.name) { }
but I can't get that compile since it can't find an overload that matches - it seems want a Number
. Do I have any other option than to use Number
instead of Int
and Double
? My backend is in Java so it has no notion of Number
.edvin
01/28/2017, 11:00 AMhastebrot
01/28/2017, 11:15 AMSimpleIntegerProperty
and SimpleDoubleProperty
use NumberExpressionBase
, don't they? Hence all the intValue()
, doubleValue()
convenience methods. Don't know if this is related.permalmberg
01/28/2017, 11:41 AM.value
is typed to in this case. var value : T by property(defaultValue)
where T
is Int
I must be missing something in how this works...ron
01/28/2017, 3:51 PMron
01/28/2017, 3:52 PMedvin
01/28/2017, 3:58 PMcarlw
01/28/2017, 4:05 PMron
01/28/2017, 4:26 PMron
01/28/2017, 4:27 PMpermalmberg
01/28/2017, 4:29 PMsetOnAction {
for (prop in myProps) {
if( !prop.commit()) {
break
}
}
}
into setOnAction {
myProps
.filterNot { it.commit() }
.forEach { break }
}
but then break isn't allowed and the meaning is different.gtnarg
01/28/2017, 5:13 PMmyProps.first{ !it.commit() }
gtnarg
01/28/2017, 5:18 PMmyProps.filterNot{ it.commit() }.firstOrNull()
gtnarg
01/28/2017, 5:28 PMcarlw
01/28/2017, 5:33 PMron
01/28/2017, 5:37 PM