summaryrefslogtreecommitdiff
path: root/chromium/third_party/catapult/tracing/tracing/ui/base/checkbox_picker.html
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/catapult/tracing/tracing/ui/base/checkbox_picker.html')
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/checkbox_picker.html178
1 files changed, 88 insertions, 90 deletions
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/checkbox_picker.html b/chromium/third_party/catapult/tracing/tracing/ui/base/checkbox_picker.html
index 261b15922bd..5b5d242b96b 100644
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/checkbox_picker.html
+++ b/chromium/third_party/catapult/tracing/tracing/ui/base/checkbox_picker.html
@@ -8,7 +8,7 @@ found in the LICENSE file.
<link rel="import" href="/tracing/ui/base/checkbox.html">
<link rel="import" href="/tracing/ui/base/ui.html">
-<polymer-element name='tr-ui-b-checkbox-picker'>
+<dom-module id='tr-ui-b-checkbox-picker'>
<template>
<style>
#container {
@@ -19,93 +19,91 @@ found in the LICENSE file.
<div id="container">
</div>
-
</template>
-
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.needsInit_ = true;
- this.settingsKey_ = undefined;
- this.is_ready_ = false;
- this.checkboxes_ = undefined;
- },
-
- ready: function() {
- this.is_ready_ = true;
- this.maybeInit_();
- this.maybeRenderCheckboxes_();
- },
-
- get settingsKey() {
- return this.settingsKey_;
- },
-
- set settingsKey(settingsKey) {
- if (!this.needsInit_)
- throw new Error('Already initialized.');
- this.settingsKey_ = settingsKey;
- this.maybeInit_();
- },
-
- maybeInit_: function() {
- if (!this.needsInit_)
- return;
- if (this.settingsKey_ === undefined)
- return;
- if (this.checkboxes_ === undefined)
- return;
-
- this.needsInit_ = false;
-
- for (var key in this.checkboxes_) {
- this.checkboxes_[key].defaultCheckedValue = false;
- this.checkboxes_[key].settingsKey = this.settingsKey_ + key;
- }
- },
-
- set items(items) {
- this.checkboxes_ = {};
- items.forEach(function(e) {
- if (e.key in this.checkboxes_)
- throw new Error(e.key + ' already exists');
- var checkboxEl = document.createElement('tr-ui-b-checkbox');
- checkboxEl.label = e.label;
- this.checkboxes_[e.key] = checkboxEl;
- }.bind(this));
- this.maybeInit_();
- this.maybeRenderCheckboxes_();
- },
-
- maybeRenderCheckboxes_: function() {
- if (!this.is_ready_)
- return;
- if (this.checkboxes_ === undefined)
- return;
- for (var key in this.checkboxes_)
- this.$.container.appendChild(this.checkboxes_[key]);
- },
-
- selectCheckbox: function(key) {
- if (!(key in this.checkboxes_))
- throw new Error(key + ' does not exists');
- this.checkboxes_[key].checked = true;
- },
-
- unselectCheckbox: function(key) {
- if (!(key in this.checkboxes_))
- throw new Error(key + ' does not exists');
- this.checkboxes_[key].checked = false;
- },
-
- get checkedKeys() {
- return Object.keys(this.checkboxes_).filter(function(k) {
- return this.checkboxes_[k].checked;
- }.bind(this));
- },
-
- });
- </script>
-</polymer-element>
+</dom-module>
+<script>
+'use strict';
+
+Polymer({
+ is: 'tr-ui-b-checkbox-picker',
+ created: function() {
+ this.needsInit_ = true;
+ this.settingsKey_ = undefined;
+ this.is_ready_ = false;
+ this.checkboxes_ = undefined;
+ },
+
+ ready: function() {
+ this.is_ready_ = true;
+ this.maybeInit_();
+ this.maybeRenderCheckboxes_();
+ },
+
+ get settingsKey() {
+ return this.settingsKey_;
+ },
+
+ set settingsKey(settingsKey) {
+ if (!this.needsInit_)
+ throw new Error('Already initialized.');
+ this.settingsKey_ = settingsKey;
+ this.maybeInit_();
+ },
+
+ maybeInit_: function() {
+ if (!this.needsInit_)
+ return;
+ if (this.settingsKey_ === undefined)
+ return;
+ if (this.checkboxes_ === undefined)
+ return;
+
+ this.needsInit_ = false;
+
+ for (var key in this.checkboxes_) {
+ this.checkboxes_[key].defaultCheckedValue = false;
+ this.checkboxes_[key].settingsKey = this.settingsKey_ + key;
+ }
+ },
+
+ set items(items) {
+ this.checkboxes_ = {};
+ items.forEach(function(e) {
+ if (e.key in this.checkboxes_)
+ throw new Error(e.key + ' already exists');
+ var checkboxEl = document.createElement('tr-ui-b-checkbox');
+ checkboxEl.label = e.label;
+ this.checkboxes_[e.key] = checkboxEl;
+ }.bind(this));
+ this.maybeInit_();
+ this.maybeRenderCheckboxes_();
+ },
+
+ maybeRenderCheckboxes_: function() {
+ if (!this.is_ready_)
+ return;
+ if (this.checkboxes_ === undefined)
+ return;
+ for (var key in this.checkboxes_)
+ Polymer.dom(this.$.container).appendChild(this.checkboxes_[key]);
+ },
+
+ selectCheckbox: function(key) {
+ if (!(key in this.checkboxes_))
+ throw new Error(key + ' does not exists');
+ this.checkboxes_[key].checked = true;
+ },
+
+ unselectCheckbox: function(key) {
+ if (!(key in this.checkboxes_))
+ throw new Error(key + ' does not exists');
+ this.checkboxes_[key].checked = false;
+ },
+
+ get checkedKeys() {
+ return Object.keys(this.checkboxes_).filter(function(k) {
+ return this.checkboxes_[k].checked;
+ }.bind(this));
+ }
+});
+</script>