2012-02-06 23:50:56 +00:00
|
|
|
/**
|
|
|
|
* Creates an ve.dm.ListNode object.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @constructor
|
|
|
|
* @extends {ve.dm.BranchNode}
|
|
|
|
* @param {Object} element Document data element of this node
|
|
|
|
* @param {ve.dm.ListItemNode[]} contents List of child nodes to initially add
|
|
|
|
*/
|
|
|
|
ve.dm.ListNode = function( element, contents ) {
|
|
|
|
// Inheritance
|
|
|
|
ve.dm.BranchNode.call( this, 'list', element, contents );
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a list view for this model.
|
|
|
|
*
|
|
|
|
* @method
|
2012-03-06 22:39:43 +00:00
|
|
|
* @returns {ve.ce.ListNode}
|
2012-02-06 23:50:56 +00:00
|
|
|
*/
|
|
|
|
ve.dm.ListNode.prototype.createView = function() {
|
2012-03-06 22:39:43 +00:00
|
|
|
return new ve.ce.ListNode( this );
|
2012-02-06 23:50:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
ve.dm.DocumentNode.nodeModels.list = ve.dm.ListNode;
|
|
|
|
|
|
|
|
ve.dm.DocumentNode.nodeRules.list = {
|
|
|
|
'parents': null,
|
|
|
|
'children': ['listItem']
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
ve.extendClass( ve.dm.ListNode, ve.dm.BranchNode );
|