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

Unified Diff: samples/third_party/todomvc/web/lib-elements/polymer_selection.dart

Issue 182193002: [polymer] interop with polymer-element and polymer.js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: samples/third_party/todomvc/web/lib-elements/polymer_selection.dart
diff --git a/samples/third_party/todomvc/web/lib-elements/polymer_selection.dart b/samples/third_party/todomvc/web/lib-elements/polymer_selection.dart
deleted file mode 100644
index 315c425b1a20cb112c0483980a2c5bd48189f518..0000000000000000000000000000000000000000
--- a/samples/third_party/todomvc/web/lib-elements/polymer_selection.dart
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2013 The Polymer Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-library todomvc.web.lib_elements.polymer_selection;
-
-import 'dart:html';
-import 'package:polymer/polymer.dart';
-
-@CustomTag('polymer-selection')
-class PolymerSelection extends PolymerElement {
- @published bool multi = false;
- @observable final selection = new ObservableList();
-
- factory PolymerSelection() => new Element.tag('polymer-selection');
- PolymerSelection.created() : super.created();
-
- void ready() {
- clear();
- }
-
- void clear() {
- selection.clear();
- }
-
- getSelection() {
- if (multi) return selection;
- if (selection.isNotEmpty) return selection[0];
- return null;
- }
-
- bool isSelected(item) => selection.contains(item);
-
- void setItemSelected(item, bool isSelected) {
- if (item != null) {
- if (isSelected) {
- selection.add(item);
- } else {
- selection.remove(item);
- }
- // TODO(sjmiles): consider replacing with summary
- // notifications (asynchronous job)
- asyncFire("polymer-select", detail:
- new PolymerSelectEventDetail(isSelected, item));
- }
- }
-
- select(item) {
- if (multi) {
- toggle(item);
- } else if (getSelection() != item) {
- setItemSelected(getSelection(), false);
- setItemSelected(item, true);
- }
- }
-
- toggle(item) {
- setItemSelected(item, !isSelected(item));
- }
-}
-
-class PolymerSelectEventDetail {
- final bool isSelected;
- final item;
-
- PolymerSelectEventDetail(this.isSelected, this.item);
-}

Powered by Google App Engine
This is Rietveld 408576698