aboutsummaryrefslogtreecommitdiff
path: root/js/panels/presets/content.reel/content.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/presets/content.reel/content.js')
-rw-r--r--js/panels/presets/content.reel/content.js79
1 files changed, 79 insertions, 0 deletions
diff --git a/js/panels/presets/content.reel/content.js b/js/panels/presets/content.reel/content.js
new file mode 100644
index 00000000..c43c593c
--- /dev/null
+++ b/js/panels/presets/content.reel/content.js
@@ -0,0 +1,79 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component;
9
10exports.content = Montage.create(Component, {
11 hasTemplate: {
12 value: true
13 },
14 contentPanel : {
15 value: null
16 },
17 templateDidLoad : {
18 value: function() {
19 var storedTabIndex = window.localStorage.presetsTabIndex;
20 if(storedTabIndex) {
21 this.activeTabIndex = storedTabIndex;
22 }
23 }
24 },
25 prepareForDraw : {
26 value: function() {
27 this.activeTab = this.tabs[this.activeTabIndex];
28 this.tabBar.addEventListener('click', this, false);
29 }
30 },
31 handleClick : {
32 value: function(e) {
33 var tabObject = this.tabs.filter(function(item) {
34 return item.tab === e._event.target;
35 });
36
37 if(tabObject[0]) {
38 this.activeTab = tabObject[0];
39 }
40
41 }
42 },
43 _activeTab : {
44 value: null,
45 enumerable: false
46 },
47 activeTab : {
48 get: function() {
49 return this._activeTab;
50 },
51 set: function(tabObject) {
52 this.contentPanel = tabObject.key;
53 window.localStorage.presetsTabIndex = this.tabs.indexOf(tabObject);
54 this._tabToDeactivate = this._activeTab;
55 this._activeTab = tabObject;
56
57 this.needsDraw = this._needsTabSwitch = true;
58 }
59 },
60 _tabToDeactivate : {
61 value: null,
62 enumarable: false
63 },
64 _needsTabSwitch : {
65 value: null,
66 enumerable: false
67 },
68 draw : {
69 value: function() {
70 if(this._needsTabSwitch) {
71 if(this._tabToDeactivate) {
72 this._tabToDeactivate.tab.classList.remove('active-tab');
73 }
74
75 this._activeTab.tab.classList.add('active-tab');
76 }
77 }
78 }
79});