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