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 /** Component representing one todo list element. */ | 5 /** Component representing one todo list element. */ |
6 class TodoListElement implements WebComponent { | 6 class TodoListElement implements WebComponent { |
7 ShadowRoot _shadowRoot; | 7 ShadowRoot _shadowRoot; |
8 Element element; | 8 Element element; |
9 Todo todo; | 9 Todo todo; |
10 Todos model; | 10 Todos model; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } else { | 154 } else { |
155 _footer.query('#todo-count').innerHTML = | 155 _footer.query('#todo-count').innerHTML = |
156 '<strong>$uncomplete</strong> items left'; | 156 '<strong>$uncomplete</strong> items left'; |
157 } | 157 } |
158 _clearCompleted.innerHTML = | 158 _clearCompleted.innerHTML = |
159 'Clear completed ' | 159 'Clear completed ' |
160 '(${model._todos.length - model.remaining})'; | 160 '(${model._todos.length - model.remaining})'; |
161 } | 161 } |
162 } | 162 } |
163 | 163 |
164 Todos get model() => _model; | 164 Todos get model => _model; |
165 | 165 |
166 void created() { | 166 void created() { |
167 _footer = _shadowRoot.query('#footer'); | 167 _footer = _shadowRoot.query('#footer'); |
168 _clearCompleted = _shadowRoot.query('#clear-completed'); | 168 _clearCompleted = _shadowRoot.query('#clear-completed'); |
169 } | 169 } |
170 | 170 |
171 void inserted() { | 171 void inserted() { |
172 updateCount(null); | 172 updateCount(null); |
173 var toggleAll = _shadowRoot.query('#toggle-all'); | 173 var toggleAll = _shadowRoot.query('#toggle-all'); |
174 toggleAll.on.change.add((event) { | 174 toggleAll.on.change.add((event) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 if (trimmedStr != '') { | 211 if (trimmedStr != '') { |
212 model.addTodo(new Todo(trimmedStr)); | 212 model.addTodo(new Todo(trimmedStr)); |
213 input.value = ''; | 213 input.value = ''; |
214 } | 214 } |
215 } | 215 } |
216 }); | 216 }); |
217 } | 217 } |
218 void attributeChanged(String name, String oldValue, String newValue) { } | 218 void attributeChanged(String name, String oldValue, String newValue) { } |
219 void removed() { } | 219 void removed() { } |
220 } | 220 } |
OLD | NEW |