forked from NPM/numass-framework
Set storing by default
This commit is contained in:
parent
c20ac1ffb8
commit
b2bc67ecc3
@ -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::class.java).find { it.name == stateName }
|
||||
val state: ValueState = device.states.filterIsInstance<ValueState>().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::class.java).find { it.name == stateName }
|
||||
val state: ValueState = device.states.filterIsInstance<ValueState>().find { it.name == stateName }
|
||||
?: throw NameNotFoundException("State with name $stateName not found")
|
||||
return state.asBooleanProperty()
|
||||
}
|
||||
|
@ -112,15 +112,17 @@ 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).onChange {
|
||||
runLater {
|
||||
isSelected = it?.boolean ?: false
|
||||
connection.valueStateProperty(state).apply {
|
||||
isSelected = value?.boolean ?: false
|
||||
onChange {
|
||||
runLater {
|
||||
isSelected = it?.boolean ?: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,10 @@ 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