2 name: "HackPreferences",
8 {kind: "Header", content: "Preferences"},
9 {kind: "Scroller", flex: 1, components: [
10 {kind: "Control", className: "prefs-center", components: [
11 {kind: "RowGroup", name: "prefsContainer"},
12 {kind: "HFlexBox", pack: "center", components: [
13 {kind: "Button", className: "enyo-button-negative prefs-done-button", caption: "Reset to Defaults", onclick: "resetToDefaults"}
17 {kind: "Toolbar", className: "enyo-toolbar-light", components: [
18 {kind: "Button", content: "Done", onclick: "close", className: "enyo-button-affirmative prefs-done-button"}
21 load: function(name, prefs, values) {
22 this.$.prefsContainer.setCaption(name);
25 for (var i = 0; i < this.prefs.length; i++) {
26 var p = this.prefs[i];
31 c = this.$.prefsContainer.createComponent({kind: "HFlexBox", align: "center", components: [{content: p.label, flex: 1}]});
32 var slider = c.createComponent(p, {owner: this.$.prefsContainer});
33 slider.setPosition(values[p.name]);
36 c = this.$.prefsContainer.createComponent(p, {owner: this.$.prefsContainer});
37 c.setValue(values[p.name]);
40 this.$.prefsContainer.render();
44 for (var i = 0; i < this.prefs.length; i++) {
45 var p = this.prefs[i];
50 v = this.$.prefsContainer.$[p.name].getPosition();
53 v = this.$.prefsContainer.$[p.name].getValue();
61 resetToDefaults: function() {
66 var controls = this.$.prefsContainer.getControls();
67 for (var i = 0; i < controls.length; i++) {
68 // We destroy the parent because we want to destroy the
69 // row client, as well. This is probably a bug in
71 controls[i].parent.destroy();
72 controls[i].destroy();