Index: trunk/parsers/wikidom/lib/synth/models/es.ListBlockItemModel.js |
— | — | @@ -17,13 +17,20 @@ |
18 | 18 | /* Methods */ |
19 | 19 | |
20 | 20 | /** |
| 21 | + * Creates a view for this model |
| 22 | + */ |
| 23 | +es.ListBlockItemModel.prototype.createView = function() { |
| 24 | + return new es.ListBlockItemView( this ); |
| 25 | +}; |
| 26 | + |
| 27 | +/** |
21 | 28 | * Gets the length of all content. |
22 | 29 | * |
23 | 30 | * @method |
24 | 31 | * @returns {Integer} Length of all content |
25 | 32 | */ |
26 | 33 | es.ListBlockItemModel.prototype.getContentLength = function() { |
27 | | - return content.getLength(); |
| 34 | + return this.content.getLength(); |
28 | 35 | }; |
29 | 36 | |
30 | 37 | /** |
— | — | @@ -36,16 +43,6 @@ |
37 | 44 | return { 'content': this.content.getPlainObject(), 'styles': this.styles.slice( 0 ) }; |
38 | 45 | }; |
39 | 46 | |
40 | | -/** |
41 | | - * Gets a sum of cell content lengths. |
42 | | - * |
43 | | - * @method |
44 | | - * @returns {Integer} |
45 | | - */ |
46 | | -es.ListBlockItemModel.prototype.getLength = function() { |
47 | | - return this.cells.getLength(); |
48 | | -}; |
49 | | - |
50 | 47 | /* Inheritance */ |
51 | 48 | |
52 | 49 | es.extend( es.ListBlockItemModel, es.ModelContainerItem ); |
\ No newline at end of file |
Index: trunk/parsers/wikidom/lib/synth/bases/es.ModelContainerItem.js |
— | — | @@ -26,7 +26,7 @@ |
27 | 27 | * Creates a view for this model |
28 | 28 | */ |
29 | 29 | es.ModelContainerItem.prototype.createView = function() { |
30 | | - return new es.ViewContainerItem( this ); |
| 30 | + throw 'ModelContainerItem.createView not implemented in this subclass.'; |
31 | 31 | }; |
32 | 32 | |
33 | 33 | /** |
Index: trunk/parsers/wikidom/lib/synth/views/es.ListBlockItemView.js |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | * Creates an es.ParagraphBlockView object. |
4 | 4 | */ |
5 | 5 | es.ListBlockItemView = function( model ) { |
6 | | - es.BlockView.call( this, model, 'item' ); |
| 6 | + es.ViewContainerItem.call( this, model, 'listItem' ); |
7 | 7 | this.contentView = new es.ContentView( this.$, this.model.content ); |
8 | 8 | }; |
9 | 9 | |
— | — | @@ -34,4 +34,4 @@ |
35 | 35 | return this.contentView.getLineIndex( position ); |
36 | 36 | }; |
37 | 37 | |
38 | | -es.extend( es.ListBlockItemView, es.BlockView ); |
| 38 | +es.extend( es.ListBlockItemView, es.ViewContainerItem ); |
Index: trunk/parsers/wikidom/lib/synth/views/es.ListBlockView.js |
— | — | @@ -2,38 +2,39 @@ |
3 | 3 | * Creates an es.ParagraphBlockView object. |
4 | 4 | */ |
5 | 5 | es.ListBlockView = function( model ) { |
6 | | - es.ViewContainer.call( this, model, 'list' ); |
7 | | - es.ViewContainerItem.call( this, model, 'list' ); |
8 | | - this.contentView = new es.ContentView( this.$, this.model.content ); |
| 6 | + es.ViewContainer.call( this, model, 'items' ); |
| 7 | + es.BlockView.call( this, model, 'list' ); |
9 | 8 | }; |
10 | 9 | |
11 | 10 | /** |
12 | 11 | * Render content. |
13 | 12 | */ |
14 | 13 | es.ListBlockView.prototype.renderContent = function() { |
15 | | - this.contentView.render(); |
| 14 | + for ( var i = 0; i < this.views.length; i++ ) { |
| 15 | + this.views[i].renderContent(); |
| 16 | + } |
16 | 17 | }; |
17 | 18 | |
18 | 19 | /** |
19 | 20 | * Gets offset within content of position. |
20 | 21 | */ |
21 | 22 | es.ListBlockView.getContentOffset = function( position ) { |
22 | | - return this.contentView.getOffset( position ); |
| 23 | + //return this.contentView.getOffset( position ); |
23 | 24 | }; |
24 | 25 | |
25 | 26 | /** |
26 | 27 | * Gets rendered position of offset within content. |
27 | 28 | */ |
28 | 29 | es.ListBlockView.getRenderedPosition = function( offset ) { |
29 | | - return this.contentView.getPosition( position ); |
| 30 | + //return this.contentView.getPosition( position ); |
30 | 31 | }; |
31 | 32 | |
32 | 33 | /** |
33 | 34 | * Gets rendered line index of offset within content. |
34 | 35 | */ |
35 | 36 | es.ListBlockView.getRenderedLineIndex = function( offset ) { |
36 | | - return this.contentView.getLineIndex( position ); |
| 37 | + //return this.contentView.getLineIndex( position ); |
37 | 38 | }; |
38 | 39 | |
39 | 40 | es.extend( es.ListBlockView, es.ViewContainer ); |
40 | | -es.extend( es.ListBlockView, es.ViewContainerItem ); |
| 41 | +es.extend( es.ListBlockView, es.BlockView ); |