| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Lazy implementation of the child nodes of an element that does not request | 8 * Lazy implementation of the child nodes of an element that does not request |
| 9 * the actual child nodes of an element until strictly necessary greatly | 9 * the actual child nodes of an element until strictly necessary greatly |
| 10 * improving performance for the typical cases where it is not required. | 10 * improving performance for the typical cases where it is not required. |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 * single node. | 192 * single node. |
| 193 */ | 193 */ |
| 194 final Node lastNode; | 194 final Node lastNode; |
| 195 | 195 |
| 196 /** The model used to instantiate the template. */ | 196 /** The model used to instantiate the template. */ |
| 197 final model; | 197 final model; |
| 198 | 198 |
| 199 TemplateInstance(this.firstNode, this.lastNode, this.model); | 199 TemplateInstance(this.firstNode, this.lastNode, this.model); |
| 200 } | 200 } |
| 201 | 201 |
| 202 |
| 202 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 203 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| 203 List<Node> get nodes { | 204 List<Node> get nodes { |
| 204 return new _ChildNodeListLazy(this); | 205 return new _ChildNodeListLazy(this); |
| 205 } | 206 } |
| 206 | 207 |
| 207 void set nodes(Iterable<Node> value) { | 208 void set nodes(Iterable<Node> value) { |
| 208 // Copy list first since we don't want liveness during iteration. | 209 // Copy list first since we don't want liveness during iteration. |
| 209 // TODO(jacobr): there is a better way to do this. | 210 // TODO(jacobr): there is a better way to do this. |
| 210 List copy = new List.from(value); | 211 List copy = new List.from(value); |
| 211 text = ''; | 212 text = ''; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 this.insertBefore(node, refChild); | 265 this.insertBefore(node, refChild); |
| 265 } | 266 } |
| 266 } | 267 } |
| 267 } | 268 } |
| 268 | 269 |
| 269 /** | 270 /** |
| 270 * Print out a String representation of this Node. | 271 * Print out a String representation of this Node. |
| 271 */ | 272 */ |
| 272 String toString() => nodeValue == null ? super.toString() : nodeValue; | 273 String toString() => nodeValue == null ? super.toString() : nodeValue; |
| 273 | 274 |
| 275 |
| 276 /** |
| 277 * Creates a binding to the attribute [name] to the [path] of the [model]. |
| 278 * |
| 279 * This can be overridden by custom elements to provide the binding used in |
| 280 * [Node.bind]. This will only create the binding; it will not add it to |
| 281 * [bindings]. |
| 282 * |
| 283 * You should not need to call this directly except from [Node.bind]. |
| 284 */ |
| 285 @Experimental() |
| 286 createBinding(String name, model, String path) => |
| 287 TemplateElement.mdvPackage(this).createBinding(name, model, path); |
| 288 |
| 274 /** | 289 /** |
| 275 * Binds the attribute [name] to the [path] of the [model]. | 290 * Binds the attribute [name] to the [path] of the [model]. |
| 276 * Path is a String of accessors such as `foo.bar.baz`. | 291 * Path is a String of accessors such as `foo.bar.baz`. |
| 292 * Returns the `NodeBinding` instance. |
| 277 */ | 293 */ |
| 278 @Experimental() | 294 @Experimental() |
| 279 void bind(String name, model, String path) { | 295 bind(String name, model, String path) => |
| 280 TemplateElement.mdvPackage(this).bind(name, model, path); | 296 TemplateElement.mdvPackage(this).bind(name, model, path); |
| 281 } | |
| 282 | 297 |
| 283 /** Unbinds the attribute [name]. */ | 298 /** Unbinds the attribute [name]. */ |
| 284 @Experimental() | 299 @Experimental() |
| 285 void unbind(String name) { | 300 void unbind(String name) { |
| 286 TemplateElement.mdvPackage(this).unbind(name); | 301 TemplateElement.mdvPackage(this).unbind(name); |
| 287 } | 302 } |
| 288 | 303 |
| 289 /** Unbinds all bound attributes. */ | 304 /** Unbinds all bound attributes. */ |
| 290 @Experimental() | 305 @Experimental() |
| 291 void unbindAll() { | 306 void unbindAll() { |
| 292 TemplateElement.mdvPackage(this).unbindAll(); | 307 TemplateElement.mdvPackage(this).unbindAll(); |
| 293 } | 308 } |
| 294 | 309 |
| 310 /** Gets the data bindings that are associated with this node. */ |
| 311 @Experimental() |
| 312 Map<String, dynamic> get bindings => |
| 313 TemplateElement.mdvPackage(this).bindings; |
| 314 |
| 295 /** Gets the template instance that instantiated this node, if any. */ | 315 /** Gets the template instance that instantiated this node, if any. */ |
| 296 @Experimental() | 316 @Experimental() |
| 297 TemplateInstance get templateInstance => | 317 TemplateInstance get templateInstance => |
| 298 TemplateElement.mdvPackage(this).templateInstance; | 318 TemplateElement.mdvPackage(this).templateInstance; |
| 299 | 319 |
| 300 $!MEMBERS | 320 $!MEMBERS |
| 301 } | 321 } |
| OLD | NEW |