diff options
author | Pierre Frisch | 2011-12-22 07:25:50 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-01-27 11:18:17 -0800 |
commit | b89a7ee8b956c96a1dcee995ea840feddc5d4b27 (patch) | |
tree | 0f3136ab0ecdbbbed6a83576581af0a53124d6f1 /js/panels/Project | |
parent | 2401f05d1f4b94d45e4568b81fc73e67b969d980 (diff) | |
download | ninja-b89a7ee8b956c96a1dcee995ea840feddc5d4b27.tar.gz |
First commit of Ninja to ninja-internal
Signed-off-by: Valerio Virgillito <rmwh84@motorola.com>
Diffstat (limited to 'js/panels/Project')
-rw-r--r-- | js/panels/Project/ProjectPanel.js | 43 | ||||
-rw-r--r-- | js/panels/Project/projectpanelbase.reel/ProjectPanelBase.js | 1968 | ||||
-rw-r--r-- | js/panels/Project/projectpanelbase.reel/projectpanelbase.html | 108 |
3 files changed, 2119 insertions, 0 deletions
diff --git a/js/panels/Project/ProjectPanel.js b/js/panels/Project/ProjectPanel.js new file mode 100644 index 00000000..ad431824 --- /dev/null +++ b/js/panels/Project/ProjectPanel.js | |||
@@ -0,0 +1,43 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No 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 | |||
7 | var Montage = require("montage/core/core").Montage, | ||
8 | PanelBase = require("js/panels/PanelBase").PanelBase, | ||
9 | ProjectPanelBase = require("js/panels/Project/ProjectPanelBase.reel").ProjectPanelBase; | ||
10 | |||
11 | exports.ProjectPanel = Montage.create(PanelBase, { | ||
12 | |||
13 | id: {value: "projectPanel", writable: true, enumerable: true, configurable: true}, | ||
14 | panelName: {value: "Project/Assets", writable: true, enumerable: true, configurable: true}, | ||
15 | panelHeaderID: {value: "projectPanelHeader", writable: true, enumerable: true, configurable: true}, | ||
16 | disclosureIconID: {value: "projectPanelDisclosureIcon", writable: true, enumerable: true, configurable: true}, | ||
17 | closeButtonID: {value: "projectPanelCloseButton", writable: true, enumerable: true, configurable: true}, | ||
18 | panelContentID: {value: "projectPanelContent", writable: true, enumerable: true, configurable: true}, | ||
19 | |||
20 | init: { | ||
21 | enumerable: true, | ||
22 | value: function() { | ||
23 | //Creating panel container and panel | ||
24 | this.minHeight = 350; | ||
25 | this.defaultHeight = 350; | ||
26 | this.contentHeight = 395; | ||
27 | |||
28 | /* OLD WAY -- Removing the temporary div | ||
29 | // TODO: Remove this comment once this is tested. | ||
30 | var ppContainer = document.createElement("div"); | ||
31 | ppContainer.setAttribute("id", "pp-container"); | ||
32 | this._projectPanelBase = ProjectPanelBase.create(); | ||
33 | this._projectPanelBase.element = ppContainer; | ||
34 | //Adding container to the parent | ||
35 | this.content = this._projectPanelBase; | ||
36 | //Drawing panel | ||
37 | this._projectPanelBase.needsDraw = true; | ||
38 | */ | ||
39 | |||
40 | this.content = ProjectPanelBase.create(); | ||
41 | } | ||
42 | } | ||
43 | }); | ||
diff --git a/js/panels/Project/projectpanelbase.reel/ProjectPanelBase.js b/js/panels/Project/projectpanelbase.reel/ProjectPanelBase.js new file mode 100644 index 00000000..31582153 --- /dev/null +++ b/js/panels/Project/projectpanelbase.reel/ProjectPanelBase.js | |||
@@ -0,0 +1,1968 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No 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 | |||
7 | var TreeControl = require("js/components/tree.reel").Tree, | ||
8 | ResizerControl = require("js/panels/Resizer").Resizer, | ||
9 | nj = require("js/lib/NJUtils.js").NJUtils; | ||
10 | |||
11 | exports.ProjectPanelBase = (require("montage/core/core").Montage).create(require("montage/ui/component").Component, { | ||
12 | hasTemplate: { | ||
13 | value: true | ||
14 | }, | ||
15 | _hasFocus: { | ||
16 | numerable: false, | ||
17 | value: false | ||
18 | }, | ||
19 | |||
20 | /* The current project that we have in memory */ | ||
21 | _activeProject: { | ||
22 | value: false | ||
23 | }, | ||
24 | activeProject: { | ||
25 | get: function() { | ||
26 | return this._activeProject; | ||
27 | }, | ||
28 | set: function(objNewProject) { | ||
29 | this._activeProject = objNewProject; | ||
30 | } | ||
31 | }, | ||
32 | |||
33 | /* Is the panel initialized? Helps keep us from re-initializing things when a project switches */ | ||
34 | _isPanelInitialized: { | ||
35 | value: false | ||
36 | }, | ||
37 | isPanelInitialized: { | ||
38 | get: function() { | ||
39 | return this._isPanelInitialized; | ||
40 | }, | ||
41 | set: function(boolValue) { | ||
42 | this._isPanelInitialized = boolValue; | ||
43 | } | ||
44 | }, | ||
45 | |||
46 | /* Project models: is there an active project, did the user just swap the project, etc. */ | ||
47 | _swapProject: { | ||
48 | value: false | ||
49 | }, | ||
50 | swapProject: { | ||
51 | get: function() { | ||
52 | return this._swapProject; | ||
53 | }, | ||
54 | set: function(boolValue) { | ||
55 | this._swapProject = boolValue; | ||
56 | } | ||
57 | }, | ||
58 | _updateTree: { | ||
59 | value: false | ||
60 | }, | ||
61 | updateTree: { | ||
62 | get: function() { | ||
63 | return this._updateTree; | ||
64 | }, | ||
65 | set: function(boolValue) { | ||
66 | this._updateTree = boolValue; | ||
67 | } | ||
68 | }, | ||
69 | _updateAssets: { | ||
70 | value: false | ||
71 | }, | ||
72 | _updateAssets : { | ||
73 | get: function() { | ||
74 | return this._updateAssets; | ||
75 | }, | ||
76 | set: function(boolValue) { | ||
77 | this._updateAssets = boolValue; | ||
78 | } | ||
79 | }, | ||
80 | _hasActiveProject: { | ||
81 | value: false | ||
82 | }, | ||
83 | hasActiveProject: { | ||
84 | get: function() { | ||
85 | return this._hasActiveProject; | ||
86 | }, | ||
87 | set: function(boolValue) { | ||
88 | if (this.hasActiveProject !== boolValue) { | ||
89 | this._hasActiveProject = boolValue; | ||
90 | this.needsDraw = true; | ||
91 | this.swapProject = true; | ||
92 | this.loadPanelState(); | ||
93 | } | ||
94 | } | ||
95 | }, | ||
96 | setActiveProject: { | ||
97 | value: function(myVal) { | ||
98 | this.hasActiveProject = myVal; | ||
99 | } | ||
100 | }, | ||
101 | |||
102 | /* Focus monitor: needed to modify keyboard navigation through panels. */ | ||
103 | _hasFocus: { | ||
104 | value: false | ||
105 | }, | ||
106 | hasFocus: { | ||
107 | get: function() { | ||
108 | return this._hasFocus; | ||
109 | }, | ||
110 | set: function(newVal) { | ||
111 | if (this._hasFocus !== newVal) { | ||
112 | this._hasFocus = newVal; | ||
113 | } | ||
114 | } | ||
115 | }, | ||
116 | |||
117 | /* Active column models: Used to store the state of the columns as a resize is happening */ | ||
118 | _activeColumn: { | ||
119 | enumerable: false, | ||
120 | value: false | ||
121 | }, | ||
122 | activeColumn: { | ||
123 | get: function() { | ||
124 | return this._activeColumn; | ||
125 | }, | ||
126 | set: function(intActiveColumn) { | ||
127 | this._activeColumn = intActiveColumn; | ||
128 | } | ||
129 | }, | ||
130 | _activeColumnWidths: { | ||
131 | enumerable: false, | ||
132 | value: [0,0,0] | ||
133 | }, | ||
134 | activeColumnWidths: { | ||
135 | get: function() { | ||
136 | return this._activeColumnWidths; | ||
137 | }, | ||
138 | set: function(activeColumnWidths) { | ||
139 | for (var i = 0; i < activeColumnWidths.length; i++) { | ||
140 | if (this._activeColumnWidths[i] !== activeColumnWidths[i]) { | ||
141 | this._activeColumnWidths[i] = activeColumnWidths[i]; | ||
142 | this.activeColumn = i; | ||
143 | this.needsDraw = true; | ||
144 | } | ||
145 | } | ||
146 | } | ||
147 | }, | ||
148 | |||
149 | /* resizeColumn: Method to resize a column */ | ||
150 | resizeColumn: { | ||
151 | value: function(strSelectorBase) { | ||
152 | // Resize column with index this.activeColumn in view specified by strSelectorBase. | ||
153 | var intAdjust = 0, | ||
154 | intTotalWidth = 0, | ||
155 | arrToChange = [], | ||
156 | arrToChangeLength = 0, | ||
157 | arrHeaders = document.querySelectorAll(strSelectorBase + " .pp-header"); | ||
158 | arrHeadersLength = arrHeaders.length; | ||
159 | containerList = document.querySelectorAll(strSelectorBase + " .pp-scroll-linked"); | ||
160 | containerListLength = containerList.length, | ||
161 | intNewWidth = 0, | ||
162 | strNewWidth = "", | ||
163 | boolProjectView = true, | ||
164 | arrStoredWidths = this.panelState.projectColumnWidths; | ||
165 | |||