AbstractView

AbstractView ⇐ Positionable

Kind: global abstract class
Extends: Positionable
Mixes: MViewStates, MFocus
Properties

NameTypeDescription
isShownboolean

flag

isInteractiveboolean

flag

isViewboolean

flag

data*

The data that are represented by the view

groupobject
willChangePropertiesArray

Properties that will change on the next frame

$$childRectChangedAbstractView | AbstractPrimitive

variable used to watch if child width/height/x/y changed DO NOT USE

AbstractView(properties, options)

A View is a component that is composed of primitives or views.

ParamTypeDescription
propertiesObject
optionsObject
options.parentObject

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

ParamType
childNameString

_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

ParamTypeDescription
parentIdstring

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

ParamTypeDescription
childrenObject

The definition of the children

optionsObject
[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

ParamTypeDescription
childrenObject

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

ParamTypeDescription
childIdstring

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

ParamTypeDescription
stateIdstring

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

ParamTypeDescription
transitionsObject

The definition of the transitions

addTransitions(transitions)

Dynamically add transitions

Kind: instance method of AbstractView

ParamTypeDescription
transitionsObject

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

ParamTypeDescription
stateIdstring

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

ParamTypeDescription
animationsObject

The definition of the animations

addAnimations(animations)

Dynamically add animations

Kind: instance method of AbstractView

ParamTypeDescription
animationsObject

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

ParamTypeDescription
animationIdstring

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

ParamTypeDescription
idAnimationstring

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

ParamTypeDescription
pNamestring

The name of the object property, or of one of it's children property ("childId.propertyName")

paramsObject

The definition of the animation

params.bezierArray.<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

ParamTypeDescription
pNamestring

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

ParamTypeDescription
animationObject

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

ParamTypeDefaultDescription
[view]Viewthis

View to get information

attach(options)

Attach this view in the renderer tree

Kind: instance method of AbstractView

ParamTypeDescription
optionsObject

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