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

commonMain.jetbrains.datalore.vis.svg.SvgStyleElement.kt Maven / Gradle / Ivy

There is a newer version: 3.2.0
Show newest version
/*
 * Copyright (c) 2019. JetBrains s.r.o.
 * Use of this source code is governed by the MIT license that can be found in the LICENSE file.
 */

package jetbrains.datalore.vis.svg

class SvgStyleElement(val resource: SvgCssResource) : SvgElement() {

    override val elementName = "style"

    init {
        setContent(resource.css())
    }

    fun setContent(content: String) {
        val children = children()
        while (!children.isEmpty()) {
            children.removeAt(0)
        }
        val textNode = SvgTextNode(content)
        children.add(textNode)
        setAttribute("type", "text/css")
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy