AbstractNativeRailElement


title: AbstractNativeRailElement


title: itemChooser


title: direction

Classes

AbstractNativeRailElementAbstractNativeElement
AbstractNativeRailElement

Members

itemChooser
direction

AbstractNativeRailElement ⇐ AbstractNativeElement

Kind: global abstract class
Extends: AbstractNativeElement

AbstractNativeRailElement()

Rail view that will use native component of the engine

Example

$AbstractNativeRailElement.declare("MyNativeRailElement", {
  itemChooser: {
   key: "ratio",
   default: "DefaultTile",
   items : [
     {
       keyValue: "16:9"
       item: "LandscapeItem"
     },
     {
       keyValue: "4:3"
       item: "PortraitItem"
     }
   ]
  },
  direction: $RailDirection.VERTICAL
});

AbstractNativeRailElement(properties)

Create clean empty or predefined fields inside this rail element at startup.

ParamTypeDescription
propertiesObject

Object holding defined parameters such as direction or itemChooser.

_defineSettings()

Kind: instance method of AbstractNativeRailElement

getIndex() ⇒ Promise.<number>

Get the index of the current focused item

Kind: instance method of AbstractNativeRailElement
Returns: Promise.<number> - index of the current “focused” item

getItem(index) ⇒ Promise.<Object>

Get the item data at the given index

Kind: instance method of AbstractNativeRailElement
Returns: Promise.<Object> - An object that matches the item data at the asked index

ParamTypeDescription
indexnumber

index of the element you want to retrieve

setData(datas, index, chooser) ⇒ Promise

Set all datas to the rail.

Kind: instance method of AbstractNativeRailElement

ParamTypeDescription
datasArray.<Object>

List of data to be used for the rail

indexNumber

Index of the focused item. Default is 0

chooserItemChooser

ItemChooser can be passed here to change it

scrollTo(index) ⇒ Promise.<Boolean>

Scroll to the item at the requested index.

Kind: instance method of AbstractNativeRailElement
Returns: Promise.<Boolean> - True if the item has been scrolledTo, false else (out of bound). If the item is already scrolled to, return false

ParamTypeDescription
indexNumber

The index of the item you want to scroll to

_getIndex() ⇒ Promise.<number>

Get the index of the current focused item

Kind: instance method of AbstractNativeRailElement
Returns: Promise.<number> - index of the current “focused” item
Access: protected

_setData(datas, index, chooser) ⇒ Promise

Set all datas to the rail.

Kind: instance method of AbstractNativeRailElement
Access: protected

ParamTypeDescription
datasArray.<Object>

List of data to be used for the rail

indexNumber

Index of the focused item. Default is 0

chooserItemChooser

ItemChooser can be passed here to change it

_scrollTo(index) ⇒ Promise.<Boolean>

Scroll to the item at the requested index.

Kind: instance method of AbstractNativeRailElement
Returns: Promise.<Boolean> - True if the item has been scrolledTo, false else (out of bound). If the item is already scrolled to, return false
Access: protected

ParamTypeDescription
indexNumber

The index of the item you want to scroll to

onScroll(index, data)

Triggered each time an item has been focused.

Kind: instance method of AbstractNativeRailElement

ParamTypeDescription
indexNumber

Reached index

dataObject

The data at the given index

_onScroll(index) ⇒ Promise

Connect to native trigger each time an item has been focused.

Kind: instance method of AbstractNativeRailElement

ParamTypeDescription
indexNumber

Reached index

onItemClicked(index, data)

Triggered each time an item has been clicked on.

Kind: instance method of AbstractNativeRailElement

ParamTypeDescription
indexNumber

Reached index

dataObject

The data at the given index

_onItemClicked(index) ⇒ Promise

Connect to native trigger each time an item has been clicked on.

Kind: instance method of AbstractNativeRailElement

ParamTypeDescription
indexNumber

Reached index

ItemChooser : Object

Define the chooser that will be needed to choose an item depending of the value of a specified key in data

Kind: inner typedef of AbstractNativeRailElement
Properties

NameTypeDescription
keystring

Indicates the key id that will be used on data to choose the item.

defaultstring

Indicates the default item to be use if

  • items are not defined
  • there is no matching value in items
itemsArray.<Item>

Indicates all the possible items.

Example

{
 key: "ratio",
 default: "DefaultTile",
 items : [
   {
     keyValue: "16:9"
     item: "LandscapeItem"
   },
   {
     keyValue: "4:3"
     item: "PortraitItem"
   }
 ]
}

Item : Object

Definition of an Item for the chooser.

Kind: inner typedef of AbstractNativeRailElement
Properties

NameTypeDescription
keyValuestring

Indicates value of the key of the chooser that needs to match with.

itemstring

Indicates the name of the item in native rail.

AbstractNativeRailElement

Kind: global class

AbstractNativeRailElement()

Rail view that will use native component of the engine

Example

$AbstractNativeRailElement.declare("MyNativeRailElement", {
  itemChooser: {
   key: "ratio",
   default: "DefaultTile",
   items : [
     {
       keyValue: "16:9"
       item: "LandscapeItem"
     },
     {
       keyValue: "4:3"
       item: "PortraitItem"
     }
   ]
  },
  direction: $RailDirection.VERTICAL
});

AbstractNativeRailElement(properties)

Create clean empty or predefined fields inside this rail element at startup.

ParamTypeDescription
propertiesObject

Object holding defined parameters such as direction or itemChooser.

_defineSettings()

Kind: instance method of AbstractNativeRailElement

getIndex() ⇒ Promise.<number>

Get the index of the current focused item

Kind: instance method of AbstractNativeRailElement
Returns: Promise.<number> - index of the current “focused” item

getItem(index) ⇒ Promise.<Object>

Get the item data at the given index

Kind: instance method of AbstractNativeRailElement
Returns: Promise.<Object> - An object that matches the item data at the asked index

ParamTypeDescription
indexnumber

index of the element you want to retrieve

setData(datas, index, chooser) ⇒ Promise

Set all datas to the rail.

Kind: instance method of AbstractNativeRailElement

ParamTypeDescription
datasArray.<Object>

List of data to be used for the rail

indexNumber

Index of the focused item. Default is 0

chooserItemChooser

ItemChooser can be passed here to change it

scrollTo(index) ⇒ Promise.<Boolean>

Scroll to the item at the requested index.

Kind: instance method of AbstractNativeRailElement
Returns: Promise.<Boolean> - True if the item has been scrolledTo, false else (out of bound). If the item is already scrolled to, return false

ParamTypeDescription
indexNumber

The index of the item you want to scroll to

_getIndex() ⇒ Promise.<number>

Get the index of the current focused item

Kind: instance method of AbstractNativeRailElement
Returns: Promise.<number> - index of the current “focused” item
Access: protected

_setData(datas, index, chooser) ⇒ Promise

Set all datas to the rail.

Kind: instance method of AbstractNativeRailElement
Access: protected

ParamTypeDescription
datasArray.<Object>

List of data to be used for the rail

indexNumber

Index of the focused item. Default is 0

chooserItemChooser

ItemChooser can be passed here to change it

_scrollTo(index) ⇒ Promise.<Boolean>

Scroll to the item at the requested index.

Kind: instance method of AbstractNativeRailElement
Returns: Promise.<Boolean> - True if the item has been scrolledTo, false else (out of bound). If the item is already scrolled to, return false
Access: protected

ParamTypeDescription
indexNumber

The index of the item you want to scroll to

onScroll(index, data)

Triggered each time an item has been focused.

Kind: instance method of AbstractNativeRailElement

ParamTypeDescription
indexNumber

Reached index

dataObject

The data at the given index

_onScroll(index) ⇒ Promise

Connect to native trigger each time an item has been focused.

Kind: instance method of AbstractNativeRailElement

ParamTypeDescription
indexNumber

Reached index

onItemClicked(index, data)

Triggered each time an item has been clicked on.

Kind: instance method of AbstractNativeRailElement

ParamTypeDescription
indexNumber

Reached index

dataObject

The data at the given index

_onItemClicked(index) ⇒ Promise

Connect to native trigger each time an item has been clicked on.

Kind: instance method of AbstractNativeRailElement

ParamTypeDescription
indexNumber

Reached index

ItemChooser : Object

Define the chooser that will be needed to choose an item depending of the value of a specified key in data

Kind: inner typedef of AbstractNativeRailElement
Properties

NameTypeDescription
keystring

Indicates the key id that will be used on data to choose the item.

defaultstring

Indicates the default item to be use if

  • items are not defined
  • there is no matching value in items
itemsArray.<Item>

Indicates all the possible items.

Example

{
 key: "ratio",
 default: "DefaultTile",
 items : [
   {
     keyValue: "16:9"
     item: "LandscapeItem"
   },
   {
     keyValue: "4:3"
     item: "PortraitItem"
   }
 ]
}

Item : Object

Definition of an Item for the chooser.

Kind: inner typedef of AbstractNativeRailElement
Properties

NameTypeDescription
keyValuestring

Indicates value of the key of the chooser that needs to match with.

itemstring

Indicates the name of the item in native rail.

itemChooser

Kind: global variable
Properties

NameTypeDescription
itemChooserItemChooser

Chooser to be used for the rail construction. (Could not be used at the same time as item)

direction

Kind: global variable
Properties

NameTypeDescription
directionRailDirection

Should equal $RailDirection.VERTICAL or $RailDirection.HORIZONTAL. (Can't be modified after creation)