Index: trunk/parsers/wikidom/lib/synth/models/es.DocumentModel.js |
— | — | @@ -3,14 +3,14 @@ |
4 | 4 | * |
5 | 5 | * @class |
6 | 6 | * @constructor |
7 | | - * @param blocks {Array} |
| 7 | + * @param items {Array} |
8 | 8 | * @param attributes {Object} |
9 | | - * @property blocks {Array} |
| 9 | + * @property items {Array} |
10 | 10 | * @property attributes {Object} |
11 | 11 | */ |
12 | 12 | es.DocumentModel = function( blocks, attributes ) { |
13 | | - es.ModelContainer.call( this, 'blocks' ); |
14 | | - this.blocks = new es.AggregateArray( blocks || [] ); |
| 13 | + es.ModelContainer.call( this ); |
| 14 | + this.items = new es.AggregateArray( blocks || [] ); |
15 | 15 | this.attributes = attributes || {}; |
16 | 16 | }; |
17 | 17 | |
— | — | @@ -39,10 +39,10 @@ |
40 | 40 | |
41 | 41 | es.DocumentModel.prototype.getPlainObject = function() { |
42 | 42 | var obj = {}; |
43 | | - if ( this.blocks.length ) { |
| 43 | + if ( this.items.length ) { |
44 | 44 | obj.blocks = []; |
45 | | - for ( var i = 0; i < this.blocks.length; i++ ) { |
46 | | - obj.blocks.push( this.blocks[i].getPlainObject() ); |
| 45 | + for ( var i = 0; i < this.items.length; i++ ) { |
| 46 | + obj.blocks.push( this.items[i].getPlainObject() ); |
47 | 47 | } |
48 | 48 | } |
49 | 49 | if ( !$.isEmptyObject( this.attributes ) ) { |
— | — | @@ -57,7 +57,7 @@ |
58 | 58 | * @returns {Integer} |
59 | 59 | */ |
60 | 60 | es.DocumentModel.prototype.getContentLength = function() { |
61 | | - return this.blocks.getContentLength(); |
| 61 | + return this.items.getContentLength(); |
62 | 62 | }; |
63 | 63 | |
64 | 64 | es.extend( es.DocumentModel, es.ModelContainer ); |
Index: trunk/parsers/wikidom/lib/synth/models/es.TableBlockCellModel.js |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | * @property attributes {Object} |
11 | 11 | */ |
12 | 12 | es.TableBlockCellModel = function( documentModel, attributes ) { |
13 | | - es.ModelContainerItem.call( this, 'row' ); |
| 13 | + es.ModelContainerItem.call( this ); |
14 | 14 | this.documentModel = documentModel || null; |
15 | 15 | this.attributes = attributes || {}; |
16 | 16 | }; |
Index: trunk/parsers/wikidom/lib/synth/models/es.ListBlockItemModel.js |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | * @property styles {Array} |
11 | 11 | */ |
12 | 12 | es.ListBlockItemModel = function( content, styles ) { |
13 | | - es.ModelContainerItem.call( this, 'list' ); |
| 13 | + es.ModelContainerItem.call( this ); |
14 | 14 | this.content = content || null; |
15 | 15 | this.styles = styles || ['bullet']; |
16 | 16 | }; |
Index: trunk/parsers/wikidom/lib/synth/models/es.TableBlockRowModel.js |
— | — | @@ -3,18 +3,18 @@ |
4 | 4 | * |
5 | 5 | * @class |
6 | 6 | * @constructor |
7 | | - * @param cells {Array} |
| 7 | + * @param items {Array} |
8 | 8 | * @param attributes {Object} |
9 | | - * @property cells {Array} |
| 9 | + * @property items {Array} |
10 | 10 | * @property attributes {Object} |
11 | 11 | */ |
12 | | -es.TableBlockRowModel = function( cells, attributes ) { |
13 | | - es.ModelContainerItem.call( this, 'table' ); |
| 12 | +es.TableBlockRowModel = function( items, attributes ) { |
| 13 | + es.ModelContainerItem.call( this ); |
14 | 14 | es.ModelContainer.call( this ); |
15 | 15 | |
16 | | - if ( $.isArray( cells ) ) { |
17 | | - for ( var i = 0; i < cells.length; i++ ) { |
18 | | - this.append( cells[i] ); |
| 16 | + if ( $.isArray( items ) ) { |
| 17 | + for ( var i = 0; i < items.length; i++ ) { |
| 18 | + this.append( items[i] ); |
19 | 19 | } |
20 | 20 | } |
21 | 21 | |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | * @returns {Integer} Length of all content |
58 | 58 | */ |
59 | 59 | es.TableBlockRowModel.prototype.getContentLength = function() { |
60 | | - return this.cells.getContentLength(); |
| 60 | + return this.items.getContentLength(); |
61 | 61 | }; |
62 | 62 | |
63 | 63 | /** |
— | — | @@ -68,9 +68,9 @@ |
69 | 69 | es.TableBlockRowModel.prototype.getPlainObject = function() { |
70 | 70 | /* |
71 | 71 | var obj = {}; |
72 | | - if ( this.cells.length ) { |
73 | | - obj.cells = $.map( this.cells, function( cell ) { |
74 | | - return cell.getPlainObject(); |
| 72 | + if ( this.items.length ) { |
| 73 | + obj.cells = $.map( this.items, function( item ) { |
| 74 | + return item.getPlainObject(); |
75 | 75 | } ); |
76 | 76 | } |
77 | 77 | if ( !$.isEmptyObject( this.attributes ) ) { |
— | — | @@ -83,4 +83,4 @@ |
84 | 84 | /* Inheritance */ |
85 | 85 | |
86 | 86 | es.extend( es.TableBlockRowModel, es.ModelContainerItem ); |
87 | | -es.extend( es.TableBlockRowModel, es.ModelContainer ); |
\ No newline at end of file |
| 87 | +es.extend( es.TableBlockRowModel, es.ModelContainer ); |
Index: trunk/parsers/wikidom/lib/synth/bases/es.ModelContainerItem.js |
— | — | @@ -4,22 +4,17 @@ |
5 | 5 | * @class |
6 | 6 | * @constructor |
7 | 7 | * @extends {es.EventEmitter} |
8 | | - * @param containerName {String} Name of container type |
9 | | - * @property [containerName] {Object} Reference to container, if attached |
| 8 | + * @property container {Object} Reference to container, if attached |
10 | 9 | */ |
11 | | -es.ModelContainerItem = function( containerName ) { |
| 10 | +es.ModelContainerItem = function() { |
12 | 11 | es.EventEmitter.call( this ); |
13 | | - if ( typeof containerName !== 'string' ) { |
14 | | - containerName = 'container'; |
15 | | - } |
16 | | - this._containerName = containerName; |
17 | | - this[this._containerName] = null; |
| 12 | + this.container = null; |
18 | 13 | }; |
19 | 14 | |
20 | 15 | /* Methods */ |
21 | 16 | |
22 | 17 | es.ModelContainerItem.prototype.parent = function() { |
23 | | - return this[this._containerName]; |
| 18 | + return this.container; |
24 | 19 | }; |
25 | 20 | |
26 | 21 | /** |
— | — | @@ -37,7 +32,7 @@ |
38 | 33 | * @emits "attach" with container argument |
39 | 34 | */ |
40 | 35 | es.ModelContainerItem.prototype.attach = function( container ) { |
41 | | - this[this._containerName] = container; |
| 36 | + this.container = container; |
42 | 37 | this.emit( 'attach', container ); |
43 | 38 | }; |
44 | 39 | |
— | — | @@ -48,8 +43,8 @@ |
49 | 44 | * @emits "detach" with container argument |
50 | 45 | */ |
51 | 46 | es.ModelContainerItem.prototype.detach = function() { |
52 | | - var container = this[this._containerName]; |
53 | | - this[this._containerName] = null; |
| 47 | + var container = this.container; |
| 48 | + this.container = null; |
54 | 49 | this.emit( 'detach', container ); |
55 | 50 | }; |
56 | 51 | |
— | — | @@ -63,7 +58,7 @@ |
64 | 59 | */ |
65 | 60 | es.ModelContainerItem.prototype.getIndex = function() { |
66 | 61 | try { |
67 | | - var index = this[this._containerName].indexOf( this ); |
| 62 | + var index = this.container.indexOf( this ); |
68 | 63 | if ( index === -1 ) { |
69 | 64 | throw 'Unknown item error. Can not get index of item that is not in a container. ' + e; |
70 | 65 | } |
— | — | @@ -82,7 +77,7 @@ |
83 | 78 | */ |
84 | 79 | es.ModelContainerItem.prototype.previous = function() { |
85 | 80 | try { |
86 | | - return this[this._containerName].get( this[this._containerName].indexOf( this ) - 1 ); |
| 81 | + return this.container.get( this.container.indexOf( this ) - 1 ); |
87 | 82 | } catch ( e ) { |
88 | 83 | throw 'Missing container error. Can not get previous item in missing container. ' + e; |
89 | 84 | } |
— | — | @@ -97,7 +92,7 @@ |
98 | 93 | */ |
99 | 94 | es.ModelContainerItem.prototype.next = function() { |
100 | 95 | try { |
101 | | - return this[this._containerName].get( this[this._containerName].indexOf( this ) + 1 ); |
| 96 | + return this.container.get( this.container.indexOf( this ) + 1 ); |
102 | 97 | } catch ( e ) { |
103 | 98 | throw 'Missing container error. Can not get next item in missing container. ' + e; |
104 | 99 | } |
— | — | @@ -112,7 +107,7 @@ |
113 | 108 | */ |
114 | 109 | es.ModelContainerItem.prototype.isFirst = function() { |
115 | 110 | try { |
116 | | - return this[this._containerName].indexOf( this ) === 0; |
| 111 | + return this.container.indexOf( this ) === 0; |
117 | 112 | } catch ( e ) { |
118 | 113 | throw 'Missing container error. Can not get index of item in missing container. ' + e; |
119 | 114 | } |
— | — | @@ -127,8 +122,7 @@ |
128 | 123 | */ |
129 | 124 | es.ModelContainerItem.prototype.isLast = function() { |
130 | 125 | try { |
131 | | - return this[this._containerName].indexOf( this ) |
132 | | - === this[this._containerName].getLength() - 1; |
| 126 | + return this.container.indexOf( this ) === this.container.getLength() - 1; |
133 | 127 | } catch ( e ) { |
134 | 128 | throw 'Missing container error. Can not get index of item in missing container. ' + e; |
135 | 129 | } |
Index: trunk/parsers/wikidom/lib/synth/bases/es.ModelContainer.js |
— | — | @@ -6,16 +6,11 @@ |
7 | 7 | * @class |
8 | 8 | * @constructor |
9 | 9 | * @extends {es.EventEmitter} |
10 | | - * @param listName {String} Property name for list of items |
11 | | - * @property [listName] {Array} list of items |
| 10 | + * @property items {Array} list of items |
12 | 11 | */ |
13 | | -es.ModelContainer = function( listName ) { |
| 12 | +es.ModelContainer = function() { |
14 | 13 | es.EventEmitter.call( this ); |
15 | | - if ( typeof listName !== 'string' ) { |
16 | | - listName = 'items'; |
17 | | - } |
18 | | - this._listName = listName; |
19 | | - this[this._listName] = new es.AggregateArray(); |
| 14 | + this.items = new es.AggregateArray(); |
20 | 15 | var container = this; |
21 | 16 | this.relayUpdate = function() { |
22 | 17 | container.emit( 'update' ); |
— | — | @@ -31,7 +26,7 @@ |
32 | 27 | * @returns {Object} Child object at index |
33 | 28 | */ |
34 | 29 | es.ModelContainer.prototype.get = function( index ) { |
35 | | - return this[this._listName][index] || null; |
| 30 | + return this.items[index] || null; |
36 | 31 | }; |
37 | 32 | |
38 | 33 | /** |
— | — | @@ -41,7 +36,7 @@ |
42 | 37 | * @returns {Array} List of all items. |
43 | 38 | */ |
44 | 39 | es.ModelContainer.prototype.all = function() { |
45 | | - return this[this._listName]; |
| 40 | + return this.items; |
46 | 41 | }; |
47 | 42 | |
48 | 43 | /** |
— | — | @@ -51,7 +46,7 @@ |
52 | 47 | * @returns {Integer} Number of items in container |
53 | 48 | */ |
54 | 49 | es.ModelContainer.prototype.getLength = function() { |
55 | | - return this[this._listName].length |
| 50 | + return this.items.length |
56 | 51 | }; |
57 | 52 | |
58 | 53 | /** |
— | — | @@ -61,7 +56,7 @@ |
62 | 57 | * @returns {Integer} Index of item, -1 if item is not in container |
63 | 58 | */ |
64 | 59 | es.ModelContainer.prototype.indexOf = function( item ) { |
65 | | - return this[this._listName].indexOf( item ); |
| 60 | + return this.items.indexOf( item ); |
66 | 61 | }; |
67 | 62 | |
68 | 63 | /** |
— | — | @@ -71,7 +66,7 @@ |
72 | 67 | * @returns {Object} First item |
73 | 68 | */ |
74 | 69 | es.ModelContainer.prototype.first = function() { |
75 | | - return this[this._listName].length ? this[this._listName][0] : null; |
| 70 | + return this.items.length ? this.items[0] : null; |
76 | 71 | }; |
77 | 72 | |
78 | 73 | /** |
— | — | @@ -81,8 +76,8 @@ |
82 | 77 | * @returns {Object} Last item |
83 | 78 | */ |
84 | 79 | es.ModelContainer.prototype.last = function() { |
85 | | - return this[this._listName].length |
86 | | - ? this[this._listName][this[this._listName].length - 1] : null; |
| 80 | + return this.items.length |
| 81 | + ? this.items[this.items.length - 1] : null; |
87 | 82 | }; |
88 | 83 | |
89 | 84 | /** |
— | — | @@ -94,8 +89,8 @@ |
95 | 90 | * @param callback {Function} Function to call on each item which takes item and index arguments |
96 | 91 | */ |
97 | 92 | es.ModelContainer.prototype.each = function( callback ) { |
98 | | - for ( var i = 0; i < this[this._listName].length; i++ ) { |
99 | | - if ( callback( this[this._listName][i], i ) === false ) { |
| 93 | + for ( var i = 0; i < this.items.length; i++ ) { |
| 94 | + if ( callback( this.items[i], i ) === false ) { |
100 | 95 | break; |
101 | 96 | } |
102 | 97 | } |
— | — | @@ -113,11 +108,11 @@ |
114 | 109 | es.ModelContainer.prototype.append = function( item ) { |
115 | 110 | var parent = item.parent(); |
116 | 111 | if ( parent === this ) { |
117 | | - this[this._listName].splice( this.indexOf( item ), 1 ); |
| 112 | + this.items.splice( this.indexOf( item ), 1 ); |
118 | 113 | } else if ( parent ) { |
119 | 114 | parent.remove( item ); |
120 | 115 | } |
121 | | - this[this._listName].push( item ); |
| 116 | + this.items.push( item ); |
122 | 117 | item.on( 'update', this.relayUpdate ); |
123 | 118 | item.attach( this ); |
124 | 119 | this.emit( 'append', item ); |
— | — | @@ -136,11 +131,11 @@ |
137 | 132 | es.ModelContainer.prototype.prepend = function( item ) { |
138 | 133 | var parent = item.parent(); |
139 | 134 | if ( parent === this ) { |
140 | | - this[this._listName].splice( this.indexOf( item ), 1 ); |
| 135 | + this.items.splice( this.indexOf( item ), 1 ); |
141 | 136 | } else if ( parent ) { |
142 | 137 | parent.remove( item ); |
143 | 138 | } |
144 | | - this[this._listName].unshift( item ); |
| 139 | + this.items.unshift( item ); |
145 | 140 | item.on( 'update', this.relayUpdate ); |
146 | 141 | item.attach( this ); |
147 | 142 | this.emit( 'prepend', item ); |
— | — | @@ -160,14 +155,14 @@ |
161 | 156 | es.ModelContainer.prototype.insertBefore = function( item, before ) { |
162 | 157 | var parent = item.parent(); |
163 | 158 | if ( parent === this ) { |
164 | | - this[this._listName].splice( this.indexOf( item ), 1 ); |
| 159 | + this.items.splice( this.indexOf( item ), 1 ); |
165 | 160 | } else if ( parent ) { |
166 | 161 | parent.remove( item ); |
167 | 162 | } |
168 | 163 | if ( before ) { |
169 | | - this[this._listName].splice( this[this._listName].indexOf( before ), 0, item ); |
| 164 | + this.items.splice( this.items.indexOf( before ), 0, item ); |
170 | 165 | } else { |
171 | | - this[this._listName].unshift( item ); |
| 166 | + this.items.unshift( item ); |
172 | 167 | } |
173 | 168 | item.on( 'update', this.relayUpdate ); |
174 | 169 | item.attach( this ); |
— | — | @@ -188,14 +183,14 @@ |
189 | 184 | es.ModelContainer.prototype.insertAfter = function( item, after ) { |
190 | 185 | var parent = item.parent(); |
191 | 186 | if ( parent === this ) { |
192 | | - this[this._listName].splice( this.indexOf( item ), 1 ); |
| 187 | + this.items.splice( this.indexOf( item ), 1 ); |
193 | 188 | } else if ( parent ) { |
194 | 189 | parent.remove( item ); |
195 | 190 | } |
196 | 191 | if ( after ) { |
197 | | - this[this._listName].splice( this[this._listName].indexOf( after ) + 1, 0, item ); |
| 192 | + this.items.splice( this.items.indexOf( after ) + 1, 0, item ); |
198 | 193 | } else { |
199 | | - this[this._listName].push( item ); |
| 194 | + this.items.push( item ); |
200 | 195 | } |
201 | 196 | item.on( 'update', this.relayUpdate ); |
202 | 197 | item.attach( this ); |
— | — | @@ -214,7 +209,7 @@ |
215 | 210 | */ |
216 | 211 | es.ModelContainer.prototype.remove = function( item ) { |
217 | 212 | item.removeListener( 'update', this.relayUpdate ); |
218 | | - this[this._listName].splice( this.indexOf( item ), 1 ); |
| 213 | + this.items.splice( this.indexOf( item ), 1 ); |
219 | 214 | item.detach(); |
220 | 215 | this.emit( 'remove', item ); |
221 | 216 | this.emit( 'update' ); |
Index: trunk/parsers/wikidom/lib/synth/bases/es.ViewContainer.js |
— | — | @@ -7,19 +7,19 @@ |
8 | 8 | * @class |
9 | 9 | * @constructor |
10 | 10 | * @extends {es.EventEmitter} |
11 | | - * @param containerModel {es.ModelContainer} Property name for list of items |
| 11 | + * @param model {es.ModelContainer} Model to follow |
12 | 12 | * @param typeName {String} Name to use in CSS classes and HTML element data |
13 | 13 | * @param tagName {String} HTML element name to use (optional, default: "div") |
14 | 14 | * @property $ {jQuery} Container element |
15 | | - * @property views {Array} List of views, correlating to models in the model container |
| 15 | + * @property items {Array} List of views, correlating to models in the model container |
16 | 16 | */ |
17 | | -es.ViewContainer = function( containerModel, typeName, tagName ) { |
| 17 | +es.ViewContainer = function( model, typeName, tagName ) { |
18 | 18 | es.EventEmitter.call( this ); |
19 | | - this.containerModel = containerModel; |
20 | | - if ( !this.containerModel ) { |
| 19 | + this.model = model; |
| 20 | + if ( !this.model ) { |
21 | 21 | return; |
22 | 22 | } |
23 | | - this.views = new es.AggregateArray(); |
| 23 | + this.items = new es.AggregateArray(); |
24 | 24 | if ( typeof typeName !== 'string' ) { |
25 | 25 | typeName = 'viewContainer'; |
26 | 26 | } |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | } |
47 | 47 | return itemView; |
48 | 48 | } |
49 | | - this.containerModel.on( 'prepend', function( itemModel ) { |
| 49 | + this.model.on( 'prepend', function( itemModel ) { |
50 | 50 | var itemView = recycleItemView( itemModel, true ); |
51 | 51 | itemView.on( 'update', container.relayUpdate ); |
52 | 52 | container.views.unshift( itemView ); |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | container.emit( 'prepend', itemView ); |
55 | 55 | container.emit( 'update' ); |
56 | 56 | } ); |
57 | | - this.containerModel.on( 'append', function( itemModel ) { |
| 57 | + this.model.on( 'append', function( itemModel ) { |
58 | 58 | var itemView = recycleItemView( itemModel, true ); |
59 | 59 | itemView.on( 'update', container.relayUpdate ); |
60 | 60 | container.views.push( itemView ); |
— | — | @@ -61,7 +61,7 @@ |
62 | 62 | container.emit( 'append', itemView ); |
63 | 63 | container.emit( 'update' ); |
64 | 64 | } ); |
65 | | - this.containerModel.on( 'insertBefore', function( itemModel, beforeModel ) { |
| 65 | + this.model.on( 'insertBefore', function( itemModel, beforeModel ) { |
66 | 66 | var beforeView = container.lookupItemView( beforeModel ), |
67 | 67 | itemView = recycleItemView( itemModel, true ); |
68 | 68 | itemView.on( 'update', container.relayUpdate ); |
— | — | @@ -75,7 +75,7 @@ |
76 | 76 | container.emit( 'insertBefore', itemView, beforeView ); |
77 | 77 | container.emit( 'update' ); |
78 | 78 | } ); |
79 | | - this.containerModel.on( 'insertAfter', function( itemModel, afterModel ) { |
| 79 | + this.model.on( 'insertAfter', function( itemModel, afterModel ) { |
80 | 80 | var afterView = container.lookupItemView( afterModel ), |
81 | 81 | itemView = recycleItemView( itemModel, true ); |
82 | 82 | itemView.on( 'update', container.relayUpdate ); |
— | — | @@ -89,26 +89,26 @@ |
90 | 90 | container.emit( 'insertAfter', itemView, afterView ); |
91 | 91 | container.emit( 'update' ); |
92 | 92 | } ); |
93 | | - this.containerModel.on( 'remove', function( itemModel ) { |
| 93 | + this.model.on( 'remove', function( itemModel ) { |
94 | 94 | var itemView = recycleItemView( itemModel ); |
95 | 95 | itemView.removeListener( 'update', container.relayUpdate ); |
96 | 96 | container.emit( 'remove', itemView ); |
97 | 97 | container.emit( 'update' ); |
98 | 98 | } ); |
99 | 99 | // Auto-add views for existing items |
100 | | - var itemModels = this.containerModel.all(); |
| 100 | + var itemModels = this.model.all(); |
101 | 101 | for ( var i = 0; i < itemModels.length; i++ ) { |
102 | 102 | var itemView = itemModels[i].createView(); |
103 | 103 | itemView.on( 'update', container.relayUpdate ); |
104 | | - this.views.push( itemView ); |
| 104 | + this.items.push( itemView ); |
105 | 105 | this.$.append( itemView.$ ); |
106 | 106 | } |
107 | 107 | }; |
108 | 108 | |
109 | 109 | es.ViewContainer.prototype.lookupItemView = function( itemModel ) { |
110 | | - for ( var i = 0; i < this.views.length; i++ ) { |
111 | | - if ( this.views[i].getModel() === itemModel ) { |
112 | | - return this.views[i]; |
| 110 | + for ( var i = 0; i < this.items.length; i++ ) { |
| 111 | + if ( this.items[i].getModel() === itemModel ) { |
| 112 | + return this.items[i]; |
113 | 113 | } |
114 | 114 | } |
115 | 115 | return null; |
Index: trunk/parsers/wikidom/lib/synth/views/es.ListBlockView.js |
— | — | @@ -17,8 +17,8 @@ |
18 | 18 | * Render content. |
19 | 19 | */ |
20 | 20 | es.ListBlockView.prototype.renderContent = function() { |
21 | | - for ( var i = 0; i < this.views.length; i++ ) { |
22 | | - this.views[i].renderContent(); |
| 21 | + for ( var i = 0; i < this.items.length; i++ ) { |
| 22 | + this.items[i].renderContent(); |
23 | 23 | } |
24 | 24 | }; |
25 | 25 | |
— | — | @@ -26,14 +26,14 @@ |
27 | 27 | var itemLevel, |
28 | 28 | levels = []; |
29 | 29 | |
30 | | - for ( var i = 0; i < this.views.length; i++ ) { |
31 | | - itemLevel = this.views[i].model.getLevel(); |
| 30 | + for ( var i = 0; i < this.items.length; i++ ) { |
| 31 | + itemLevel = this.items[i].model.getLevel(); |
32 | 32 | levels = levels.slice(0, itemLevel + 1); |
33 | | - if ( this.views[i].model.getStyle() === 'number' ) { |
| 33 | + if ( this.items[i].model.getStyle() === 'number' ) { |
34 | 34 | if ( !levels[itemLevel] ) { |
35 | 35 | levels[itemLevel] = 0; |
36 | 36 | } |
37 | | - this.views[i].setNumber( ++levels[itemLevel] ); |
| 37 | + this.items[i].setNumber( ++levels[itemLevel] ); |
38 | 38 | } |
39 | 39 | } |
40 | 40 | }; |
— | — | @@ -64,7 +64,7 @@ |
65 | 65 | }; |
66 | 66 | |
67 | 67 | es.ListBlockView.prototype.drawSelection = function( range ) { |
68 | | - var selectedViews = this.views.select( range ); |
| 68 | + var selectedViews = this.items.select( range ); |
69 | 69 | for ( var i = 0; i < selectedViews.length; i++ ) { |
70 | 70 | selectedViews[i].item.drawSelection( |
71 | 71 | new es.Range( selectedViews[i].from, selectedViews[i].to ) |
— | — | @@ -83,7 +83,7 @@ |
84 | 84 | return es.Html.makeTag( |
85 | 85 | 'div', |
86 | 86 | { 'class': this.$.attr( 'class' ) }, |
87 | | - $.map( this.views, function( view ) { |
| 87 | + $.map( this.items, function( view ) { |
88 | 88 | return view.getHtml(); |
89 | 89 | } ).join( '' ) |
90 | 90 | ); |
Index: trunk/parsers/wikidom/lib/synth/views/es.TableBlockRowView.js |
— | — | @@ -19,17 +19,17 @@ |
20 | 20 | * Render content. |
21 | 21 | */ |
22 | 22 | es.TableBlockRowView.prototype.renderContent = function() { |
23 | | - for ( var i = 0; i < this.views.length; i++ ) { |
24 | | - this.views[i].renderContent(); |
| 23 | + for ( var i = 0; i < this.items.length; i++ ) { |
| 24 | + this.items[i].renderContent(); |
25 | 25 | } |
26 | 26 | }; |
27 | 27 | |
28 | 28 | es.TableBlockRowView.prototype.getLength = function() { |
29 | | - return this.views.getLengthOfItems(); |
| 29 | + return this.items.getLengthOfItems(); |
30 | 30 | }; |
31 | 31 | |
32 | 32 | es.TableBlockRowView.prototype.drawSelection = function( range ) { |
33 | | - var selectedViews = this.views.select( range ); |
| 33 | + var selectedViews = this.items.select( range ); |
34 | 34 | for ( var i = 0; i < selectedViews.length; i++ ) { |
35 | 35 | selectedViews[i].item.drawSelection( |
36 | 36 | new es.Range( selectedViews[i].from, selectedViews[i].to ) |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | * @returns {String} HTML data |
47 | 47 | */ |
48 | 48 | es.TableBlockRowView.prototype.getHtml = function( options ) { |
49 | | - return es.Html.makeTag( 'tr', this.model.attributes, $.map( this.views, function( view ) { |
| 49 | + return es.Html.makeTag( 'tr', this.model.attributes, $.map( this.items, function( view ) { |
50 | 50 | return view.getHtml(); |
51 | 51 | } ).join( '' ) ); |
52 | 52 | }; |
Index: trunk/parsers/wikidom/lib/synth/views/es.DocumentView.js |
— | — | @@ -12,13 +12,13 @@ |
13 | 13 | * Render content. |
14 | 14 | */ |
15 | 15 | es.DocumentView.prototype.renderContent = function() { |
16 | | - for ( var i = 0; i < this.views.length; i++ ) { |
17 | | - this.views[i].renderContent(); |
| 16 | + for ( var i = 0; i < this.items.length; i++ ) { |
| 17 | + this.items[i].renderContent(); |
18 | 18 | } |
19 | 19 | }; |
20 | 20 | |
21 | 21 | es.DocumentView.prototype.drawSelection = function( range ) { |
22 | | - var selectedViews = this.views.select( range ); |
| 22 | + var selectedViews = this.items.select( range ); |
23 | 23 | for ( var i = 0; i < selectedViews.length; i++ ) { |
24 | 24 | selectedViews[i].item.drawSelection( |
25 | 25 | new es.Range( selectedViews[i].from, selectedViews[i].to ) |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | }; |
29 | 29 | |
30 | 30 | es.DocumentView.prototype.getLength = function( ) { |
31 | | - return this.views.getLengthOfItems(); |
| 31 | + return this.items.getLengthOfItems(); |
32 | 32 | }; |
33 | 33 | |
34 | 34 | /** |
— | — | @@ -37,11 +37,11 @@ |
38 | 38 | * @returns {String} HTML data |
39 | 39 | */ |
40 | 40 | es.DocumentView.prototype.getHtml = function() { |
41 | | - var views = this.views; |
| 41 | + var views = this.items; |
42 | 42 | return es.Html.makeTag( |
43 | 43 | 'div', |
44 | 44 | { 'class': this.$.attr( 'class' ) }, |
45 | | - $.map( this.views, function( view, i ) { |
| 45 | + $.map( this.items, function( view, i ) { |
46 | 46 | return view.getHtml( { 'singular': i === 0 && views.length == 1 } ); |
47 | 47 | } ).join( '' ) |
48 | 48 | ); |
Index: trunk/parsers/wikidom/lib/synth/views/es.TableBlockView.js |
— | — | @@ -19,17 +19,17 @@ |
20 | 20 | * Render content. |
21 | 21 | */ |
22 | 22 | es.TableBlockView.prototype.renderContent = function() { |
23 | | - for ( var i = 0; i < this.views.length; i++ ) { |
24 | | - this.views[i].renderContent(); |
| 23 | + for ( var i = 0; i < this.items.length; i++ ) { |
| 24 | + this.items[i].renderContent(); |
25 | 25 | } |
26 | 26 | }; |
27 | 27 | |
28 | 28 | es.TableBlockView.prototype.getLength = function() { |
29 | | - return this.views.getLengthOfItems(); |
| 29 | + return this.items.getLengthOfItems(); |
30 | 30 | }; |
31 | 31 | |
32 | 32 | es.TableBlockView.prototype.drawSelection = function( range ) { |
33 | | - var selectedViews = this.views.select( range ); |
| 33 | + var selectedViews = this.items.select( range ); |
34 | 34 | for ( var i = 0; i < selectedViews.length; i++ ) { |
35 | 35 | selectedViews[i].item.drawSelection( |
36 | 36 | new es.Range( selectedViews[i].from, selectedViews[i].to ) |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | * @returns {String} HTML data |
47 | 47 | */ |
48 | 48 | es.TableBlockView.prototype.getHtml = function( options ) { |
49 | | - return es.Html.makeTag( 'table', this.model.attributes, $.map( this.views, function( view ) { |
| 49 | + return es.Html.makeTag( 'table', this.model.attributes, $.map( this.items, function( view ) { |
50 | 50 | return view.getHtml(); |
51 | 51 | } ).join( '' ) ); |
52 | 52 | }; |