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

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

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


/**
 * The base class of each element of the viz hierarchy.
 * Keeps a reference to the parent node.
 */
abstract class Node: HasStyle {

    var parent: HasChildren? = null

    /**
     * Specifies whether the item is visible. When set to false, the item won’t be drawn.
     *
     * default to true.
     */
    var visible: Boolean = true

    var _style:Style? = null


    override val style: Style
        get() = _style ?: parent?.style ?: Style().also { _style = it }


    /**
     * Removes the node from the hierarchy.
     */
    fun remove(){
        parent?.remove(this)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy