Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: src/site/docs/tutorials/web-ui/index.markdown

Issue 20778002: more link tweaking (Closed) Base URL: https://github.com/dart-lang/dartlang.org.git@master
Patch Set: getting ready for push Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/site/docs/tutorials/templates/index.markdown ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 --- 1 ---
2 layout: default 2 layout: default
3 title: "Get Started with Web UI" 3 title: "Get Started with Web UI"
4 description: "Web UI provides web components, templates, data binding, and encap sulation." 4 description: "Web UI provides web components, templates, data binding, and encap sulation."
5 has-permalinks: true 5 has-permalinks: true
6 tutorial: 6 tutorial:
7 id: get-started-web-ui 7 id: get-started-web-ui
8 next: templates 8 next: templates/
9 next-title: "Use Templates" 9 next-title: "Use Templates"
10 prev: shared-pkgs 10 prev: shared-pkgs/
11 prev-title: "Install Shared Packages" 11 prev-title: "Install Shared Packages"
12 --- 12 ---
13 13
14 {% capture whats_the_point %} 14 {% capture whats_the_point %}
15 15
16 * Web UI is an open-source package. 16 * Web UI is an open-source package.
17 * Web UI provides web components for Dart apps. 17 * Web UI provides web components for Dart apps.
18 * Other features support separation of data and presentation. 18 * Other features support separation of data and presentation.
19 * Compile Web UI apps automatically in Dart Editor. 19 * Compile Web UI apps automatically in Dart Editor.
20 * Use data binding to sync Dart variables and UI elements. 20 * Use data binding to sync Dart variables and UI elements.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 </div> 52 </div>
53 53
54 <hr> 54 <hr>
55 55
56 <aside class="alert" style="background-color:Lavender;color:SlateBlue"> 56 <aside class="alert" style="background-color:Lavender;color:SlateBlue">
57 <font size="24"> 57 <font size="24">
58 <i class="icon-bullhorn"> </i> 58 <i class="icon-bullhorn"> </i>
59 </font> 59 </font>
60 60
61 The Dart Web UI team recently 61 The Dart Web UI team recently
62 <a href="https://groups.google.com/a/dartlang.org/forum/#!topic/web-ui/6laXXxR tA7k">announced</a> 62 <a href="https://groups.google.com/a/dartlang.org/forum/#!topic/web-ui/6laXXxR tA7k" target="_blank">announced</a>
63 a port of the Polymer project: 63 a port of the Polymer project:
64 <a href="http://pub.dartlang.org/packages/polymer">polymer.dart</a>. 64 <a href="https://pub.dartlang.org/packages/polymer" target="_blank">polymer.da rt</a>.
65 65
66 We've converted most of the tutorial Web UI examples and compiled some 66 We've converted most of the tutorial Web UI examples and compiled some
67 <a href="https://github.com/dart-lang/dart-tutorials-samples/blob/master/web/t o-polymer-notes.txt" target="_blank">notes</a> 67 <a href="https://github.com/dart-lang/dart-tutorials-samples/blob/master/web/t o-polymer-notes.txt" target="_blank">notes</a>
68 along the way. 68 along the way.
69 Here is the source code for the polymer versions of the three examples from th is target: 69 Here is the source code for the polymer versions of the three examples from th is target:
70 <ul> 70 <ul>
71 <li> 71 <li>
72 <a href="https://github.com/dart-lang/dart-tutorials-samples/tree/master/w eb/target06-polymer/littleben_element" 72 <a href="https://github.com/dart-lang/dart-tutorials-samples/tree/master/w eb/target06-polymer/littleben_element"
73 target="_blank">littleben_element</a>: version of littleben using a cus tom element 73 target="_blank">littleben_element</a>: version of littleben using a cus tom element
74 </li> 74 </li>
75 <li> 75 <li>
76 <a href="https://github.com/dart-lang/dart-tutorials-samples/tree/master/w eb/target06-polymer/littleben_model" 76 <a href="https://github.com/dart-lang/dart-tutorials-samples/tree/master/w eb/target06-polymer/littleben_model"
77 target="_blank">littleben_model</a>: version of littleben with a bound model 77 target="_blank">littleben_model</a>: version of littleben with a bound model
78 </li> 78 </li>
79 <li> 79 <li>
80 <a href="https://github.com/dart-lang/dart-tutorials-samples/tree/master/w eb/target06-polymer/shout" 80 <a href="https://github.com/dart-lang/dart-tutorials-samples/tree/master/w eb/target06-polymer/shout"
81 target="_blank">shout</a> 81 target="_blank">shout</a>
82 </li> 82 </li>
83 <li> 83 <li>
84 <a href="https://github.com/dart-lang/dart-tutorials-samples/tree/master/w eb/target06-polymer/stopwatch" 84 <a href="https://github.com/dart-lang/dart-tutorials-samples/tree/master/w eb/target06-polymer/stopwatch"
85 target="_blank">stopwatch</a> 85 target="_blank">stopwatch</a>
86 </li> 86 </li>
87 </ul> 87 </ul>
88 </aside> 88 </aside>
89 89
90 <hr> 90 <hr>
91 91
92 92
93 The 93 The
94 <a href="http://pub.dartlang.org/packages/web_ui">Web UI package</a> 94 <a href="https://pub.dartlang.org/packages/web_ui" target="_blank">Web UI packag e</a>
95 provides the tools and Dart code 95 provides the tools and Dart code
96 that implement data binding, web components, 96 that implement data binding, web components,
97 templates, and encapsulation. 97 templates, and encapsulation.
98 To use these Web UI features, 98 To use these Web UI features,
99 you need to install the Web UI package in each application that uses it 99 you need to install the Web UI package in each application that uses it
100 and compile the project using the Web UI compiler. 100 and compile the project using the Web UI compiler.
101 To streamline the development process, 101 To streamline the development process,
102 you can use Dart Editor to help set up your project, 102 you can use Dart Editor to help set up your project,
103 install the package, and automate the build process. 103 install the package, and automate the build process.
104 104
105 This target begins by showing you how to set up a project to use Web UI, 105 This target begins by showing you how to set up a project to use Web UI,
106 including how to install the package. 106 including how to install the package.
107 (If you are unfamiliar with packages, the previous target, 107 (If you are unfamiliar with packages, the previous target,
108 <a href="/docs/tutorials/packages/">Install Shared Packages</a>, 108 <a href="/docs/tutorials/shared-pkgs/">Install Shared Packages</a>,
109 has details.) 109 has details.)
110 Then this target describes how to use two features of the Web UI package. 110 Then this target describes how to use two features of the Web UI package.
111 Specifically, you will learn 111 Specifically, you will learn
112 how to use data binding to embed mutable Dart data in your HTML page 112 how to use data binding to embed mutable Dart data in your HTML page
113 and to declaratively attach event handlers to UI elements. 113 and to declaratively attach event handlers to UI elements.
114 114
115 The next two targets, 115 The next two targets,
116 <a href="/docs/tutorials/templates/">Target 7: Use &lt;template&gt;</a> 116 <a href="/docs/tutorials/templates/">Target 7: Use &lt;template&gt;</a>
117 and 117 and
118 <a href="/docs/tutorials/custom-elements/">Target 8: Define a Custom DOM Tag</a> , 118 <a href="/docs/tutorials/custom-elements/">Target 8: Define a Custom DOM Tag</a> ,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 </li> 207 </li>
208 </ol> 208 </ol>
209 209
210 ##Install the Web UI package in an existing Web application {#install-web-ui} 210 ##Install the Web UI package in an existing Web application {#install-web-ui}
211 211
212 If you already have an application to which you would like to add Web UI, 212 If you already have an application to which you would like to add Web UI,
213 you need to set up the package dependencies 213 you need to set up the package dependencies
214 and install the Web UI package libraries into your project. 214 and install the Web UI package libraries into your project.
215 This section assumes that you have read 215 This section assumes that you have read
216 the previous target, 216 the previous target,
217 <a href="/docs/tutorials/packages/">Install Shared Packages</a>, 217 <a href="/docs/tutorials/shared-pkgs/">Install Shared Packages</a>,
218 and are familiar with the process 218 and are familiar with the process
219 of installing packages. 219 of installing packages.
220 220
221 <ol> 221 <ol>
222 <li markdown="1"> 222 <li markdown="1">
223 In Dart Editor, 223 In Dart Editor,
224 open an existing project. 224 open an existing project.
225 For the example here, 225 For the example here,
226 we're using the default sample application 226 we're using the default sample application
227 generated by Dart Editor 227 generated by Dart Editor
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 259
260 <aside class="alert" markdown="1"> 260 <aside class="alert" markdown="1">
261 <strong>Note:</strong> 261 <strong>Note:</strong>
262 If you include a version constraint, 262 If you include a version constraint,
263 instead of using `any`, 263 instead of using `any`,
264 your code will be less likely to break 264 your code will be less likely to break
265 because of new releases of the package. 265 because of new releases of the package.
266 For example: `web_ui: >=0.4.1 <0.4.2`. 266 For example: `web_ui: >=0.4.1 <0.4.2`.
267 You can proactively upgrade to new versions when you are ready. 267 You can proactively upgrade to new versions when you are ready.
268 Check the Web UI package 268 Check the Web UI package
269 <a href="https://github.com/dart-lang/web-ui/blob/master/CHANGELOG.md"> 269 <a href="https://github.com/dart-lang/web-ui/blob/master/CHANGELOG.md" target="_ blank">
270 CHANGELOG</a> 270 CHANGELOG</a>
271 to see what version of the package 271 to see what version of the package
272 works with the version of the SDK you are running. 272 works with the version of the SDK you are running.
273 </aside> 273 </aside>
274 </li> 274 </li>
275 275
276 <li markdown="1"> 276 <li markdown="1">
277 Select pubspec.yaml, and install the package by 277 Select pubspec.yaml, and install the package by
278 choosing **Tools > Pub Install** from the menu. 278 choosing **Tools > Pub Install** from the menu.
279 This recursively installs the web_ui package 279 This recursively installs the web_ui package
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 The Dart code computes the current time and 368 The Dart code computes the current time and
369 formats it into a String. 369 formats it into a String.
370 The HTML code embeds the value of that Dart String 370 The HTML code embeds the value of that Dart String
371 into the HTML using the data binding feature provided by the Web UI package. 371 into the HTML using the data binding feature provided by the Web UI package.
372 Use one-way data binding 372 Use one-way data binding
373 when the value of the bound expression (here, a Dart string) 373 when the value of the bound expression (here, a Dart string)
374 can change only in the Dart code. 374 can change only in the Dart code.
375 375
376 <iframe class="running-app-frame" 376 <iframe class="running-app-frame"
377 style="height:100px;width:300px;" 377 style="height:100px;width:300px;"
378 src="http://dart-lang.github.com/dart-tutorials-samples/web/target06/lit tleben/web/out/littleben.html"> 378 src="http://dart-lang.github.io/dart-tutorials-samples/web/target06/litt leben/web/out/littleben.html">
379 </iframe> 379 </iframe>
380 380
381 You can find the complete source code for this sample on github at 381 You can find the complete source code for this sample on github at
382 <a href="https://github.com/dart-lang/dart-tutorials-samples/tree/master/web/tar get06/littleben" target="_blank">littleben</a>. 382 <a href="https://github.com/dart-lang/dart-tutorials-samples/tree/master/web/tar get06/littleben" target="_blank">littleben</a>.
383 383
384 On the HTML side, the code uses a _template expression_ 384 On the HTML side, the code uses a _template expression_
385 to embed the value of the String `currentTime` into the page. 385 to embed the value of the String `currentTime` into the page.
386 In this example, 386 In this example,
387 the expression is simply the name of a Dart variable 387 the expression is simply the name of a Dart variable
388 and it appears as part of an element's text property. 388 and it appears as part of an element's text property.
(...skipping 17 matching lines...) Expand all
406 If the variable points to a different object, 406 If the variable points to a different object,
407 you'll know thanks to @observable. 407 you'll know thanks to @observable.
408 However, if the internal value of the variable changes 408 However, if the internal value of the variable changes
409 (like, list contents), @observable doesn't help you. 409 (like, list contents), @observable doesn't help you.
410 You'll need to also say 410 You'll need to also say
411 "I want to observe list contents" with toObservable(). 411 "I want to observe list contents" with toObservable().
412 {% endcomment %} 412 {% endcomment %}
413 413
414 The value of `currentTime` changes every second 414 The value of `currentTime` changes every second
415 thanks to a periodic 415 thanks to a periodic
416 <a href="http://api.dartlang.org/dart_async/Timer.html" target="_blank">Timer</a > 416 <a href="https://api.dartlang.org/dart_async/Timer.html" target="_blank">Timer</ a>
417 object. 417 object.
418 When the string changes, 418 When the string changes,
419 the HTML page gets updated automatically. 419 the HTML page gets updated automatically.
420 420
421 This sample also uses the 421 This sample also uses the
422 <a href="http://api.dartlang.org/dart_core/DateTime.html" target="_blank">DateTi me</a> 422 <a href="https://api.dartlang.org/dart_core/DateTime.html" target="_blank">DateT ime</a>
423 class to get the current time. 423 class to get the current time.
424 424
425 ##Binding the value of an element to a Dart variable {#two-way-data-binding} 425 ##Binding the value of an element to a Dart variable {#two-way-data-binding}
426 426
427 Using the Web UI package's two-way data binding feature, 427 Using the Web UI package's two-way data binding feature,
428 you can bind the value of an element, 428 you can bind the value of an element,
429 typically an &lt;input&gt; element, 429 typically an &lt;input&gt; element,
430 to the value of a Dart variable. 430 to the value of a Dart variable.
431 431
432 Try it! Type in the input field in the example running below. 432 Try it! Type in the input field in the example running below.
433 433
434 <iframe class="running-app-frame" 434 <iframe class="running-app-frame"
435 style="height:230px;width:300px;" 435 style="height:230px;width:300px;"
436 src="http://dart-lang.github.com/dart-tutorials-samples/web/target06/sho ut/web/out/shout.html"> 436 src="http://dart-lang.github.io/dart-tutorials-samples/web/target06/shou t/web/out/shout.html">
437 </iframe> 437 </iframe>
438 438
439 You can find the complete source code for this sample on github at 439 You can find the complete source code for this sample on github at
440 <a href="https://github.com/dart-lang/dart-tutorials-samples/tree/master/web/tar get06/shout" target="_blank">shout</a>. 440 <a href="https://github.com/dart-lang/dart-tutorials-samples/tree/master/web/tar get06/shout" target="_blank">shout</a>.
441 441
442 The value of the text field is bound to a Dart string called `shoutThis`. 442 The value of the text field is bound to a Dart string called `shoutThis`.
443 The string is declared 443 The string is declared
444 and marked with `@observable` 444 and marked with `@observable`
445 in the Dart code. 445 in the Dart code.
446 The string is bound to the input field in the HTML code 446 The string is bound to the input field in the HTML code
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 to bind Dart event handlers to UI elements. 506 to bind Dart event handlers to UI elements.
507 Each button in the stopwatch example below 507 Each button in the stopwatch example below
508 has an event handler for responding to mouse clicks. 508 has an event handler for responding to mouse clicks.
509 The event handlers are bound to the button in the HTML code 509 The event handlers are bound to the button in the HTML code
510 and implemented in Dart. 510 and implemented in Dart.
511 511
512 Try it! Click the buttons to start, stop, and reset the stop watch. 512 Try it! Click the buttons to start, stop, and reset the stop watch.
513 513
514 <iframe class="running-app-frame" 514 <iframe class="running-app-frame"
515 style="height:175px;width:205px;" 515 style="height:175px;width:205px;"
516 src="http://dart-lang.github.com/dart-tutorials-samples/web/target06/sto pwatch/web/out/stopwatch.html"> 516 src="http://dart-lang.github.io/dart-tutorials-samples/web/target06/stop watch/web/out/stopwatch.html">
517 </iframe> 517 </iframe>
518 518
519 You can find the complete source code for this sample on github at 519 You can find the complete source code for this sample on github at
520 <a href="https://github.com/dart-lang/dart-tutorials-samples/tree/master/web/tar get06/stopwatch" target="_blank">stopwatch</a>. 520 <a href="https://github.com/dart-lang/dart-tutorials-samples/tree/master/web/tar get06/stopwatch" target="_blank">stopwatch</a>.
521 521
522 Here's the code that sets the mouse click handler for the **Start** button. 522 Here's the code that sets the mouse click handler for the **Start** button.
523 523
524 ![Set event handlers directly in HTML code](images/event-handler.png) 524 ![Set event handlers directly in HTML code](images/event-handler.png)
525 525
526 Event handlers are declared using attributes, 526 Event handlers are declared using attributes,
527 where the attribute name specifies the event type 527 where the attribute name specifies the event type
528 using a hyphenated form of the Dart event name beginning with `on-`. 528 using a hyphenated form of the Dart event name beginning with `on-`.
529 The buttons in the example specify event handlers for mouse clicks 529 The buttons in the example specify event handlers for mouse clicks
530 using `on-click`. 530 using `on-click`.
531 531
532 Other common events 532 Other common events
533 are double-click events (`on-double-click`) 533 are double-click events (`on-double-click`)
534 and change events on input fields (`on-change`). 534 and change events on input fields (`on-change`).
535 See the API docs for 535 See the API docs for
536 <a href="http://api.dartlang.org/dart_html/Element.html" 536 <a href="https://api.dartlang.org/dart_html/Element.html"
537 target="_blank">Element</a> 537 target="_blank">Element</a>
538 for a complete list of event names. 538 for a complete list of event names.
539 {% comment %} 539 {% comment %}
540 Events classes are planned to change 540 Events classes are planned to change
541 and this section will need updating. 541 and this section will need updating.
542 {% endcomment %} 542 {% endcomment %}
543 543
544 The attribute value is a Dart expression that usually 544 The attribute value is a Dart expression that usually
545 specifies a function call. 545 specifies a function call.
546 In the stopwatch example, 546 In the stopwatch example,
(...skipping 18 matching lines...) Expand all
565 Sigmund Cherem's article, 565 Sigmund Cherem's article,
566 <a href="/articles/dart-web-components/">Web UI Package</a>, 566 <a href="/articles/dart-web-components/">Web UI Package</a>,
567 contains several interactive examples on the page 567 contains several interactive examples on the page
568 and the corresponding source code. 568 and the corresponding source code.
569 </li> 569 </li>
570 </ul> 570 </ul>
571 571
572 {% endcapture %} 572 {% endcapture %}
573 573
574 {% include tutorial.html %} 574 {% include tutorial.html %}
OLDNEW
« no previous file with comments | « src/site/docs/tutorials/templates/index.markdown ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698