AbstractView
On this page
- AbstractView ⇐
Positionable
- AbstractView(properties, options)
- rendererCreate()
- __isDisplayableChildren(childName) ⇒
boolean
- _buildAfterRenderingContext()
- _build()
- $$preBuild()
- getRootView() ⇒
View
- getParentHierarchy() ⇒
Array.<View>
- isChildOf(parentId) ⇒
boolean
- getChildrenIds() ⇒
Array.<string>
- _createChildren(children, options)
- addChildren(children, [style])
- removeAllChildren()
- removeChild(childId)
- removeAllStates()
- removeState(stateId)
- _buildTransitions()
- _createTransitions(transitions)
- addTransitions(transitions)
- removeAllTransitions()
- removeTransition(stateId)
- _buildAnimations()
- _createAnimations(animations)
- addAnimations(animations)
- removeAllAnimations()
- removeAnimation(animationId)
- startAnimation(idAnimation, [options]) ⇒
Promise.<Array>
- addPropertyAnimation(pName, params) ⇒
Object
- _updateAnimationRTL(pName, animation) ⇒
*
- removePropertyAnimation(animation) ⇒
boolean
- show()
- _toJson() ⇒
*
- getNbChildrenInfo([view]) ⇒
Object
- attach(options)
- _attach()
- detach()
- _detach()
- _isAttached() ⇒
boolean
- _declare()
- _declareOptimize()
AbstractView ⇐ Positionable
Kind: global abstract class
Extends: Positionable
Mixes: MViewStates
, MFocus
Properties
Name | Type | Description |
---|---|---|
isShown | boolean | flag |
isInteractive | boolean | flag |
isView | boolean | flag |
data | * | The data that are represented by the view |
group | object | |
willChangeProperties | Array | Properties that will change on the next frame |
$$childRectChanged | AbstractView | AbstractPrimitive | variable used to watch if child width/height/x/y changed DO NOT USE |
- AbstractView ⇐
Positionable
- new AbstractView(properties, options)
- instance
- .rendererCreate()
- .__isDisplayableChildren(childName) ⇒
boolean
- ._buildAfterRenderingContext()
- ._build()
- .$$preBuild()
- .getRootView() ⇒
View
- .getParentHierarchy() ⇒
Array.<View>
- .isChildOf(parentId) ⇒
boolean
- .getChildrenIds() ⇒
Array.<string>
- ._createChildren(children, options)
- .addChildren(children, [style])
- .removeAllChildren()
- .removeChild(childId)
- .removeAllStates()
- .removeState(stateId)
- ._buildTransitions()
- ._createTransitions(transitions)
- .addTransitions(transitions)
- .removeAllTransitions()
- .removeTransition(stateId)
- ._buildAnimations()
- ._createAnimations(animations)
- .addAnimations(animations)
- .removeAllAnimations()
- .removeAnimation(animationId)
- .startAnimation(idAnimation, [options]) ⇒
Promise.<Array>
- .addPropertyAnimation(pName, params) ⇒
Object
- ._updateAnimationRTL(pName, animation) ⇒
*
- .removePropertyAnimation(animation) ⇒
boolean
- .show()
- ._toJson() ⇒
*
- .getNbChildrenInfo([view]) ⇒
Object
- .attach(options)
- ._attach()
- .detach()
- ._detach()
- ._isAttached() ⇒
boolean
- static
AbstractView(properties, options)
A View is a component that is composed of primitives or views.
Param | Type | Description |
---|---|---|
properties | Object | |
options | Object | |
options.parent | Object | Parent of the view |
rendererCreate()
Kind: instance method of AbstractView
__isDisplayableChildren(childName) ⇒ boolean
Check if the children can be displayed
Kind: instance method of AbstractView
Param | Type |
---|---|
childName | String |
_buildAfterRenderingContext()
Build the view from the class declaration (after rendering context is created) /!\ You should never call these method directly /!\
Kind: instance method of AbstractView
Access: protected
_build()
Build the view from the class declaration You should never call these method directly
Kind: instance method of AbstractView
Access: protected
$$preBuild()
Extension point ** Internal use only** Called before the build of children has started
Kind: instance method of AbstractView
getRootView() ⇒ View
Iterates hierarchy to find the root of the view
Kind: instance method of AbstractView
Returns: View
- The root view
getParentHierarchy() ⇒ Array.<View>
Iterates hierarchy and return the parent list
Kind: instance method of AbstractView
Returns: Array.<View>
- list of parent hierarchy
isChildOf(parentId) ⇒ boolean
Iterates hierarchy to check if this view belongs to a given parent
Kind: instance method of AbstractView
Returns: boolean
- true if this view is a child of parentId
Param | Type | Description |
---|---|---|
parentId | string | view id to check |
getChildrenIds() ⇒ Array.<string>
Kind: instance method of AbstractView
Returns: Array.<string>
- the keys of the children property
_createChildren(children, options)
Read the children definition and copy it to the internal ‘children’ object property Create the children instances ans append the id and parent properties
Kind: instance method of AbstractView
Access: protected
Param | Type | Description |
---|---|---|
children | Object | The definition of the children |
options | Object | |
[options.show] | boolean | should we show the children |
[options.style] | Object | style to apply - use view style if not defined ! |
addChildren(children, [style])
Dynamically add children Merge the given style with the view style (the default), the given style being prioritary.
var MyView = View.declare("myView", {
style: {
"item1" : { x: 10, width: 100 },
"item2" : { x: 100, width: 100 }
}
});
var view = new MyView();
view.addChildren(
{
"item1": {class: View},
"item2": {class: View}
},
{
"item1": { x: 30 }
}
);
view.item1.x // 30
view.item1.width // 100
view.item2.x // 100
view.item2.width // 100
Kind: instance method of AbstractView
Param | Type | Description |
---|---|---|
children | Object | The children definition, as defined in the class declaration |
[style] | Object | style to apply - use view style if not defined ! |
removeAllChildren()
Dynamically remove all children
Kind: instance method of AbstractView
removeChild(childId)
Dynamically remove a child
Kind: instance method of AbstractView
Param | Type | Description |
---|---|---|
childId | string | The id of the child |
removeAllStates()
Dynamically remove all states Remove all transitions as well
Kind: instance method of AbstractView
removeState(stateId)
Dynamically remove a state Delete the transitions defined on the state as well
Kind: instance method of AbstractView
Param | Type | Description |
---|---|---|
stateId | string | The id of the state |
_buildTransitions()
Initialize the internal ’transitions’ property from the class definition Important : must be called after _buildStates
Kind: instance method of AbstractView
_createTransitions(transitions)
Read the transitions definition and copy it to the internal transitions object property
Kind: instance method of AbstractView
Access: protected
Param | Type | Description |
---|---|---|
transitions | Object | The definition of the transitions |
addTransitions(transitions)
Dynamically add transitions
Kind: instance method of AbstractView
Param | Type | Description |
---|---|---|
transitions | Object | The transitions definition, as defined in the class declaration |
removeAllTransitions()
Dynamically remove all transitions
Kind: instance method of AbstractView
removeTransition(stateId)
Dynamically remove a transition
Kind: instance method of AbstractView
Param | Type | Description |
---|---|---|
stateId | string | The id of the state |
_buildAnimations()
Read the animations definition and manage them
Kind: instance method of AbstractView
Access: protected
_createAnimations(animations)
Read the animations definition and copy it to the internal ‘animations’ object property
Kind: instance method of AbstractView
Access: protected
Param | Type | Description |
---|---|---|
animations | Object | The definition of the animations |
addAnimations(animations)
Dynamically add animations
Kind: instance method of AbstractView
Param | Type | Description |
---|---|---|
animations | Object | The animations definition, as defined in the class declaration |
removeAllAnimations()
Dynamically remove all animations
Kind: instance method of AbstractView
removeAnimation(animationId)
Dynamically remove an animation
Kind: instance method of AbstractView
Param | Type | Description |
---|---|---|
animationId | string | The id of the animation |
startAnimation(idAnimation, [options]) ⇒ Promise.<Array>
Starts one animation of View.
Kind: instance method of AbstractView
Returns: Promise.<Array>
- Array of animation promises
Param | Type | Description |
---|---|---|
idAnimation | string | animation id declared in properties of View. |
[options] | Object | additional options |
[options.skipAnimation] | Object | skip this animation |
addPropertyAnimation(pName, params) ⇒ Object
Add an animation on a property
Kind: instance method of AbstractView
Returns: Object
- The animation object created by the rendering loop. see: RenderingLoop#addAnimation
Param | Type | Description |
---|---|---|
pName | string | The name of the object property, or of one of it's children property ("childId.propertyName") |
params | Object | The definition of the animation |
params.bezier | Array.<number> | Array of 4 numbers containing the x1, y1, x2, y2 (in this exact order) of the cubic bezier curve |
Example
var animation = view.addPropertyAnimation("scale", {from:1, to:2, duration:500})
animation.start();
_updateAnimationRTL(pName, animation) ⇒ *
Update animation from/to to match RTL position
Kind: instance method of AbstractView
Returns: *
- animation updated
Param | Type | Description |
---|---|---|
pName | string | property name to animate |
animation | * | animation object with property updated |
removePropertyAnimation(animation) ⇒ boolean
Remove a previously created animation
Kind: instance method of AbstractView
Returns: boolean
- true if removed
Param | Type | Description |
---|---|---|
animation | Object | The animation as returned by addPropertyAnimation |
show()
Allows to show a view and its children.
Kind: instance method of AbstractView
_toJson() ⇒ *
Transform primitive into json
Kind: instance method of AbstractView
Access: protected
getNbChildrenInfo([view]) ⇒ Object
Number of Views/Primitives recursively
Kind: instance method of AbstractView
Param | Type | Default | Description |
---|---|---|---|
[view] | View | this | View to get information |
attach(options)
Attach this view in the renderer tree
Kind: instance method of AbstractView
Param | Type | Description |
---|---|---|
options | Object | some options |
[options.parent] | Object | optional parent to attach the view on |
_attach()
Attach this view in the renderer tree
Kind: instance method of AbstractView
detach()
Remove this view from the renderer tree
Kind: instance method of AbstractView
_detach()
Attach this view in the renderer tree
Kind: instance method of AbstractView
_isAttached() ⇒ boolean
Returns a boolean indicating if this View is attached in the renderer tree
Kind: instance method of AbstractView
Access: protected
_declare()
Kind: static method of AbstractView
_declareOptimize()
Kind: static method of AbstractView