Compare commits
No commits in common. "9a1e9dc996c039892f6a49dbfcf1e8851f31c027" and "8e45062957461a4eed28c1e9a5661a027f678c91" have entirely different histories.
9a1e9dc996
...
8e45062957
@ -78,13 +78,13 @@ abstract class DeviceDisplayFX<D : Device> : Component(), Connection {
|
||||
protected abstract fun buildView(device: D): UIComponent?;
|
||||
|
||||
fun valueStateProperty(stateName: String): ObjectProperty<Value> {
|
||||
val state: ValueState = device.states.filterIsInstance<ValueState>().find { it.name == stateName }
|
||||
val state: ValueState = device.states.filterIsInstance(ValueState::class.java).find { it.name == stateName }
|
||||
?: throw NameNotFoundException("State with name $stateName not found")
|
||||
return state.asProperty()
|
||||
}
|
||||
|
||||
fun booleanStateProperty(stateName: String): BooleanProperty {
|
||||
val state: ValueState = device.states.filterIsInstance<ValueState>().find { it.name == stateName }
|
||||
val state: ValueState = device.states.filterIsInstance(ValueState::class.java).find { it.name == stateName }
|
||||
?: throw NameNotFoundException("State with name $stateName not found")
|
||||
return state.asBooleanProperty()
|
||||
}
|
||||
|
@ -112,17 +112,15 @@ fun EventTarget.deviceStateIndicator(connection: DeviceDisplayFX<*>, state: Stri
|
||||
fun Node.deviceStateToggle(connection: DeviceDisplayFX<*>, state: String, title: String = state) {
|
||||
if (connection.device.stateNames.contains(state)) {
|
||||
togglebutton(title) {
|
||||
isSelected = false
|
||||
selectedProperty().addListener { _, oldValue, newValue ->
|
||||
if (oldValue != newValue) {
|
||||
connection.device.states[state] = newValue
|
||||
}
|
||||
}
|
||||
connection.valueStateProperty(state).apply {
|
||||
isSelected = value?.boolean ?: false
|
||||
onChange {
|
||||
runLater {
|
||||
isSelected = it?.boolean ?: false
|
||||
}
|
||||
connection.valueStateProperty(state).onChange {
|
||||
runLater {
|
||||
isSelected = it?.boolean ?: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,10 +47,6 @@ class VacCollectorDevice(context: Context, meta: Meta, val sensors: Collection<S
|
||||
|
||||
private val helper = StorageHelper(this, this::buildLoader)
|
||||
|
||||
init {
|
||||
states["storing"] = true
|
||||
}
|
||||
|
||||
private val collector = object : DeviceListener {
|
||||
val averagingDuration: Duration = Duration.parse(meta.getString("averagingDuration", "PT30S"))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user