forked from kscience/visionforge
Really Raw version of hierarchy documentation.
This commit is contained in:
parent
052336700a
commit
004cdc049b
32
docs/hierarchy.md
Normal file
32
docs/hierarchy.md
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# Hierarchy
|
||||||
|
|
||||||
|
![](../docs/images/hierarchy.png)
|
||||||
|
|
||||||
|
### Vision
|
||||||
|
|
||||||
|
* function `getProperty(name: Name, inherit: Boolean, includeStyles: Boolean, includeDefaults: Boolean)`.
|
||||||
|
|
||||||
|
It gets properties of element with `name` identification.
|
||||||
|
`inherit` — toggles parent node property lookup. Null means inference from descriptor. Default is false.
|
||||||
|
`includeStyles` — toggles inclusion of. Null means inference from descriptor. Default is true.
|
||||||
|
`includeDefaults` — default is false.
|
||||||
|
|
||||||
|
* function `setProperty(name: Name, item: MetaItem?, notify: Boolean = true)`
|
||||||
|
|
||||||
|
Sets the `item` property to the element with the `name` identification. `notify` is a value which toggles the necessity of the change notification. Default is true.
|
||||||
|
|
||||||
|
### About properties
|
||||||
|
**Properties have to be set in particular order:**
|
||||||
|
|
||||||
|
* styles
|
||||||
|
* prototypes
|
||||||
|
* parent
|
||||||
|
* parent's styles
|
||||||
|
* defaults
|
||||||
|
|
||||||
|
|
||||||
|
## Inheritance
|
||||||
|
|
||||||
|
Inheritance is a very useful ability of `children` elements to get the same property in default as his parent does have (to 'inherit' it).
|
||||||
|
|
||||||
|
|
BIN
docs/images/hierarchy.png
Normal file
BIN
docs/images/hierarchy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
@ -5,6 +5,7 @@ interface Vision{
|
|||||||
val parent: Vision?
|
val parent: Vision?
|
||||||
fun getProperty(name): MetaItem?
|
fun getProperty(name): MetaItem?
|
||||||
fun setProperty(name, value)
|
fun setProperty(name, value)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class VisionBase{
|
class VisionBase{
|
||||||
|
@ -17,11 +17,6 @@ import space.kscience.dataforge.values.ValueType
|
|||||||
import space.kscience.visionforge.Vision.Companion.STYLE_KEY
|
import space.kscience.visionforge.Vision.Companion.STYLE_KEY
|
||||||
import kotlin.jvm.Synchronized
|
import kotlin.jvm.Synchronized
|
||||||
|
|
||||||
internal data class PropertyListener(
|
|
||||||
val owner: Any? = null,
|
|
||||||
val action: (name: Name) -> Unit,
|
|
||||||
)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A full base implementation for a [Vision]
|
* A full base implementation for a [Vision]
|
||||||
* @param properties Object own properties excluding styles and inheritance
|
* @param properties Object own properties excluding styles and inheritance
|
||||||
@ -43,7 +38,7 @@ public open class VisionBase(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A fast accessor method to get own property (no inheritance or styles
|
* A fast accessor method to get own property (no inheritance or styles)
|
||||||
*/
|
*/
|
||||||
override fun getOwnProperty(name: Name): MetaItem? = if (name == Name.EMPTY) {
|
override fun getOwnProperty(name: Name): MetaItem? = if (name == Name.EMPTY) {
|
||||||
properties?.asMetaItem()
|
properties?.asMetaItem()
|
||||||
|
Loading…
Reference in New Issue
Block a user