mono.DataBox Class
数据容器是用于管理数据对象的。它是一种不可见的对象,在MVC框架中处于M(模型)层,它是所有视图的数据提供者 数据容器可以管理数据对象的增减事件变化,也可以监听到数据的属性事件变化。 数据容器上包含着选择容器,用于管理所有选中的数据
Constructor
Item Index
Methods
- add
- addByDescendant
- addDataBoxChangeListener
- addDataPropertyChangeListener
- clear
- clearEditing
- clearSelection
- contains
- containsById
- endBatch
- forEach
- forEachByBreadthFirst
- forEachByDepthFirst
- forEachReverse
- getAlarmBox
- getBillboards
- getDataAt
- getDataById
- getDatas
- getLights
- getLightsArray
- getLimit
- getName!~YUIDOC_LINE~!return 数据容器的名字
- getNodes
- getRoots
- getSelectionModel
- getSiblingIndex
- getSiblings
- isEmpty
- remove
- removeById
- removeDataBoxChangeListener
- removeDataPropertyChangeListener
- removeFirst
- removeSelection
- setLimit
- size
- size
- startBatch
- toDatas
Methods
addDataBoxChangeListener
-
listener
-
scope
-
ahead
添加数据容器的数据增减变化的监听器。当数据容器中的数据发生改变时(增加,删除,清空),就可以通过此方法监听
Parameters:
-
listener
Function网元更改事件的监听器
-
scope
Object监听器的作用域,为空时指的是window
-
ahead
Boolean是否添加在最前方,如果为空,则添加在最后一个位置
addDataPropertyChangeListener
-
listener
-
scope
-
ahead
添加数据容器中数据的属性更改事件的监听器。当数据容器中的数据属性发生变化时,比如网元位置,网元名称等,都可以通过此方法来监听
Parameters:
-
listener
Function网元属性更改事件的监听器
-
scope
Object监听器的作用域,为空时指的是window
-
ahead
Object是否添加在最前方,如果为空,则添加在最后一个位置
clear
()
清空数据容器中所有的数据
clearEditing
()
取消编辑
clearSelection
()
取消选中
containsById
-
id
通过数据ID判断是否包含某个数据
Parameters:
-
id
Object数据的ID编号、
Returns:
true为包含,false不包含
endBatch
()
结束批处理
forEach
-
f
-
scope
遍历数据容器中的所有数据
Parameters:
-
f
Function回调函数
-
scope
Object回调函数的作用域,为空时指的是window
forEachByBreadthFirst
-
callbackFunction
-
data
-
scope
广度优先遍历数据容器中指定数据的所有子孙数据。如果指定数据为空时,就会遍历数据容器中的所有数据
Parameters:
-
callbackFunction
Function回调函数
-
data
mono.Data数据对象
-
scope
Object回调函数的作用域,为空时指的是window
forEachByDepthFirst
-
callbackFunction
-
data
-
scope
深度优先遍历数据容器中指定数据的所有子孙数据。如果指定数据为空时,就会遍历数据容器中的所有数据
Parameters:
-
callbackFunction
Function回调函数
-
data
mono.Data遍历的数据对象,为空时会遍历数据容器中的所有数据
-
scope
Object回调函数的作用域,为空时指的是window
forEachReverse
-
f
-
scope
反序遍历数据容器中所有数据
Parameters:
-
f
Function回调函数
-
scope
Object回调函数的作用域,为空时指的是window
getAlarmBox
()
mono.AlarmBox
获取网元容器中的告警容器
Returns:
告警容器
getBillboards
()
mono.List
获取数据容器中的所有Billboard对象
Returns:
getDataAt
-
index
获取数据容器中某个序号上的数据
Parameters:
-
index
Object数据的序号
Returns:
数据对象
getDataById
-
id
根据数据的ID编号获取对应的数据
Parameters:
-
id
Object数据的ID编号
Returns:
数据对象
getDatas
()
mono.List
获取数据容器中的所有数据
Returns:
getLights
()
mono.List
获取数据容器中所有的光源
Returns:
数据容器中的光源
getLightsArray
()
Array
获取数据容器中所有的光源
Returns:
数据容器中的光源
getLimit
()
Number
获取数据容器的上限数。默认为-1,是没有上限的,一旦设置了上限数,当添加的数据数量大于这个上限数时,mono就会删除最旧的数据
Returns:
数据容器的上限数
getName!~YUIDOC_LINE~!return 数据容器的名字
()
返回数据容器的名字
getNodes
()
mono.List
获取数据容器中的所有节点对象
Returns:
getRoots
()
mono.List
获取数据容器中所有根下的数据。根下的数据指的是没有父亲的数据
Returns:
所有根下数据的集合
getSelectionModel
()
mono.SelectionModel
获取数据容器中的选择容器,选择容器用于存放所有选中的数据对象,更详细的解释请参看SelectionModel类
Returns:
选中数据的容器
getSiblings
-
data
获取指定数据的所有兄弟数据
Parameters:
-
data
mono.Data指定的数据对象
Returns:
所有兄弟数据的集合
isEmpty
()
Boolean
判断数据容器是否为空。当数据容器中没有数据时返回true,否则返回false
Returns:
当数据容器中没有数据时返回true,否则返回false
removeById
-
id
通过数据的ID编号从数据容器中删除该数据
Parameters:
-
id
Object数据对象的编号
removeDataBoxChangeListener
-
listener
-
scope
移除数据容器的数据增减变化的监听器
Parameters:
-
listener
Function网元更改事件监听器
-
scope
Object监听器的作用域,为空时指的是window
removeDataPropertyChangeListener
-
listener
-
scope
移除数据容器中数据的属性更改事件的监听器
Parameters:
-
listener
Function网元属性更改事件的监听器
-
scope
Object监听器的作用域,为空时指的是window
removeFirst
-
count
从数据容器中删除第一个数据
Parameters:
-
count
Number数据容器的大小
removeSelection
()
删除所有选中的数据
setLimit
-
limit
设置数据容器的上限数。默认为-1,是没有显示的,一旦设置了上限数,当添加的数据数量大于这个上限数时,mono就会删除最旧的数据
Parameters:
-
limit
Number
size
()
Number
数据容器的大小,也就是容器中数据的数量
Returns:
数据容器的大小
size
()
Number
数据容器的大小,也就是容器中数据的数量
Returns:
数据容器的大小
startBatch
()
开始批处理
toDatas
-
matchFunction
-
scope
将数据容器中的数据转成集合
Parameters:
-
matchFunction
Object转换成List集合时回调函数
-
scope
Object回调函数的作用域,为空时指的是window
Returns:
数据集合