All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.data2viz.viz.StateManager.kt Maven / Gradle / Ivy

There is a newer version: 0.8.0-RC5
Show newest version
package io.data2viz.viz


/**
 * Manage states of an Element with Stateable properties.
 */
class StateManager {

    var status = StateManagerStatus.REST

    val properties = mutableListOf()

    fun addStateProperty(property: StateProperty){
        properties.add(property)
    }

    fun percentToState(percent: Double) {
        status = StateManagerStatus.UPDATE_PROPERTIES
        properties.forEach {
            it.setPercent(percent)
        }
        status = StateManagerStatus.REST
    }
}
enum class StateManagerStatus {
    REST, RECORD, UPDATE_PROPERTIES
}

interface StateProperty {
    fun setPercent(percent: Double)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy